-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nucleo F411RE USART2 stops sending under certain conditions #899
Comments
I've noted similar behavior on multiple platforms and it seems to do with Stream as a base class. Can you try to create RawSerial objects instead of Serial? Here is a similar test harness that exhibits the problem. http://developer.mbed.org/users/sam_grove/code/data_loss_test/ |
I forgot to mention that I tried RawSerial objects in my test setup and got the same results as Serial objects. |
ARM Internal Ref: IOTMORF-290 |
@mfiore02 With Serial objects I can indeed encounter the issue when running @ 115200kbps. I have checked the reason behind and we're reaching the limits of processing in the main loop when increasing the baudrate, i.e. 2 consecutive char will be received on 1 serial while the other one is being checked. Using the RawSerial is more effective so this is pushing the limit, but increasing the baudrate further would end up in the same situation sooner or later. When reaching the limit, serial IP faces an overflow error (UART_FLAG_ORE) and will not be readable until this flag is cleared. I made a dirty patch that clears the flag in calls to serial_readable, then the next characters can be received again, but characters have been lost anyway, so I'm not sure this is what we want. @sg- @0xc0170 About the asymmetric behavior USART2 vs. USART1 & 6, this is most probably related to the buses frequencies. UART1 & 6 are on APB2 while USART2 is on APB1 and the frequencies differ, so the performance limit will vary as well.
|
@mfiore02 - thanks for the link. From what I've seen your PRs apply in IRQ based communication, which makes more sense I think that polling in the main loop ! So let us know if you think we can close this issue or not |
@LMESTM True, polling is far from efficient. I agree with your reasoning - the difference in APB speeds does explain the issue. I think the "dirty patch" may be worthwhile even if it's not a perfect solution. It seems to me that losing some data is better than getting stuck indefinitely. |
@mfiore02 - Ok then let's look for a fix. the fix I tried was checks the error flags at every call to _readable() and erase any found error. This would decrease performances further and not even inform application of encountrered error. I think a proper fix would imply a way to inform the running application that there was an error. so back to the question @sg- @0xc0170 Any idea how to do this ? As of now, readable() doesn't allow application to manage error cases. |
As you wrote earlier, handle errors so it wont affect the application. To report them, we will need to extend API. There was an addition for this in mbed 3, we will consider this. cc @c1728p9 |
I have a feature branch with this API extension here (Initially proposed in #2566): |
@0xc0170 |
ST_TO_BE_CLOSED |
@0xc0170 can you please close it ? |
I've encountered a problem with USART2 on the STM32F411RE processor. I have a simple serial passthrough program that allows bi-directional data flow through the processor
I've been building against revision 06e2b3c of the master branch. I've done my testing with GCC ARM Embedded, but I've duplicated some tests with IAR to make sure the issue wasn't related to the GCC ARM Embedded toolchain.
I've been reproducing this issue by streaming a ~100kB text file through the device. I have a python script that sends the file into a serial port on my PC and another script that reads the other serial port into a file on my PC. Both serial ports are (obviously) connected to USARTs on the Nucleo. I then compare the original and received file.
What I see is the following:
I have established that the entire processor isn't locking up by setting up a Ticker object with a callback that blinks LED1 on the Nucleo. Even after my serial data stops, the LED keeps blinking indefinitely.
I'm always hesitant to point fingers at hardware too early, but I'm not sure what else to think at the moment. Anybody have any suggestions? I'm happy to share complete binaries/code/scripts I'm using in the testing process if anybody wants to take a look for themselves.
-Mike
The text was updated successfully, but these errors were encountered: