Page 1 of 1

using the SPI flash pins for other things

Posted: Tue Mar 06, 2018 5:57 pm
by kbaud1
I understand the SPI flash pins can be used as general GPIO. But if there is no flash chip connected, the part will not run an application or even possibly boot. So the flash has to be connected. I assume this means that after the part boots and the program is loaded, then the flash pins can be re purposed. How would I prevent the part from trying to access the flash while I am using the pins for something else?

Re: using the SPI flash pins for other things

Posted: Tue Mar 06, 2018 8:55 pm
by WiFive
No, the entire program is not copied to ram and executed. Instead there is a small cache where code from flash gets loaded and executed and this is continually being refreshed.

Re: using the SPI flash pins for other things

Posted: Wed Mar 07, 2018 12:25 pm
by Vader_Mester
kbaud: Can you explain why you would need those extra pins? Maybe we could provide an alternative solution.

Vader[BEN]

Re: using the SPI flash pins for other things

Posted: Wed Mar 07, 2018 11:54 pm
by kbaud1
Sure, we have used up all the GPIO and we need these pins for PWM output for motor control.

Re: using the SPI flash pins for other things

Posted: Wed Mar 07, 2018 11:55 pm
by kbaud1
How do can I configure ESP32 to only use SPI dual (not quad) mode for all flash interface during normal program operation and also configure GPIO 9 & 10 for other use? Is this possible to do on ESP-VROOM-32?

Re: using the SPI flash pins for other things

Posted: Thu Mar 08, 2018 4:55 am
by ESP_Sprite
You can set that in make menuconfig, 'serial flasher config' -> 'flash SPI mode'; that also configures the runtime configuration. Note that on the ESP-Wrover modules, the GPIOs still are physically connected to the HOLD and WP of the internal flash chip; pulling these flash pins high or low may lead to unexpected results.

Re: using the SPI flash pins for other things

Posted: Thu Mar 08, 2018 10:41 am
by Vader_Mester
kbaud1 wrote:Sure, we have used up all the GPIO and we need these pins for PWM output for motor control.
You should use a GPIO extender with SPI (or I2C) to use the generaly used GPIO pins, and for PWM and other things use the ESP32.
Additionally, you can use a cheap 8bit microcontroller for GPIO handling.

I suggest this microcontroller (this family). It is an 8bit micro, with 72MHZ clock, SPI master-slave, 14bit ADC, DAC, PWM, etc.
Should be used with the ESP32 as SPI slave.
It also comes with an embeded bootloader, which doesn't require programming equipment just a UART-USB interface.
Price is around $1, so costs nearly nothing.
(Actually this is what I'm planning to use in my project).

Re: using the SPI flash pins for other things

Posted: Fri Mar 09, 2018 2:31 am
by kbaud1
thank you, I have been looking at the EFM8 actually. already have a dev kit.