ESP32-C3-DevKitM-1 and SPI questions

marsal64
Posts: 2
Joined: Mon Jan 24, 2022 7:30 pm

ESP32-C3-DevKitM-1 and SPI questions

Postby marsal64 » Tue Jan 25, 2022 8:23 am

Hi, a beginner here… Could you kindly help me with some question marks related to ESP32-C3-DevKitM-1 and SPI?

Here is what I read at https://docs.espressif.com/projects/esp ... aster.html:
ESP32-C3 integrates 3 SPI peripherals.
• SPI0 and SPI1 are used internally to access the ESP32-C3’s attached flash memory. Both controllers share the same SPI bus signals, and there is an arbiter to determine which can access the bus.
Currently, SPI Master driver does not support SPI1 bus.
• SPI2 is a general purpose SPI controller. It has an independent signal bus with the same name. The bus has 6 CS lines to drive up to 6 SPI slaves.

I have tested SPI write only for now (ESP-IDF, several tasks using xTaskCreate) and I was not able to make running SPI using any other SPI channel but 1. Only this seems to work for me:

Code: Select all

#define SPI_MOSI 6
#define SPI_MISO 5 
#define SPI_SCLK 4 
#define SPI_CS 7
#define SPI_N 1
…
ret = spi_bus_initialize(SPI_N, &buscfg, SPI_DMA_CH_AUTO);
My questions are:
• Are there some limitations for ESP32-C3-DevKitM-1 regarding the number of SPI channels?
• I am considering for SPI other pins than defined above, like GPIO2, 3, 9, 10. Are there any limitations for these pins to be used for SPI?
• As I had tested "write only" SPI up to now, I'd like to ask whether there are any limitations/recommendations in SPI "receive" for ESP32-C3-DevKitM-1, e.g. half-duplex only, polling only etc.? I plan to connect INA229 to this devkit.

Thank you very much.

marsal64
Posts: 2
Joined: Mon Jan 24, 2022 7:30 pm

Re: ESP32-C3-DevKitM-1 and SPI questions

Postby marsal64 » Fri Feb 04, 2022 5:48 pm

OK, just a note:
I am currently using SPI_N=1, polling SPI way and half-duplex and everything seems to work smoothly for INA229.
Still a little curious, however, regarding the original questions ;-)

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

Re: ESP32-C3-DevKitM-1 and SPI questions

Postby ESP_Sprite » Sat Feb 05, 2022 2:05 am

marsal64 wrote:
Tue Jan 25, 2022 8:23 am
My questions are:
• Are there some limitations for ESP32-C3-DevKitM-1 regarding the number of SPI channels?
Yes, there is only one, as you found out.
• I am considering for SPI other pins than defined above, like GPIO2, 3, 9, 10. Are there any limitations for these pins to be used for SPI?
I don't think so. On the ESP32, it used to be that if you wanted to have a fast SPI bus (>40MHz) you had to use the dedicated pins, but I think later chips did away with that requirement.
• As I had tested "write only" SPI up to now, I'd like to ask whether there are any limitations/recommendations in SPI "receive" for ESP32-C3-DevKitM-1, e.g. half-duplex only, polling only etc.? I plan to connect INA229 to this devkit.
Not that I'm aware of.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 32 guests