[help]spi pin number

JonathanChenNew
Posts: 11
Joined: Thu Mar 09, 2017 2:52 am

[help]spi pin number

Postby JonathanChenNew » Wed Mar 22, 2017 7:46 am

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?

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

Re: [help]spi pin number

Postby ESP_Sprite » Wed Mar 22, 2017 10:05 am

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.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: [help]spi pin number

Postby kolban » Wed Mar 22, 2017 2:18 pm

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?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: [help]spi pin number

Postby WiFive » Wed Mar 22, 2017 7:31 pm

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.

Who is online

Users browsing this forum: Baidu [Spider] and 117 guests