Long SPI transfer with data from FLASH
Posted: Fri Jan 24, 2025 9:05 am
I'm trying to use Lattice FPGA (ICE40HX8K) as peripheral to ESP32-S3 in my project, and the FPGA needs to be programmed through SPI every time at boot.
The most convenient way to program the FPGA seems to be using SPI slave configuration, where ESP32 is connected to the FPGA through SPI and transmits the whole binary in a single transmission. Detailed protocol shown in the following image (pretty standard).
However, the binary file for the FPGA could potentially be large (MB in size), so it needs to be stored in flash instead of RAM, plus the requirement for this FPGA is that the whole binary needs to be transmitted in a single transmission without interruption. I am wondering if it is even possible, given I have to read from FLASH multiple times during transmission and seemingly SPI master peripheral on ESP32-S3 has a maximum byte length of 2048 bytes. @ESP-Sprite once mentioned that currently there is a way to do this, but I couldn't find any examples, and not sure if it can work with data in flash instead of RAM.
The most convenient way to program the FPGA seems to be using SPI slave configuration, where ESP32 is connected to the FPGA through SPI and transmits the whole binary in a single transmission. Detailed protocol shown in the following image (pretty standard).
However, the binary file for the FPGA could potentially be large (MB in size), so it needs to be stored in flash instead of RAM, plus the requirement for this FPGA is that the whole binary needs to be transmitted in a single transmission without interruption. I am wondering if it is even possible, given I have to read from FLASH multiple times during transmission and seemingly SPI master peripheral on ESP32-S3 has a maximum byte length of 2048 bytes. @ESP-Sprite once mentioned that currently there is a way to do this, but I couldn't find any examples, and not sure if it can work with data in flash instead of RAM.
Any help is much appreciated! Thanks!ESP_Sprite wrote: ↑Sat Mar 24, 2018 2:17 amYes, we at Espressif have. See the max_transfer_sz member of the spi_bus_config_t structure.