Use DEBUG_PRINT instead of DMA on diagnostic print

This commit is contained in:
2026-06-24 13:35:54 +02:00
parent 8d6e481968
commit 6da4ca1270
+4 -21
View File
@@ -157,27 +157,10 @@ void vUARTLogger(void *argument)
}
else
{
if (osSemaphoreAcquire(xUARTDMASemaphore, queue_timeout) == osOK)
{
int len = snprintf(diag_buf, sizeof(diag_buf),
"[D] ISR1:%lu ISR2:%lu | ST1:%lu ST2:%lu | ER1:0x%lX ER2:0x%lX\r\n",
(unsigned long)can1_rx_isr_count, (unsigned long)can2_rx_isr_count,
(unsigned long)HAL_CAN_GetState(&hcan1), (unsigned long)HAL_CAN_GetState(&hcan2),
(unsigned long)HAL_CAN_GetError(&hcan1), (unsigned long)HAL_CAN_GetError(&hcan2));
if (len > 0)
{
if (HAL_UART_Transmit_DMA(&huart1, (uint8_t*)diag_buf, len) != HAL_OK) osSemaphoreRelease(xUARTDMASemaphore);
}
else osSemaphoreRelease(xUARTDMASemaphore);
}
else
{
HAL_UART_Abort(&huart1);
HAL_UART_Init(&huart1);
osSemaphoreRelease(xUARTDMASemaphore);
DEBUG_PRINT("ERROR: Semaphore timeout! UART might be stuck in BUSY state.\r\n");
}
DEBUG_PRINT("[D] ISR1:%lu ISR2:%lu | ST1:%lu ST2:%lu | ER1:0x%lX ER2:0x%lX\r\n",
(unsigned long)can1_rx_isr_count, (unsigned long)can2_rx_isr_count,
(unsigned long)HAL_CAN_GetState(&hcan1), (unsigned long)HAL_CAN_GetState(&hcan2),
(unsigned long)HAL_CAN_GetError(&hcan1), (unsigned long)HAL_CAN_GetError(&hcan2));
}
}
}