mirror of
https://gitee.com/dlmu-cone/tronone-h7-scaffold
synced 2026-07-23 19:25:09 +08:00
changed FDCAN!PowerModule OK!
This commit is contained in:
@@ -288,42 +288,59 @@ void CANSetDLC(FDCANInstance *_instance, uint8_t length)
|
||||
*/
|
||||
static void FDCANFIFOxCallback(FDCAN_HandleTypeDef *_hfdcan, uint32_t fifox)
|
||||
{
|
||||
static FDCAN_RxHeaderTypeDef rxconf; // 同上
|
||||
static FDCAN_RxHeaderTypeDef rxconf;
|
||||
static uint16_t DataLength = 0;
|
||||
static uint8_t fdcan_rx_buff[8];
|
||||
while (HAL_FDCAN_GetRxFifoFillLevel(_hfdcan, fifox)) // FIFO不为空,有可能在其他中断时有多帧数据进入
|
||||
|
||||
while (HAL_FDCAN_GetRxFifoFillLevel(_hfdcan, fifox))
|
||||
{
|
||||
HAL_FDCAN_GetRxMessage(_hfdcan, fifox, &rxconf, fdcan_rx_buff); // 从FIFO中获取数据
|
||||
//解析数据长度,@Todo 此处在用新版本重新生成后可能得修改,DataLength可能不需要右移,具体情况具体看 !
|
||||
if (((rxconf.DataLength >> 16) & 0xF) >= 0 && ((rxconf.DataLength >> 16) & 0xF) <= 8)
|
||||
HAL_FDCAN_GetRxMessage(_hfdcan, fifox, &rxconf, fdcan_rx_buff);
|
||||
|
||||
//@todo:DataLength解析
|
||||
switch (rxconf.DataLength)
|
||||
{
|
||||
DataLength = (rxconf.DataLength >> 16) & 0xF; // 保存接收到的数据长度
|
||||
}
|
||||
else
|
||||
{
|
||||
DataLength = 0;
|
||||
case FDCAN_DLC_BYTES_0: DataLength = 0;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_1: DataLength = 1;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_2: DataLength = 2;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_3: DataLength = 3;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_4: DataLength = 4;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_5: DataLength = 5;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_6: DataLength = 6;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_7: DataLength = 7;
|
||||
break;
|
||||
case FDCAN_DLC_BYTES_8: DataLength = 8;
|
||||
break;
|
||||
// 如果后续用到了 FDCAN 真正的长帧(12~64字节),可以在这里继续加 case
|
||||
default: DataLength = 8;
|
||||
break; // 兜底保护
|
||||
}
|
||||
|
||||
if (rxconf.RxFrameType == FDCAN_DATA_FRAME && rxconf.IdType == FDCAN_STANDARD_ID)
|
||||
{
|
||||
for (size_t i = 0; i < idx; ++i)
|
||||
{
|
||||
// 两者相等说明这是要找的实例
|
||||
if (_hfdcan == fdcan_instance[i]->can_handle && rxconf.Identifier == fdcan_instance[i]->rx_id)
|
||||
{
|
||||
if (fdcan_instance[i]->can_module_callback != NULL) // 回调函数不为空就调用
|
||||
if (fdcan_instance[i]->can_module_callback != NULL)
|
||||
{
|
||||
fdcan_instance[i]->rx_len = DataLength; // 保存接收到的数据长度
|
||||
memcpy(fdcan_instance[i]->rx_buff, fdcan_rx_buff, fdcan_instance[i]->rx_len); // 消息拷贝到对应实例
|
||||
fdcan_instance[i]->can_module_callback(fdcan_instance[i]); // 触发回调进行数据解析和处理
|
||||
fdcan_instance[i]->rx_len = DataLength;
|
||||
memcpy(fdcan_instance[i]->rx_buff, fdcan_rx_buff, fdcan_instance[i]->rx_len);
|
||||
fdcan_instance[i]->can_module_callback(fdcan_instance[i]);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs)
|
||||
{
|
||||
/* 检查Rx FIFO 0中是否有消息丢失 */
|
||||
|
||||
@@ -3,6 +3,7 @@ Breakpoint=D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/power_m
|
||||
Breakpoint=D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/power_meters/xiditech/xidipwmeter.c:77:1, State=BP_STATE_DISABLED
|
||||
GraphedExpression="(QEKF_INS).Roll", Color=#a00909
|
||||
GraphedExpression="(BMI088).Temperature", Color=#09a01b
|
||||
GraphedExpression="(QEKF_INS).Pitch", Color=#09a087
|
||||
OpenDocument="bsp_dwt.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/bsp/dwt/bsp_dwt.c", Line=59
|
||||
OpenDocument="stm32h7xx_hal_spi.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c", Line=1553
|
||||
OpenDocument="tasks.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/Middlewares/Third_Party/FreeRTOS/Source/tasks.c", Line=2295
|
||||
@@ -29,32 +30,32 @@ OpenDocument="ws2812.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Co
|
||||
OpenDocument="ins_task.c", FilePath="D:/RM/Elec Control/TronOneH7_Scaffold/User_Code/module/periph/imu/ins_task.c", Line=0
|
||||
OpenToolbar="Debug", Floating=0, x=0, y=0
|
||||
OpenToolbar="Breakpoints", Floating=0, x=1, y=0
|
||||
OpenWindow="Call Stack", DockArea=RIGHT, x=0, y=0, w=681, h=261, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Call Stack", DockArea=RIGHT, x=0, y=0, w=681, h=263, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Registers 1", DockArea=BOTTOM, x=1, y=0, w=361, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, FilteredItems=[], RefreshRate=1
|
||||
OpenWindow="Source Files", DockArea=LEFT, x=0, y=0, w=663, h=273, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Disassembly", DockArea=BOTTOM, x=2, y=0, w=629, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=1, w=663, h=228, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254
|
||||
OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=1, w=663, h=234, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254
|
||||
OpenWindow="Memory 1", DockArea=BOTTOM, x=3, y=0, w=465, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x2000B98C
|
||||
OpenWindow="Global Data", DockArea=RIGHT, x=0, y=3, w=681, h=295, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Watched Data 1", DockArea=LEFT, x=0, y=2, w=663, h=329, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Functions", DockArea=LEFT, x=0, y=3, w=663, h=242, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Call Graph", DockArea=LEFT, x=0, y=3, w=663, h=242, TabPos=2, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Global Data", DockArea=RIGHT, x=0, y=3, w=681, h=292, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Watched Data 1", DockArea=LEFT, x=0, y=2, w=663, h=321, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Functions", DockArea=LEFT, x=0, y=3, w=663, h=244, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Call Graph", DockArea=LEFT, x=0, y=3, w=663, h=244, TabPos=2, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Data Sampling", DockArea=BOTTOM, x=0, y=0, w=1102, h=181, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=2, w=681, h=291, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="1 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="395;0", PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="459;-65", CodeGraphLegendShown=0, CodeGraphLegendPosition="475;0"
|
||||
OpenWindow="Console", DockArea=LEFT, x=0, y=3, w=663, h=242, TabPos=0, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="FreeRTOS", DockArea=RIGHT, x=0, y=1, w=681, h=245, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, Showing="Task List"
|
||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=2, w=681, h=288, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="1 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="0;0", PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="459;-65", CodeGraphLegendShown=0, CodeGraphLegendPosition="475;0"
|
||||
OpenWindow="Console", DockArea=LEFT, x=0, y=3, w=663, h=244, TabPos=0, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="FreeRTOS", DockArea=RIGHT, x=0, y=1, w=681, h=249, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, Showing="Task List"
|
||||
TableHeader="Functions", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Address";"Size";"#Insts";"Source"], ColWidths=[1164;100;100;100;100]
|
||||
TableHeader="Global Data", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Location";"Size";"Type";"Scope"], ColWidths=[222;130;100;54;95;100]
|
||||
TableHeader="Global Data", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Location";"Size";"Type";"Scope"], ColWidths=[222;130;100;54;95;486]
|
||||
TableHeader="Vector Catches", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Vector Catch";"Description"], ColWidths=[50;300;500]
|
||||
TableHeader="Break & Tracepoints", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[100;100;142;342]
|
||||
TableHeader="Break & Tracepoints", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[100;100;142;321]
|
||||
TableHeader="Call Stack", SortCol="Function", SortOrder="ASCENDING", VisibleCols=["Function";"Stack Frame";"Source";"PC";"Return Address";"Stack Used"], ColWidths=[110;126;190;100;190;100]
|
||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[229;100;100;100;1046]
|
||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time";" (QEKF_INS).Roll";" (BMI088).Temperature"], ColWidths=[100;100;100;100]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[320;100;102;102;100;102;102;118;118]
|
||||
TableHeader="Data Sampling Table", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";" (QEKF_INS).Roll";" (BMI088).Temperature";" (QEKF_INS).Pitch"], ColWidths=[100;100;100;100;100]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[320;100;110;102;100;102;102;118;118]
|
||||
TableHeader="Power Sampling", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Ch 0"], ColWidths=[100;100;100]
|
||||
TableHeader="Task List", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Run Count";"Priority";"Status";"Timeout";"Stack Info (Free / Size)";"ID";"Mutex Count";"Notified Value";"Notify State"], ColWidths=[110;110;110;110;110;110;110;110;110;110]
|
||||
TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[100;105;294]
|
||||
TableHeader="Watched Data 1", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Value";"Type";"Location";"Refresh"], ColWidths=[171;101;162;112;100]
|
||||
TableHeader="Watched Data 1", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Value";"Type";"Location";"Refresh"], ColWidths=[171;101;162;112;117]
|
||||
TableHeader="RegisterSelectionDialog", SortCol="None", SortOrder="ASCENDING", VisibleCols=[], ColWidths=[]
|
||||
TableHeader="Call Graph", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Stack Total";"Stack Local";"Code Total";"Code Local";"Depth";"Called From"], ColWidths=[384;100;100;100;100;100;118]
|
||||
TableHeader="TargetExceptionDialog", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Address";"Description"], ColWidths=[27;27;27;38]
|
||||
|
||||
Reference in New Issue
Block a user