[ESP32-H2] Can't use SPI with zigbee
Posted: Thu Feb 22, 2024 7:09 pm
Hi, I have a ESP-Thread BR & Zigbee GW development board that I'm using for a Zigbee project (it has a ESP32-H2 and a ESP32-S3).
I'm using the SPI connections already on the board to make the two SoCs communicate. The communication works fine, until I hit the part of the code where I start Zigbee. After that I get the following SPI-related error and the H2 resets:
I'm using this piece of code from ESP-IDF examples to initialize the SPI as slave on H2:
And later:
What am I missing here?
I'm using the SPI connections already on the board to make the two SoCs communicate. The communication works fine, until I hit the part of the code where I start Zigbee. After that I get the following SPI-related error and the H2 resets:
AFAIK this is related to conflicts in the SPI queue and I know that Zigbee uses the flash, but shouldn't SPI0, SPI1 and SPI2 run independently?assert failed: spi_slave_transmit spi_slave.c:432 (ret_trans == trans_desc)
I'm using this piece of code from ESP-IDF examples to initialize the SPI as slave on H2:
Code: Select all
//Configuration for the SPI bus
spi_bus_config_t buscfg;
memset(&buscfg, 0, sizeof(buscfg));
buscfg.mosi_io_num = GPIO_MOSI;
buscfg.miso_io_num = GPIO_MISO;
buscfg.sclk_io_num = GPIO_SCLK;
buscfg.quadwp_io_num = -1;
buscfg.quadhd_io_num = -1;
buscfg.max_transfer_sz = 50000;
//Configuration for the SPI slave interface
spi_slave_interface_config_t slvcfg;
memset(&slvcfg, 0, sizeof(slvcfg));
slvcfg.spics_io_num = GPIO_CS;
slvcfg.flags = 0;
slvcfg.queue_size = 3;
slvcfg.mode = 0;
slvcfg.post_setup_cb = nullptr;
slvcfg.post_trans_cb = nullptr;
//Initialize SPI slave interface
auto ret = spi_slave_initialize(SPI2_HOST, &buscfg, &slvcfg, SPI_DMA_CH_AUTO);
Code: Select all
WORD_ALIGNED_ATTR uint8_t recvbuf[size];
memset(recvbuf, 0, size);
spi_slave_transaction_t t;
memset(&t, 0, sizeof(t));
t.length = sizeof(recvbuf) * 8;
t.tx_buffer = nullptr;
t.rx_buffer = recvbuf;
auto timeout_ticks = timeout_ms / portTICK_PERIOD_MS;
auto ret = spi_slave_transmit(SPI2_HOST, &t, timeout_ticks);