-
Notifications
You must be signed in to change notification settings - Fork 1k
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
nrf52 targets stall reading from pseduo serial device sometimes #838
Comments
hmm the every 20 second battery messages are not getting printed promptly. they seem to sit in a queue until a char is sent from the pc |
the problem is occurring below the level of Stream.flush(), it is in the nrf52 usb code? cdc_device.c? |
Tiny USB 1.4.2 loaded in your enviro? Or 1.4.0? 1.4.0 had a race condition on the NRF52. |
1.4.3 alas - I think they still have a problem. I'll work on a fix soon but my back is bugging me so it will probably be another couple of days... |
This issue has been mentioned on Meshtastic. There might be relevant details there: https://meshtastic.discourse.group/t/geeksvilles-current-task-list-now-working-on-nrf52-fixes/514/66 |
OH! I think I just found the bug. Testing now - looks good! USB client code on linux hangs because it seems to expect to always receive a response to reads from the device (even if no characters are pending). Without that response the cdc driver on linux hangs eventually (until a new character is sent from linux to the device)
|
… serial Problem statement: Sometimes characters written from the nrf52 pseudo serial device to a linux host would stop showing up on the linux app side. This occurred randomly but typically within a few minutes after starting a session. The reading from linux would remain 'hung' until you type a character on the linux side (thus doing a new write TOWARDS the nrf52). Theory: it seemed like something was getting hung on the linux side waiting on a response to a read. This led me to this code. If I changed the code to always send a response to any read from ep_in (rather than opting to not send a response at all in some circumstances), "screen" apps stopped hanging. Notes: * problem reproducable with 'screen /dev/ttyACM0 921600' or other serial clients (I initially used the meshtastic-python app) * It is a _long_ time since I've messed with USB code and my analysis is probably pretty sloppy here. But I wanted it report it upstream in case it is useful for others. If there is a better fix for this problem (likely) I'd love to change to it. 'fixes' meshtastic/firmware#838
fixed in Adafruit_TinyUSB_Arduino. The next clean build (for anyone who does "pio update") should get this fix automatically. |
… serial Problem statement: Sometimes characters written from the nrf52 pseudo serial device to a linux host would stop showing up on the linux app side. This occurred randomly but typically within a few minutes after starting a session. The reading from linux would remain 'hung' until you type a character on the linux side (thus doing a new write TOWARDS the nrf52). Theory: it seemed like something was getting hung on the linux side waiting on a response to a read. This led me to this code. If I changed the code to always send a response to any read from ep_in (rather than opting to not send a response at all in some circumstances), "screen" apps stopped hanging. Notes: * problem reproducable with 'screen /dev/ttyACM0 921600' or other serial clients (I initially used the meshtastic-python app) * It is a _long_ time since I've messed with USB code and my analysis is probably pretty sloppy here. But I wanted it report it upstream in case it is useful for others. If there is a better fix for this problem (likely) I'd love to change to it. 'fixes' meshtastic/firmware#838
fixed in lib above |
while merging #837 I noticed the following:
Sometimes nrf52 targets will stall reading from the pseduo serial port. This is only apparent if you have the port open via a terminal program or "meshtastic --noproto".
Steps to repro:
The text was updated successfully, but these errors were encountered: