6 Commits

Author SHA1 Message Date
eeeck d2d9d21f3d Add timeout to LED heartbeat thread flags 2026-07-30 00:14:33 +02:00
eeeck f53f49a94e Revert to previous blinking logic 2026-07-30 00:06:34 +02:00
eeeck dce176cc1e Update Debug profile settings 2026-07-29 23:56:02 +02:00
eeeck e351c762d3 Remove J1939 decoding comment
- The logger should be more universal, while the data parser should
  focus on the protocol specs
2026-07-29 23:55:42 +02:00
eeeck 89b5fe349c Clear CAN FIFO 0 overflow flag in RX callback 2026-07-29 23:51:30 +02:00
eeeck 2b445aac84 Validate CAN frame DLC before processing 2026-07-29 23:51:22 +02:00
2 changed files with 12 additions and 17 deletions
+9 -14
View File
@@ -73,11 +73,15 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
osMessageQueueId_t queue;
osThreadId_t led_task;
// TODO: manage the case of FIFO overflow
if (__HAL_CAN_GET_FLAG(hcan, CAN_FLAG_FOV0) != RESET) __HAL_CAN_CLEAR_FLAG(hcan, CAN_FLAG_FOV0);
if (HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &rxHeader, data) != HAL_OK) return;
if (rxHeader.DLC > 8) return;
if (rxHeader.IDE == CAN_ID_EXT) message.id = rxHeader.ExtId;
else message.id = rxHeader.StdId;
message.dlc = rxHeader.DLC;
message.isExtended = (rxHeader.IDE == CAN_ID_EXT);
message.source = (hcan->Instance == CAN1) ? 1 : 2;
@@ -119,12 +123,7 @@ void vCANListener(void *argument)
for (;;)
{
if (osMessageQueueGet(queue, &message, NULL, 1000) == osOK)
{
// J1939 decoding
osMessageQueuePut(xUARTQueue, &message, 0U, 0U);
}
if (osMessageQueueGet(queue, &message, NULL, 1000) == osOK) osMessageQueuePut(xUARTQueue, &message, 0U, 0U);
}
}
/* END vCANListener */
@@ -141,14 +140,10 @@ void vLEDHeartbeat(void *argument)
for (;;)
{
uint32_t notification = osThreadFlagsWait(0x01, osFlagsWaitAny, osWaitForever);
uint32_t notification = osThreadFlagsWait(0x01, osFlagsWaitAny, LED_BLINK_MS);
if (notification & 0x01)
{
HAL_GPIO_WritePin(led->port, led->pin, GPIO_PIN_SET);
osDelay(LED_BLINK_MS);
HAL_GPIO_WritePin(led->port, led->pin, GPIO_PIN_RESET);
}
if (notification & 0x01) HAL_GPIO_WritePin(led->port, led->pin, GPIO_PIN_SET);
else HAL_GPIO_WritePin(led->port, led->pin, GPIO_PIN_RESET);
}
}
/* END vLEDHeartbeat */
+3 -3
View File
@@ -15,7 +15,7 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.enabled" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.value" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Debug/can-logger.elf&quot;,&quot;fProjectName&quot;:&quot;can-logger&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;/Users/erickahmed/TESI/j1939-can-logger_NEW/can-logger/can-logger/Debug/can-logger.elf&quot;,&quot;fProjectName&quot;:&quot;can-logger&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.mode" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.multi_drop_enabled" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
@@ -74,9 +74,9 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/can-logger.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="/Users/erickahmed/TESI/j1939-can-logger_NEW/can-logger/can-logger/Debug/can-logger.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="can-logger"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.642969664"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">