Open craiglink opened 5 months ago
cross-posting details provided elsewhere
ESP.getFlashChipMode(); // Would crash in the new version at execution. For esp32s3 this would contain: uint32_t spi_ctrl = REG_READ(SPI_CTRL_REG(0)); To see, what SPI_CTRL_REG(0) returns in the new version:
Serial.printf("Incorrect return value = 0x%X\n", SPI_CTRL_REG(0)); This prints: "Incorrect return value = 0x8". esp32s3 cannot read from address 0x8.
SPI_CTRL_REG is defined as:
#define SPI_CTRL_REG(i) (REG_SPI_BASE(i) + 0x8)
In the new version we have:
#define REG_SPI_BASE(i) (((i)>=2) ? (DR_REG_SPI2_BASE + (i-2) * 0x1000) : (0))
(at .....sdk/esp32s3/include/soc/esp32s3/include/soc/spi_reg.h: line 122)
before it was:
#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
(at ...../sdk/esp32/include/soc/esp32/include/soc/spi_reg.h: line 19)
So, go back to the old version:
Serial.printf("Correct return value = 0x%X", SPI_CTRL_REG(0));
The NEWLY INTRODUCED FILE .....sdk/esp32s3/include/soc/esp32s3/include/soc/spi_reg.h contains at line 122:
#define REG_SPI_BASE(i) (((i)>=2) ? (DR_REG_SPI2_BASE + (i-2) * 0x1000) : (0))
For i == 0 result is 0!
which delivers the wrong address in this case.
Same issue in master is fixed with https://github.com/espressif/arduino-esp32/pull/9758 BUT the real issue is still there in IDF in ALL versions.
Hello, this have been fixed and is already released in version 3.0.1.
Link for the release: https://github.com/espressif/arduino-esp32/releases/tag/3.0.1
For migration from v2.x to v3.x, you can refer to migration guide: https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html
I am closing this issue, if you have any problems we can reopen it.
@igrr Can you help here? The issue is in IDF. The definitions for REG_SPI_BASE(i)
are wrong. In earlier version of IDF 4.4 it was not defined at all for the S3.
There where PRs from @TD-er and me to correct this (https://github.com/espressif/esp-idf/pull/12559 and https://github.com/espressif/esp-idf/pull/12562)
The suggested changes from the PRs are not committed. The where replaced by a different approach. At least for the S3 the are wrong and are applied in branch release/v4.4
and release/v5.1
(maybe in the other branches too, not checked)
@VojtechBartoska The issue is in branch release/v2.x and it is not solved there.
Please reopen.
In branch master it is not fixed at all. There is only a workaround for the function esp::getFlashChipMode
All Arduino librarys which do need a correct set REG_SPI_BASE(i)
are broken. Many Arduino graphic librarys do need this!
@Jason2866 feel free to open a backport :) We do not guarantee that another 2.0.x will be released though. As you know, best case would be to be fixed in IDF. I have asked about it and I'm waiting a response.
@me-no-dev Lets hope the issue will be fixed in IDF!
Board
ESP32-S3-Matrix X1
Device Description
Waveshared ESP32-S3-Matrix X1
Hardware Configuration
no other devices
Version
v2.0.16
IDE Name
PlatformIO
Operating System
Windows 11
Flash frequency
80
PSRAM enabled
yes
Upload speed
115200
Description
Function crashes. Perhaps needs special handling like the H2 and C chips do in the main branch?
platform.ini extends = env:esp32-s3-devkitc-1 platform = espressif32@6.7.0 framework = arduino board_upload.flash_size = 4MB board_build.flash_mode = qio monitor_filters = esp32_exception_decoder board_build.partitions = tools/4MB.csv
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide