-
On my blog, I wrote a post with sample code about the issue that I'm having with my code hanging when using FreeRTOS and Wi-Fi. The blog post is at https://teelsys.com/raspberry-pi-pico-w-rtos-and-wi-fi/. The code works fine until I include FreeRTOS.h. Once in a while, the code works fine and it connects to Wi-Fi and continues. In my latest attempt, it took 12 resets before it connected and kept working. Currently I have no tasks setup and am only running code in the loop to check the Wi-Fi connection. I saw the note in "arduino-readthedocs-io-en-latest.pdf, section '29.2 Important Information' that states the following: "Multicore is supported, but only core 0 may run WiFi related code. This is the reason that I'm running the code in loop rather than a task as it looks like tasks run in Core 1 rather than Core 0. If there is another way this should be done, let me know and I will give it a go to see if it resolves the issue. I have tried running the code in a task and it did not seem to work at all. I may not have hit reset enough times though. Any help would be appreciated. Thank You Sample Code: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
It appears that my intuition may have been correct and it is the statement delay(5) in WiFIMulti.cpp that is causing the issue. I replaced delay(5); with the following code and it works fine. @earlephilhower, I will be submitting a pull request shortly.
|
Beta Was this translation helpful? Give feedback.
-
Pull request created, however it fails the astyle check. Not certain what is happening there, but I assumed it was that I had tabs rather than spaces for indentation. I changed that, but it still failed. |
Beta Was this translation helpful? Give feedback.
-
BTW: The new output is the following
|
Beta Was this translation helpful? Give feedback.
-
Actually the root cause of the problem was within the FreeRTOS library, in the variantHooks.cpp file. There was a change submitted a few days ago with the fix and I had missed it. If you are running into a similar issue, it may be worth pulling the library from Earle's repository and replacing the code in your Arduino IDE library with the latest version from GitHub. Right now, the version in Arduino is 3.6.0. If your package is newer, then you should not be running into this issue. If you have board version 3.6.0, replace the code in the library with the code on GitHub. For more details, see: #1878 |
Beta Was this translation helpful? Give feedback.
Actually the root cause of the problem was within the FreeRTOS library, in the variantHooks.cpp file. There was a change submitted a few days ago with the fix and I had missed it. If you are running into a similar issue, it may be worth pulling the library from Earle's repository and replacing the code in your Arduino IDE library with the latest version from GitHub. Right now, the version in Arduino is 3.6.0. If your package is newer, then you should not be running into this issue. If you have board version 3.6.0, replace the code in the library with the code on GitHub.
For more details, see: #1878