Unexpected behavior on Serial2 #378
-
I'm having a problem with Serial2. I'm attempting to use a library that I've used on other Arduinos with no problem. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Nothing, you're correct. The The Pico-SDK, when I looked at it and wrote the core, only let us know if the HW UART FIFO was readable or not, and did not give any indication as to exactly how full it was. So, the code is only returning ever 0 or 1. arduino-pico/cores/rp2040/SerialUART.cpp Line 148 in 7120a15 I'll have to look at the SDK and see if there is some way to see what the actual FIFO count is. Alternatively, the Serial`/2 ports might need to implement their own software FIFOs and use IRQs to fill them from the HW FIFO. In that case, it's trivial to know how many bytes are available. But implementing that way is sadly a non-trivial amount of work. |
Beta Was this translation helpful? Give feedback.
-
Okay, good to know I'm not missing anything. I'll see if I can figure out a way to modify the library I'm using to work around it. Thanks for all of your work on this core. |
Beta Was this translation helpful? Give feedback.
-
Looks like it's working. Don't have time to fully test right now, but it passed a couple of quick tests with the original library. I had to change back because I had just finished a quick hack to the library to make it work with the old system. I'll try and test more fully tonight. Thanks! |
Beta Was this translation helpful? Give feedback.
-
It's passed all my tests with the library I needed it for. No errors that I can find. Thanks! |
Beta Was this translation helpful? Give feedback.
Nothing, you're correct. The
Serial
port is USB and has a very different code path thanSerial1/2
which are UART based.The Pico-SDK, when I looked at it and wrote the core, only let us know if the HW UART FIFO was readable or not, and did not give any indication as to exactly how full it was. So, the code is only returning ever 0 or 1.
arduino-pico/cores/rp2040/SerialUART.cpp
Line 148 in 7120a15
I'll have to look at the SDK and see if there is some way to see what the actual FIFO count is. Alternatively, the Serial`/2 ports might need to implement their own software FIFOs and use IRQs to fill them from …