Use DEBUG_PRINT instead of DMA on diagnostic print
This commit is contained in:
+4
-21
@@ -157,27 +157,10 @@ void vUARTLogger(void *argument)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (osSemaphoreAcquire(xUARTDMASemaphore, queue_timeout) == osOK)
|
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,
|
||||||
int len = snprintf(diag_buf, sizeof(diag_buf),
|
(unsigned long)HAL_CAN_GetState(&hcan1), (unsigned long)HAL_CAN_GetState(&hcan2),
|
||||||
"[D] ISR1:%lu ISR2:%lu | ST1:%lu ST2:%lu | ER1:0x%lX ER2:0x%lX\r\n",
|
(unsigned long)HAL_CAN_GetError(&hcan1), (unsigned long)HAL_CAN_GetError(&hcan2));
|
||||||
(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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user