2025-03-19 2:29 AM
Im not sure what is going on...
The goal is to receive an unknown transmission length from the UART.
Issues:
HAL_UARTEx_ReceiveToIdle_IT(): Issue
Baudrate: 9600
Reception interval: ~200 ms
The most common amount of bytes to receive is 8 (one packet). The RxEventCallback function is called at the start of the next packet.
Packet 1 is sent -> 200ms of nothing -> Packet 2 is sent -> RxEventCallback is immediately called with the reception size being 9-bytes. All data is correct and no errors are thrown.
Previous working approaches on other processors.
STM32F4:
HAL_UARTEx_ReceiveToIdle_DMA(&huart3, buffer, size);
__HAL_DMA_DISABLE_IT(&hdma_usart3_rx, DMA_IT_HT);
__HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
Handle data in:
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size){
return;
}
Old 8-bit processors:
UART Rx IRQ
Read byte and start & reset timer counting register.
Timer overflows and calls interrupt when data is no longer received.
What is going on with the DMA?
I would prefer the DMA approach for obvious reasons but cannot get it to work.
I've tested the exact same code and configuration as on other ST processors but i get zero transmission or reception!