I am using a ESP32 Wrover which has 4MB SPI flash and 8MB PSRAM, I am able to make PSRAM works by using the (uint16_t*)ps_malloc(153600) to acxcess the PSRAM . However, I had hard time to use the SPI flash.
I had include the https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/esp32/rom/spi_flash.h into my program and use the esp_rom_spiflash_write(uint32_t dest_addr, const uint32_t *src, int32_t len); and esp_rom_spiflash_read(uint32_t src_addr, uint32_t *dest, int32_t len); to do write an dread the SPI flash but it seems not working
Is there a SPI Flash test code that I can use for testing?
I think you should use these functions instead (line93 and 139): https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/spi_flash/esp_spi_flash.h
Can you try them and see if they work?
I hope this helps.
Thanks for your help. I tried line93 and 139. unfortunately, it was not working and the symptom is different. it will cause the system reset no matter is line 93 or line 139.
dose it need any other setup before running line 93 and line 139?
Honestly, I don’t know. I’m not familiar with those functions and all the documentation I’ve found about that was for ESP-IDF.
Have you taken a look at the following Units of the ESP32 course? Maybe these might help.