2024-11-13 11:21 AM
Using the STM32U083C-DK discovery board with STM32CubeIDE and set up the project using the Device Configuration Tool.
Set up a simple program to transmit 8-bit data out one UART using interrupts and receive it in another UART using DMA.
Variables used:
Relevant main.c code:
The UARTEx handler toggles the green LED when the Idle event is detected.
The program works, but the RxDataLen size is 9 bytes, not 8 and the first buffer byte is always 0. The remaining bytes are correct per my predefined array. If I loop this sequence, the results are always the same.
A scope screenshot clearly shows there isn't a leading 0x00 byte being sent. Purple trace is the LED toggle on Idle.
I've tried adding delays between the DMA and transmit and it doesn't change the result. If I read the USART3->RDR register before the HAL_UARTEx_ReceiveToIdle_DMA(), then it works correctly (8 bytes, UART3_RxBuffer1[0] = 0x12). It doesn't seem like I should have to do that.
Is there a better way to fix this?