Hardware UART: question about setFIFOSize() #2171
-
Hello, But then we have setFIFOSize(), which apparently accepts whatever size_t value. How does this work? Does it add a software buffer to the hardware buffer? I have a use case where I have to receive data from a serial port set at 1'500'000 baud and don't want to lose data. Many thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Yes, this is a SW FIFO external to the HW one, driven by interrupts normally off of the HW-FIFO-not-empty signal. |
Beta Was this translation helpful? Give feedback.
-
Thank you. Do you have a suggestion about a sensible value for 1.5 Mbaud? |
Beta Was this translation helpful? Give feedback.
Err, depends on the length of your message and how often you can service the serial port. At some point you need to make the servicing of messages == the rate they're coming in or it'll overflow no matter how big the buffer. Making it bigger shouldn't cause any issue, so if you have a 1K message @ 1.5MBaud every second, I'd just pop in a 1K buffer and be done with it...
Back of the envelope, 1.5MBaud = 150Kbyte/sec which at 133MHZ = ~900 CPU insns/byte (times two since there's a second core) so it doesn't seem too bad even on smaller buffers if you're only servicing the serial port.