Page 1 of 1

[help]spi pin number

Posted: Wed Mar 22, 2017 7:46 am
by JonathanChenNew
Hi
i am trying to use spi.
the pins:

Code: Select all

#define PIN_NUM_MISO  7
#define PIN_NUM_MOSI  8
#define PIN_NUM_CLK    6
#define PIN_NUM_CS      11
But the function "spi_bus_initialize()" reports "Guru Meditation Error".
it stopped at "gpio_set_direction()" in spi_master.c.

i found esp32 stopped when i use "gpio_set_direction(8,GPIO_MODE_OUTPUT)".
whether i have to change pins or not?

Re: [help]spi pin number

Posted: Wed Mar 22, 2017 10:05 am
by ESP_Sprite
GPIO 8 is reserved for the SPI flash. If you re-define this GPIO as a general-purpose SPI pin, running code from flash will break. Use a different GPIO.

Re: [help]spi pin number

Posted: Wed Mar 22, 2017 2:18 pm
by kolban
This is likely to be a dopey question on my part ... if GPIO 8 is used exclusively for the SPI flash chip access and modules like the Espressif DevKitC have on-board flash chips on the module ... what is the thinking behind exposing GPIO 8 as a pin-out on the module itself?

Re: [help]spi pin number

Posted: Wed Mar 22, 2017 7:31 pm
by WiFive
They (gpio 6-11) can be used for parallel spi operations in limited cases, hardware debugging, direct programming of the flash chip, possibly slave mode. We complained about the esp8266 modules that didn't break out these pins and eventually got esp-12e/f/d/q. To assume that a gpio is free and clear to use just because it has a pad is not a good line of thinking.