Using SPI Master in ESP32-C3
Posted: Wed Apr 14, 2021 8:19 am
Hey there, hope everyone is doing well. I started trying the C3 after upgrading ESP-IDF to the latest master state.
And could not refresh one of my epapers using C3 as SPI Master. Maybe someone can give me a hint? Or just show me some sample code?
About DMA channel, I tried to use 1, but the Serial output says:
E (368) spi: spi_bus_initialize(633): invalid dma channel, chip only support spi dma channel auto-alloc
I don't know what value is auto-alloc, but in:
spi_bus_initialize(EPD_HOST, &buscfg, DMA_CHAN);
dma_chan – Either channel 1 or 2, or 0 in the case when no DMA is required. Selecting a DMA channel for a SPI bus allows transfers on the bus to have sizes only limited by the amount of internal memory. Selecting no DMA channel (by passing the value 0) limits the amount of bytes transfered to a maximum of 64
Using 0 I don't get that message and transmits something but I still cannot make it refresh (Same code in ESP32 works ok) and also 0 limits the TX data to 64 bytes.
The class I'm using for SPI is mine: https://github.com/martinberlin/cale-id ... epdspi.cpp
The GPIOs I've used (tried many different combinations so far without luck)
CONFIG_EINK_SPI_MOSI=7
CONFIG_EINK_SPI_CLK=6
CONFIG_EINK_SPI_CS=9
CONFIG_EINK_DC=4
CONFIG_EINK_RST=19
CONFIG_EINK_BUSY=18
I will connect later the Logic analyzer to the PINs and see what is really coming out. But if any of you has an advice or sees something obviously wrong please send me a hint. Thanks in advance
And could not refresh one of my epapers using C3 as SPI Master. Maybe someone can give me a hint? Or just show me some sample code?
About DMA channel, I tried to use 1, but the Serial output says:
E (368) spi: spi_bus_initialize(633): invalid dma channel, chip only support spi dma channel auto-alloc
I don't know what value is auto-alloc, but in:
spi_bus_initialize(EPD_HOST, &buscfg, DMA_CHAN);
dma_chan – Either channel 1 or 2, or 0 in the case when no DMA is required. Selecting a DMA channel for a SPI bus allows transfers on the bus to have sizes only limited by the amount of internal memory. Selecting no DMA channel (by passing the value 0) limits the amount of bytes transfered to a maximum of 64
Using 0 I don't get that message and transmits something but I still cannot make it refresh (Same code in ESP32 works ok) and also 0 limits the TX data to 64 bytes.
The class I'm using for SPI is mine: https://github.com/martinberlin/cale-id ... epdspi.cpp
The GPIOs I've used (tried many different combinations so far without luck)
CONFIG_EINK_SPI_MOSI=7
CONFIG_EINK_SPI_CLK=6
CONFIG_EINK_SPI_CS=9
CONFIG_EINK_DC=4
CONFIG_EINK_RST=19
CONFIG_EINK_BUSY=18
I will connect later the Logic analyzer to the PINs and see what is really coming out. But if any of you has an advice or sees something obviously wrong please send me a hint. Thanks in advance