11 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
eeeck 8b8c97316b Update LED heartbeat to use blocking delay 2026-07-29 23:50:52 +02:00
eeeck 714051c66d Specify that LICENSE is GPLv3-or-later 2026-07-13 15:22:28 +02:00
eeeck 89b3b6b876 Change title 2026-07-13 14:54:07 +02:00
eeeck e57188a51e Wait forever for next CAN message
- Avoid debug log spam
2026-07-07 14:46:38 +02:00
eeeck 3780497e8d Avoid ISR blocking and add overflow protection 2026-07-07 14:45:15 +02:00
4 changed files with 20 additions and 19 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
# Third-Party Notices
# Copyright Notices
This project is built with open source components and includes third-party software:
## 1. Original Application Code
- **Copyright (c) 2026 Erick Ahmed**
- **License:** [GNU General Public License v3.0](https://git.erickahmed.com/erickahmed/CANdigger/src/branch/main/LICENSE)
- **License:** [GNU General Public License v3.0 or later](https://git.erickahmed.com/erickahmed/CANdigger/src/branch/main/LICENSE)
## 2. STM32F4 HAL Drivers
- **Copyright (c) 2016 STMicroelectronics**
+6 -7
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 */
+9 -7
View File
@@ -40,26 +40,28 @@ extern osSemaphoreId_t xUARTDMASemaphore;
*/
void uart_printf(const char *fmt, ...)
{
if (__get_IPSR() != 0) return;
char buffer[128];
va_list args;
va_start(args, fmt);
int len = vsnprintf(buffer, sizeof(buffer), fmt, args);
va_end(args);
if (len > 0)
{
if (osKernelGetState() == osKernelRunning && __get_IPSR() == 0)
if (len >= sizeof(buffer)) len = sizeof(buffer) - 1;
if (osKernelGetState() == osKernelRunning)
{
if (osSemaphoreAcquire(xUARTDMASemaphore, 100U) == osOK)
if (osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever) == osOK)
{
HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY);
osSemaphoreRelease(xUARTDMASemaphore);
}
}
else
{
HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY);
}
else HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY);
}
}
/* END uart_printf */
@@ -175,7 +177,7 @@ void vUARTLogger(void *argument)
for (;;)
{
if (osMessageQueueGet(xUARTQueue, &message, NULL, 1000U) == osOK)
if (osMessageQueueGet(xUARTQueue, &message, NULL, osWaitForever) == osOK)
{
if (osSemaphoreAcquire(xUARTDMASemaphore, 100U) == osOK)
{
+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">