2 Commits

Author SHA1 Message Date
eeeck b8d044301a Change define name
- "DEBUG" is also used by STM32 for... something...
2026-06-18 13:37:57 +02:00
eeeck ef034f3195 Add debug dummy CAN frame sent regularly
- Activated by defining DEBUG_DUMMY_FRAME
2026-06-18 13:37:10 +02:00
2 changed files with 24 additions and 3 deletions
+4 -2
View File
@@ -45,8 +45,10 @@ extern "C" {
/* Exported macro ------------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */ /* USER CODE BEGIN EM */
#define DEBUG #define DEBUG_ITM
#ifdef DEBUG #define DEBUG_DUMMY_FRAME
#ifdef DEBUG_ITM
#include <stdio.h> #include <stdio.h>
#define DEBUG_PRINT(...) printf(__VA_ARGS__) #define DEBUG_PRINT(...) printf(__VA_ARGS__)
#else #else
+20 -1
View File
@@ -104,7 +104,26 @@ void vUARTLogger(void *argument)
CanMessage_t message; CanMessage_t message;
char tx_buffer[45]; char tx_buffer[45];
for (;;) #ifdef DEBUG_DUMMY_FRAME
CanMessage_t dummy_frame = {
.id = 0x0CF00400, // J1939 EEC1 ID
.dlc = 8, // 8 bytes of data
.isExtended = 1, // 29-bit Extended ID
.source = 1, // CAN1
.payload = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22}
};
#endif
for (;;)
{
DEBUG_PRINT("Waiting for CAN traffic...\r\n");
#ifdef DEBUG_DUMMY_FRAME
osMessageQueuePut(xUARTQueue, &dummy_frame, 0U, 0U);
osDelay(1000);
#endif
if (osMessageQueueGet(xUARTQueue, &message, NULL, osWaitForever) == osOK)
{ {
DEBUG_PRINT("Waiting for CAN traffic...\r\n"); DEBUG_PRINT("Waiting for CAN traffic...\r\n");
if (osMessageQueueGet(xUARTQueue, &message, NULL, osWaitForever) == osOK) if (osMessageQueueGet(xUARTQueue, &message, NULL, osWaitForever) == osOK)