2020-05-07 07:19 AM
Hello,
I am using UART4 from a STM32F2. I am sending a data then my RXNE FLAG from SR register go from 0 to 1. Without doing anything (no read of the DR register and no clearing manually the flag) it go back to 0 after some time. So I am missing the data in my IT routine.
I can't figure out why this happening. Could someone have an idea of what the issue could be ?
2020-05-07 07:25 AM
Do you watch the data register in the debugger? Unfortunately the UART peripheral has no way of knowing whether it was read by the program running on the MCU or by the debugger, and resets the flags in both cases.
What does the SR register contain, are there any other flags set?
2020-05-07 07:40 AM
Thank you for your answer. Yes I am checking the DR content and he is still with my data in but the flag still go to 0.
2020-05-07 07:44 AM
I have done a pointer to the adress directly to check the content. The content is still here and the flag is still going to zero. Does checking the content of the adres is equivalent to read it ?
2020-05-07 07:51 AM
> Does checking the content of the adres is equivalent to read it ?
Yes. Reading the register in any manner will reset the flag.
2020-05-07 07:53 AM
> Does checking the content of the adres is equivalent to read it ?
Yes. How could they be different?
2020-05-07 07:55 AM
Ok so if I not read it how could I know if the debugguer is doing it ? Because my original problem is in my application I am sending and receiving data and it's working well but from time to time I am missing the last byte and I think is due to this flag reset. But I can't figure why this could happen. I've test to just check the SR flag. Not doing action on DR and got same results
2020-05-07 08:00 AM
> Ok so if I not read it how could I know if the debugguer is doing it ?
The debugger only does what you ask it to do. Don't set watchpoints at this register. Don't view peripheral addresses.
Attach a logic analyzer on the traces and see what it's actually doing. Unlikely that the SR flag is not behaving properly. Check for UART error flags. Might be a timing issue.
2020-05-07 08:04 AM
Ok thanks this is what i've done in the second part no action to the DR register with the debugguer and none with my code also. And still this reset. The issue is I am using old IDE and don't get tracer for this one.Question is this problem could happenned with a bad configuration of the peripheral ? or any other reason ?
2020-05-07 08:11 AM
> I am using UART4 from a STM32F2. I am sending a data then my RXNE FLAG from SR register go from 0 to 1.
RXNE should be set when you *receive* data, not when *sending* it from the STM32 USART.
> Without doing anything (no read of the DR register and no clearing manually the flag) it go back to 0 after some time.
How do you know?
JW