Reading SPI Flash memory

onehorse
Posts: 70
Joined: Mon Feb 15, 2016 1:35 am

Reading SPI Flash memory

Postby onehorse » Fri Dec 16, 2016 3:59 am

I verified that I could read a Spansion S25FL127 128 Mbit NOR flash using either SPI port, the VSPI port on pins 18, 19, 23 (ss = 5) and the HSPI port on pins 12, 13, 14 (ss = 15). I am pretty sure any GPIO can be the chip select but I didn't try any others. I didn't see any timing differences between the two ports and the times to read/write a page (~4500 us), erase the chip (~43 sec) were about the same between the two ports. The erase time is also about the same when erasing the same flash with an STM32L4 but the page read/write times are about ten times longer with the ESP32. Not sure why. I put the sketch to test SPI flash in my github repository (https://github.com/kriswiner/ESP32).

Are there more than two SPI ports on the ESP32? Can I use any pins for SPI or only the V and H SPI pins called out in the pinmap here (https://github.com/espressif/arduino-esp32)?

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Reading SPI Flash memory

Postby ESP_Angus » Mon Dec 19, 2016 11:13 pm

onehorse wrote:The erase time is also about the same when erasing the same flash with an STM32L4 but the page read/write times are about ten times longer with the ESP32. Not sure why. I put the sketch to test SPI flash in my github repository (https://github.com/kriswiner/ESP32).
That seems unusual. Same factor (x10) for both reads and writes?
onehorse wrote: Are there more than two SPI ports on the ESP32? Can I use any pins for SPI or only the V and H SPI pins called out in the pinmap here (https://github.com/espressif/arduino-esp32)?
If you use the GPIO Matrix then you can remap the VSPI & HSPI interfaces to any pins. This limits max clock rate to 40MHz.

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: Reading SPI Flash memory

Postby ESP_Sprite » Tue Dec 20, 2016 1:09 am

Just for completeness sake: You could also in theory connect the chip in parallel with the chip that contains the main program code, with only the /CS line connected to a different GPIO. Unfortunately, esp-idf does not support this yet.

onehorse
Posts: 70
Joined: Mon Feb 15, 2016 1:35 am

Re: Reading SPI Flash memory

Postby onehorse » Tue Dec 20, 2016 5:20 am

Yes. The 4 MBytes (~3 Mbytes of space available to the user) on the board I am using is likely enough for casual use. I wanted to be able to add more.

I have a couple of add-ons I designed for a Teensy with either 16 Mbyte or 128 Mbyte. There is even an SPI NOR Flash with 256 MByte available I have used but it is pretty expensive. The point is, I thought the internal flash was limited to 16 MByte because of the addressing inside the chip Maybe this only applies to the progran flash and doesn't apply to a flash treated as an external memory anyway.

In my dev board design I didn't expose the internal flash pins so connecting to one of the SPI ports is really the only option for me.

Who is online

Users browsing this forum: No registered users and 52 guests