You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use an MSC for writing flash as well as several simultaneous CDC devices, including one for STDOUT.
I seem to have run into an issue during an MSC read where tud_cdc_n_write_available for the CDC STDOUT interface seems to run out of space and eventually deadlock, because every time tud_task() to get the CDC interface to output data and make space, an mscd_xfer_cb is received with the incoming data, which gets processed, printing more info to stdout.
I suppose to simplify my question, if I am writing all data received by mscd_xfer_cb plus some additional data to tud_cdc_n_write(), and the write to CDC is blocking, is it possible to do that without deadlocking? Having dug through the code a bit it seems like each time tud_task() is called it fires all the drivers and callbacks, so it seems like this use case would deadlock, because we need to output cdc data faster than msc data, or delay/repeat the incoming msc callback after a cdc write has completed to flush the buffer, unless there is something I'm missing.
To be clear, this isn't what I'm doing, I'm just outputting a lot of debug data into stdout, which is going into a CDC interface, during a file write to an MSC interface, which is then being written to flash on an RP2040 or ESP32, depending on file format.
Or should tud_task() not be called to try to process the cdc_write buffer?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm trying to use an MSC for writing flash as well as several simultaneous CDC devices, including one for STDOUT.
I seem to have run into an issue during an MSC read where tud_cdc_n_write_available for the CDC STDOUT interface seems to run out of space and eventually deadlock, because every time tud_task() to get the CDC interface to output data and make space, an mscd_xfer_cb is received with the incoming data, which gets processed, printing more info to stdout.
I suppose to simplify my question, if I am writing all data received by mscd_xfer_cb plus some additional data to tud_cdc_n_write(), and the write to CDC is blocking, is it possible to do that without deadlocking? Having dug through the code a bit it seems like each time tud_task() is called it fires all the drivers and callbacks, so it seems like this use case would deadlock, because we need to output cdc data faster than msc data, or delay/repeat the incoming msc callback after a cdc write has completed to flush the buffer, unless there is something I'm missing.
To be clear, this isn't what I'm doing, I'm just outputting a lot of debug data into stdout, which is going into a CDC interface, during a file write to an MSC interface, which is then being written to flash on an RP2040 or ESP32, depending on file format.
Or should tud_task() not be called to try to process the cdc_write buffer?
Beta Was this translation helpful? Give feedback.
All reactions