Add debug dummy CAN frame sent regularly

- Activated by defining DEBUG_DUMMY_FRAME
This commit is contained in:
2026-06-18 13:30:50 +02:00
parent 825ddc6961
commit ef034f3195
2 changed files with 22 additions and 1 deletions
+2
View File
@@ -46,6 +46,8 @@ extern "C" {
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
#define DEBUG
#define DEBUG_DUMMY_FRAME
#ifdef DEBUG
#include <stdio.h>
#define DEBUG_PRINT(...) printf(__VA_ARGS__)
+20 -1
View File
@@ -104,7 +104,26 @@ void vUARTLogger(void *argument)
CanMessage_t message;
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");
if (osMessageQueueGet(xUARTQueue, &message, NULL, osWaitForever) == osOK)