whizvova.blogg.se

Mbed nucleo f411re
Mbed nucleo f411re






mbed nucleo f411re
  1. #Mbed nucleo f411re serial#
  2. #Mbed nucleo f411re code#
mbed nucleo f411re

When you're waiting, the OS will be setting up a timer for a 100ms delay, then stopping the CPU, and you'll wake from that timed sleep within a millisecond anyway when the next character arrives. When you're continuously running, there will be OS ticks running every millisecond.

#Mbed nucleo f411re code#

The result is consistent with the "schedule next OS tick while active" code causing higher interrupt latency than the "set up timer for OS idle" code. Your own application code spinning cannot directly be stopping interrupts triggering - whatever you're doing will be interrupted. But again, looking at your code, I don't see why that should be losing characters. Rather than writing your own interrupt handler, I suggest you use UARTSerial. The UART is the first thing to start visibly suffering with bad interrupt latency, but it will affect other devices too like radios.

#Mbed nucleo f411re serial#

That's why you need an interrupt handler, and the interrupt latency in the system should be targeted at around the 100us mark which means you shouldn't lose non-flow-control UART characters.Īn awful lot of boards do have no control on certain serial ports - particularly the debug terminal line to the USB, so as a quality-of-implementation aim we want it to be possible to reasonably reliably receive non-flow-controlled data via a buffered serial device like UARTSerial.Īnd it's kind of the canary in the coal-mine. So I assume you'd want to use HW flow control. but anyway when your application will start doing something else, you'd lose characters anyway. Here is seems like it takes time reading the timer. (I believe the lptimer calls are made with IRQs fully masked, so serial IRQs get starved as much as the foreground thread).Īnd I think there will always be cases where the test will fail because receiver CPU is busy doing something else. Certainly you should be using UARTSerial normally to make reception reliable, but this specific test case was devoting 100% of foreground CPU time to reading the serial port - that should get the data out of the hardware as fast as an interrupt handler could. Now, I'm not confident that if this test app fails (with no other threads running) that UARTSerial will work any better. (It is derived from BufferedSerial, but the name got changed just to avoid name conflicts). UARTSerial is the in-tree class that provides buffering.








Mbed nucleo f411re