-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ArduinoESP32 v2.0.4 conflicts with SPI class because PSRAM uses VSPI(SPI3) #7192
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
Comments
@me-no-dev Can you take a look? Seems reasonable to fix this for 2.0.5 release. |
Fixed in lib-builder. Will be part of 2.0.5 :) |
@me-no-dev I have an idea. If necessary I will make a proposal to the ESP-IDF repository. |
please reopen, this is not a real fix, actually more devices are affected after applying this (e.g. LoLin D32-Pro, TTGO-TWatch) the issue is with forcing 80MHz on psram, ideally the correct sequence should test "if 80MHz fails then try 40MHz" |
Oops, sorry... I made a mistake in my first post. The correct title is as follows 1st log : 2nd log : Look at the In the log of v2.0.4, the output of the conditional branch shows I am not sure why this difference has occurred, is there some other problem that is occurring? |
|
And what about when no PSRAM support is enabled in a build? |
@me-no-dev something broken in platform.txt maybe? |
@tobozo @me-no-dev
I tested with both ArduinoIDE and PlatformIO and the results were the same for both. I have my doubts that the description in For example... Lines 651 to 662 in c93bf11
I changed this description to Test code:
But the result I get with the
I found a new problem with the QIO settings not working correctly, but at least the logs show |
Should I create a new Issue if necessary, since the original topic and content have gone off-topic? |
About the actual used flash mode... This is probably changed by the flashing tool. |
@me-no-dev I only want to manipulate the usual PSRAM "Enabled/Disabled" Arduino menu option without getting a crash loop or a SPI conflict. e.g. setting PSRAM to "Disabled" in the Arduino IDE tools menu should not end up in HSPI or VSPI being occupied by SPIRAM, just as it does with default ESP32-WROOM (none of Doing so from 2.0.3 or even an esp-idf project does not produce such issue, should this thread be moved to arduino-lib-builder instead or is it the right place to discuss it? |
@TD-er
The above results confirm that the mode is reflected correctly.
@tobozo |
The docs for ESP32-S3 do mention similar compatibility issues: SPI Flash and External SPI RAM Configuration |
Board
M5Stack Fire ( ESP32 with PSRAM 4MByte(32Mbit) )
Device Description
No special hardware is required.
Hardware Configuration
I believe that an ESP32 with 4MByte PSRAM can probably reproduce the problem.
Version
v2.0.4
IDE Name
ArduinoIDE or Platform IO
Operating System
Windows 10
Flash frequency
40MHz or 80MHz
PSRAM enabled
yes
Upload speed
1.5Mbps
Description
I would like to thank all of you for the great job you are doing maintaining this project.
I am unable to decide whether I should submit this Issue to ESP-IDF or ArduinoESP32 and would like to discuss it.
Starting with ESP-IDF ver4.4, HSPI or VSPI is required for PSRAM operation when the following conditions are met.
information is here.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/external-ram.html?highlight=occupy_#failure-to-initialize
Looking at the SDK CONFIG for ArduinoESP32 v2.0.4, the flag
CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y
is set.https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/esp32/sdkconfig#L687
In other words, VSPI is used by PSRAM when the above conditions are met.
On the other hand, the ArduinoESP32 SPI instance uses VSPI by default.
This causes the program to crash if all of the following conditions are met.
SPI
instance, for example, with SD cards, etc.I confirmed that the Issue occur with M5Stack Fire (4MB PSRAM).
I confirmed that the Issue does not occur with M5Stack Core2 (8MB PSRAM).
Presumably, with 4MB PSRAM, the following conditional branch is executed and VSPI is used.
https://github.com/espressif/esp-idf/blob/release/v4.4/components/esp_hw_support/port/esp32/spiram_psram.c#L954-L966
Referring to the log below, it seems that up to Arduino ESP32 v2.0.3, both Flash and PSRAM are set at 40MHz, but in Arduino ESP32 v2.0.4, both Flash and PSRAM are set at 80MHz.
I do not know what measures are desirable, but I wonder if it might be a good idea to set the PSRAM speed to 40MHz through the CONFIG setting?
Sketch
Debug Message (Arduino ESP32 v2.0.4 with flash 40MHz setting)
Debug Message (Arduino ESP32 v2.0.3 with flash 80MHz setting)
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: