Skip to content
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

Fix Boot Loop on ESP32S3 Due to Mis-defined SPI Port #3488

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ofthedove
Copy link

People have been having trouble using SPI on ESP32 S3. Here are a couple of related discussions:
#3283
espressif/arduino-esp32#10254

The ESP IDF code indicates that only SPI 2 and 3 should be used. See: https://github.com/espressif/esp-idf/blob/9b3eda09741b5c7dae8f22fe60d193dcc3a7ec44/components/soc/esp32s3/include/soc/soc.h#L37

When SPI_PORT is defined to FSPI, the ESP Arduino framework defines it to 0. https://github.com/espressif/arduino-esp32/blob/7018cd114d00249674567846c9d67fbb3a1240a3/cores/esp32/esp32-hal-spi.h#L32

Using 0 with REG_SPI_BASE in ESP IDF soc.h returns NULL, which causes all subsequent SPI actions to hard-fault.

The simplest solution is to not define SPI_PORT to FSPI, but rather to GSPI2 or GPSI3 by default, as these are supported by the ESP IDF.

2 i s probably a better default,, but it doesn't really matter 2 vs 3
@bluecraank
Copy link

This seems not to work.

@ofthedove
Copy link
Author

@bluecraank Can you share more details? What version of the Arduino ESP32 framework are you on? What error are you getting? Are you confidant that the change is in effect in your application? Are the error messages different after applying the change?

@bluecraank
Copy link

I have esp32 espressif version 3.0.7.

The only working fix was in User_Setup.h
#define USE_HSPI_PORT // HSPI pins 10-13

Versions above 2.0.14 does not work with TFT_eSPI

See my issue espressif/arduino-esp32#10564

Here i found the only working solution right now
#3384 (comment)

@ofthedove
Copy link
Author

That's interesting, my original commit on this PR changed it to port 3, which looks to be the port you're using by setting USE_HSPI_PORT for S3.

When I tested it on my board, it didn't seem to matter whether 2 or 3 was used. My work-around was to set USE_FSPI_PORT, which sets it to 2, so that's why I used 2 in this PR. Once I'm back in front of my dev machine I'll check which version I'm on, but it should be the most recent as of Sep.

@ofthedove
Copy link
Author

Update: I've been running Espressif 32 platform v6.8.1 and framework 2.0.17 (framework-arduinoespressif32 @ 3.20017.0 (2.0.17))

On this version, USE_HSPI_PORT and USE_FSPI_PORT both work fine.

I just updated to Espressif 32 platform v6.9.0, but this did not change the framework version. I attempted to manually update the framework to version 3.0.7, but it appears this version is incompatible with the v6.9.0 framework. Here's the relevant portion of my platformio.ini:

platform = https://github.com/platformio/platform-espressif32.git#v6.9.0
platform_packages =
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#3.0.7

This post has some info on the sort of errors I received when attempting this combination of versions: https://community.platformio.org/t/pio-stopped-working-and-cannot-complie/36236/2

Unfortunately, without being able to use 3.0.7, there's not much more I can do. Perhaps if you could share more info about your platformio.ini config I can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants