IDF version (run git describe --tags to find it): master branch, cloned on 27-05-2022
Build System: idf.py
Operating System: Ubuntu 22.04
Using an IDE?: VSCode
Power Supply: external 3.3V
Problem Description
I have 5 functions periodically executed by the timer service, 3 of them about every 1-3 seconds, the other 2 every 10ms and 40ms, but they only start running once the usb-cdc port is opened on the pc side.
Everything works right before and during the pc connection. But once I close the cdc port from the pc side, the two fast functions continue getting called by the timer, while the slower 3 stop getting called. I set up log statements at the very start and very end of each function to determine the moments each enters and exists. I am sure no function is hanging mid-way. This isn't even possible, as it would have to stall the entire timer service to my knowledge, causing the whole timer thread to hang. But the timer thread doesn't hang, as evident by the continued calling of the fast functions. Yet the other 3 are not entered again at all until the cdc port is opened again.
I tried twiddling the tinyusb and timer priorities, making each higher than the other. this has no effect on the problematic behavior. The only way this scenario is even possible, to my knowledge, is if the timer service explicitly decides to skip executing some functions. I'm not aware it can do this, nor why it would do this for the slow functions. Either way, I don't see why the choice would depend on whether usb-cdc is open or not. All functions, expecially the fast executing ones, do read and/or write operations to usb-cdc, so I don't see why some would behave differently than others.
If I increase the periods of the fast functions to 100ms and 400ms, the problem disappears. But this is not an acceptable workaround.
Code
I can't upload the whole project, and it is time consuming to produce a minimal example of a bug for github. So I will do it as soon as I can.
sdkconfig.txt
Environment
git describe --tags
to find it): master branch, cloned on 27-05-2022Problem Description
I have 5 functions periodically executed by the timer service, 3 of them about every 1-3 seconds, the other 2 every 10ms and 40ms, but they only start running once the usb-cdc port is opened on the pc side.
Everything works right before and during the pc connection. But once I close the cdc port from the pc side, the two fast functions continue getting called by the timer, while the slower 3 stop getting called. I set up log statements at the very start and very end of each function to determine the moments each enters and exists. I am sure no function is hanging mid-way. This isn't even possible, as it would have to stall the entire timer service to my knowledge, causing the whole timer thread to hang. But the timer thread doesn't hang, as evident by the continued calling of the fast functions. Yet the other 3 are not entered again at all until the cdc port is opened again.
I tried twiddling the tinyusb and timer priorities, making each higher than the other. this has no effect on the problematic behavior. The only way this scenario is even possible, to my knowledge, is if the timer service explicitly decides to skip executing some functions. I'm not aware it can do this, nor why it would do this for the slow functions. Either way, I don't see why the choice would depend on whether usb-cdc is open or not. All functions, expecially the fast executing ones, do read and/or write operations to usb-cdc, so I don't see why some would behave differently than others.
If I increase the periods of the fast functions to 100ms and 400ms, the problem disappears. But this is not an acceptable workaround.
Code
I can't upload the whole project, and it is time consuming to produce a minimal example of a bug for github. So I will do it as soon as I can. sdkconfig.txt