Hi, I am trying to do the SPI communication between a SPI master and two SPI slaves. I am using NRF52840 Dev Kit as SPI master and 2 ESP32-S3 as SPI slaves. I am using SDK version 17.1 for NRF. I am sending and receiving a 32 bytes of data. My work flow is to send a 32 Bytes of data from Master to Slave then Slave will respond on that . So as per the SPI I need to send two commands from Master to read the data from Slave. In first command '0x11', Slave will prepare the data on its side, then Master will send a dummy command '0x13' to read that data. Currently for debugging I have added a dummy data to transmit and receive. Total data which I may need to transmit or receive could be 2 Kbytes.
For template I have used the SPI example from the SDK peripheral example
I have used the following pins for SPI master on NRF side
#define ESP1_IO_PIN 36
#define ESP_32_S3_1_PWR 6 // MUX Select PIN
#define ESP_ESP_32_S3_1_TRIG 15
#define ESP_32_S3_1_SS 12 // P0.12
#define ESP1_SPI_MISO_PIN 11 // P0.11
#define ESP1_SPI_MOSI_PIN 41 // P1.09
#define ESP1_SPI_SCK_PIN 40 // P1.08
#define ESP1_EN_PIN 33 // P1.08
#define ESP2_IO_PIN 43
#define ESP_32_S3_2_PWR 46
#define ESP_32_S3_2_SS 45
#define ESP2_SPI_MISO_PIN 13
#define ESP2_SPI_MOSI_PIN 17
#define ESP2_SPI_SCK_PIN 16
#define ESP2_EN_PIN 44 // P1.08
#define ESP_32_S3_1_SPI_INSTANCE 1
#define ESP_32_S3_2_SPI_INSTANCE 2
I have added the main.c code here
I have uploaded the SPI master code for NRF
spi_master_code_nrf_side_tested221222.zip
Here, I have uploaded the code for ESP32-S3
Issues
- While communicating with NRF with ESP32-S3 I have to put delay in NRF side code.
- Otherwise it will receive some garbage for some bytes or zero
- I have tested with providing different delays like 30 ms, 40 ms , 50 ms, but I am able to get exact data without any loss or garbage on 50 ms delay or more than any value of 50 ms only.
- I have calculated the checksum for whole 32 Bytes of data to check if data get corrupted
- I want to remove that delay to get max speed for transmission.
In case of setting the delay to 10 ms
In case of setting delay to 30 ms
In case of setting the delay to 50 ms
Please give me suggestion for how to resolve this issue for removing the delay from the code.