ESP32-DEVKITM-1 examples SPI connections
ESP32-DEVKITM-1 examples SPI connections
Hello,
I have the ESP32-DEVKITM-1 v1.0
https://docs.espressif.com/projects/esp ... itm-1.html
has pin descriptions
Datasheet references GPIO17 for SCLK but also states that clock, chip-select, MOSI, and MISO can be configured to any GPIO
The example peripherial SPI master HD_eeprom, readme shows:
| ESP32 | ESP32 | ESP32S2 | ESP32C3 | ESP32S3 |
| Host | SPI1 | HSPI | FSPI | SPI2 | SPI2 |
| DO | 7 | 18 | 37 | 2 | 13 |
| DI | 8 | 23 | 35 | 7 | 11 |
| SK | 6 | 19 | 36 | 6 | 12 |
| CS | 13 | 13 | 34 | 10 | 10 |
I am not familiar with SPI1 vs HSPI, FSPI, SPI2
I believe I need the ESP32 and my guess is the SPI1. Then MOSI would be DO = pin 7, MISO would be DI = pin 8, SCLK would be SK = pin 6, and chip-select would be CS = pin 13. Is that correct?
If this is not the correct location for this request please let me know where to post it.
Thank you
Chris
I have the ESP32-DEVKITM-1 v1.0
https://docs.espressif.com/projects/esp ... itm-1.html
has pin descriptions
Datasheet references GPIO17 for SCLK but also states that clock, chip-select, MOSI, and MISO can be configured to any GPIO
The example peripherial SPI master HD_eeprom, readme shows:
| ESP32 | ESP32 | ESP32S2 | ESP32C3 | ESP32S3 |
| Host | SPI1 | HSPI | FSPI | SPI2 | SPI2 |
| DO | 7 | 18 | 37 | 2 | 13 |
| DI | 8 | 23 | 35 | 7 | 11 |
| SK | 6 | 19 | 36 | 6 | 12 |
| CS | 13 | 13 | 34 | 10 | 10 |
I am not familiar with SPI1 vs HSPI, FSPI, SPI2
I believe I need the ESP32 and my guess is the SPI1. Then MOSI would be DO = pin 7, MISO would be DI = pin 8, SCLK would be SK = pin 6, and chip-select would be CS = pin 13. Is that correct?
If this is not the correct location for this request please let me know where to post it.
Thank you
Chris
Re: ESP32-DEVKITM-1 examples SPI connections
Hello,
I wanted to follow up on this inquiry to see if anyone had any suggestions.
Thank you
Chris
I wanted to follow up on this inquiry to see if anyone had any suggestions.
Thank you
Chris
Re: ESP32-DEVKITM-1 examples SPI connections
I am confused, there are SPI example code projects but no one know what the electrical connections are? Communication will not be possible without the correct connections. I need clock, chip select, MISO and MOSI
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32-DEVKITM-1 examples SPI connections
SPI stuff is indeed configurable to use any GPIO. Feel free to modify the ones in the example if it doesn't fit your devboard.
Re: ESP32-DEVKITM-1 examples SPI connections
sounds good..... so in the example I specified, what pin is MOSI
what pin is MISO
what pin is chip select
what pin is clock
?
what pin is MISO
what pin is chip select
what pin is clock
?
Re: ESP32-DEVKITM-1 examples SPI connections
I think I have figured it out going through the code to see what was set. so by default:
# define PIN_NUM_MISO 18
# define PIN_NUM_MOSI 23
# define PIN_NUM_CLK 19
# define PIN_NUM_CS 13
is there a way to make the chip select be active low instead of active high?
# define PIN_NUM_MISO 18
# define PIN_NUM_MOSI 23
# define PIN_NUM_CLK 19
# define PIN_NUM_CS 13
is there a way to make the chip select be active low instead of active high?
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32-DEVKITM-1 examples SPI connections
Yes. Find the spi_device_interface_config_t struct that configures the device and add SPI_DEVICE_POSITIVE_CS to the flags.
Re: ESP32-DEVKITM-1 examples SPI connections
I found :
spi_device_interface_config_t devcfg={
.command_bits = 10,
.clock_speed_hz = EEPROM_CLK_FREQ,
.mode = 0, //SPI mode 0
/*
* The timing requirements to read the busy signal from the EEPROM cannot be easily emulated
* by SPI transactions. We need to control CS pin by SW to check the busy signal manually.
*/
.spics_io_num = -1,
.queue_size = 1,
.flags = SPI_DEVICE_HALFDUPLEX | SPI_DEVICE_POSITIVE_CS,
.pre_cb = cs_high,
.post_cb = cs_low,
.input_delay_ns = EEPROM_INPUT_DELAY_NS, //the EEPROM output the data half a SPI clock behind.
};
in spi_eeprom.c and
#define SPI_DEVICE_POSITIVE_CS (1<<3) ///< Make CS positive during a transaction instead of negative
in spi_master.h
I tried replacing SPI_DEVICE_POSITIVE_CS with zero
.flags = SPI_DEVICE_HALFDUPLEX | 0,
but that didnt work. I tried removing it completely
.flags = SPI_DEVICE_HALFDUPLEX,
that didnt work either
spi_device_interface_config_t devcfg={
.command_bits = 10,
.clock_speed_hz = EEPROM_CLK_FREQ,
.mode = 0, //SPI mode 0
/*
* The timing requirements to read the busy signal from the EEPROM cannot be easily emulated
* by SPI transactions. We need to control CS pin by SW to check the busy signal manually.
*/
.spics_io_num = -1,
.queue_size = 1,
.flags = SPI_DEVICE_HALFDUPLEX | SPI_DEVICE_POSITIVE_CS,
.pre_cb = cs_high,
.post_cb = cs_low,
.input_delay_ns = EEPROM_INPUT_DELAY_NS, //the EEPROM output the data half a SPI clock behind.
};
in spi_eeprom.c and
#define SPI_DEVICE_POSITIVE_CS (1<<3) ///< Make CS positive during a transaction instead of negative
in spi_master.h
I tried replacing SPI_DEVICE_POSITIVE_CS with zero
.flags = SPI_DEVICE_HALFDUPLEX | 0,
but that didnt work. I tried removing it completely
.flags = SPI_DEVICE_HALFDUPLEX,
that didnt work either
Re: ESP32-DEVKITM-1 examples SPI connections
also this example is sending 10 bytes instead of 8 with no delay between bytes. Is there a more practical example?
Re: ESP32-DEVKITM-1 examples SPI connections
Looking at the code I see polling, address references, etc.
I just need to send FF 00 00 00 and then see what the response it which will be in the form 00 XX XX XX with the Xs replaced with hex values that I need to know what their values are.
I just need to send FF 00 00 00 and then see what the response it which will be in the form 00 XX XX XX with the Xs replaced with hex values that I need to know what their values are.
Who is online
Users browsing this forum: Majestic-12 [Bot] and 120 guests