Can set SPI speed, but does not take effect on code run interactively, but does on board reset? #18017
Replies: 2 comments 1 reply
-
One should always be able to change the SPI baudrate with P.S.: The Google AI answer is pure nonsense, but in a clean language. That seems to be the only thing AIs aka LLM can do well. |
Beta Was this translation helpful? Give feedback.
-
I should have added the word programmatically I guess... for the soft reset I am calling SPI.deinit() as my code ends but when I restart the code, and call SPI() again I get an 'OS error: SPI host already in use' response, which is odd. Start code...
Stop code...
The odd thing is... when I call theBus.deinit() explicitly I get back 'OSError: SPI bus already freed', but get the original error if restart the code without any (hard or soft) reset. So the SPI is never really freed? It is (still) in use? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Can set SPI speed, but does not take effect on code run interactively, but does on board reset? I happen to be using Thonny, and when I execute SPI bus initialization to say 40 MHz (since I have a W5500 integrated on a ESP32 board), no errors, no warnings, the code just fails to initialize the SPI bus to the correct speed. But if I reboot the board, the same code works as expected, and the SPI bus speed is running at 40 MHz. Is this an issue with the ESP32 its self? Seems so...
Google A.I. returned...
"When an ESP32's SPI speed is incorrect after a power-on reset but corrects itself after a soft reset, the root cause is often related to the order of hardware initialization and how the CPU's clock is configured. A soft reset performs a cleaner, more comprehensive re-initialization of peripheral drivers and clock settings, which a simple power-on reset may skip"
So the only solution is the soft reset, i.e. press the reset button?
Beta Was this translation helpful? Give feedback.
All reactions