2023-10-21 06:29 AM
Hello all,
I have a project using UART DMA for receive datas from Nextion HMI. When i touch a button on Nextion Screen, data should be received a buffer via UART DMA.
First five hour it works good but after five hours no data flows. It is like the button doesnt work. I checked wire and other hardware stuff. They are all OK. It seems my code is wrong. Can anyone help to find where is the mistake? Shold i arrange flags?
Thanks in advance. You can find the code below.
2023-10-21 06:33 AM
You're going to want to test and clear receiver errors, like Noise, Framing, Overrun, etc.
If not errors/issues in UART, check DMA unit reporting.
2023-10-21
10:33 AM
- last edited on
2023-10-24
05:51 AM
by
Lina_DABASINSKA
UART is a stream interface, not message interface... One cannot just look for the data at a constant offset in the buffer - one has to find the beginning of the message according to the used higher layer protocol and parse that message properly.
The HAL_UARTEx_RxEventCallback() function is also called on the IDLE event and doen't mean that all of the buffer is full. That's why it has a Size parameter. And, on top of that, the HAL_UARTEx_ReceiveToIdle_DMA() call is not guaranteed to succeed...
https://community.st.com/t5/stm32-mcus-products/stm32f401-hal-uart-dma-qna/td-p/569223
Learn this: