SPI Master-Slave errors sending/receiving 32 bytes between two ESP8266

Posts: 6
Joined: Thu Dec 14, 2017 10:53 am

SPI Master-Slave errors sending/receiving 32 bytes between two ESP8266

Postby Inquisitor » Tue Oct 29, 2019 1:18 am

I submitted issues on your GitHub repositories: https://github.com/espressif/ESP8266_NONOS_SDK/issues/269 and https://github.com/espressif/ESP8266_NONOS_SDK/issues/273 but wasn't sure where Espressif monitors for bugs... so adding this post.

I am only using your spi_test.c and the spi_interface files in the driver_lib sections. https://github.com/espressif/ESP8266_NONOS_SDK ESP8266_NONOS_SDK/examples/peripheral_test/user/spi_test.c

The first bug (first link above) I found concerning the slaves not properly receiving the 32bytes - I tracked down to the fact that your spi_test program was sending a 1 byte command, 4 byte address, and 32 bytes data. However, the slave instance, when it uses the SPIInit() in the spi_interface.c file (line 146) expects a 1 byte command, 1 byte address and 32 bytes of data. As soon as I changed the spi_test.c (line 150) to spiData.addrLen = 1; The Master => Slave direction is working correctly.

The second bug concerns when the Master pulls the data back from the Slave. Although a Logic Analyzer shows that Master is transferring the 32 bytes correctly, somewhere in the code that data is being misplaced into the SPI_W0... registers.

Screen dumps of the output from spi_test.c and an image of the logic analyzer retrieved data can be found in the second link above.

For this second bug, I cannot find any parameters that I can change having any affect on the data placement. However, because the Logic Analyzer is seeing the 32 bytes correctly transferred, I suspect the change is in the lower level code on the Master side.

Thank you for any help you can provide fixing this bug.

Who is online

Users browsing this forum: No registered users and 2 guests