https://espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf
The technical document references a spi_test.c file that I found here:
https://github.com/CHERTS/esp8266-devkit/blob/master/Espressif/ESP8266_SDK/examples/peripheral_test/user/spi_test.c
The Master side is working fine and using a logic analyzer I can see that I am successfully sending...
* 2 byte command
* 4 byte address
* 13 byte data.
(see attached Capture.png)
Here is the output as expected on the Master side showing the register values that were sent to the slave.
Master Send
SpiNum_HSPI(1610613056)
SPI_CMD [0x00000002]
SPI_ADDR [0xd3d4d5d6]
SPI_CTRL [0x0028a737]
SPI_CTRL2 [0x00040011]
SPI_CLOCK [0x000e74e7]
SPI_RD_STATUS [0x00000000]
SPI_WR_STATUS [0x00000000]
SPI_USER [0xc8000070]
SPI_USER1 [0x7cce0000]
SPI_USER2 [0xf0000002]
SPI_PIN [0x0000001e]
SPI_SLAVE [0x00800200]
SPI_SLAVE1 [0x02000000]
SPI_SLAVE2 [0x00000000]
ADDR[0x60000140],Value[0x03020100]
ADDR[0x60000144],Value[0x07060504]
ADDR[0x60000148],Value[0x0b0a0908]
ADDR[0x6000014c],Value[0x0f0e0d0c]
ADDR[0x60000150],Value[0x00000000]
ADDR[0x60000154],Value[0x00000000]
ADDR[0x60000158],Value[0x00000000]
ADDR[0x6000015c],Value[0x00000000]
ADDR[0x60000160],Value[0x00000000]
ADDR[0x60000164],Value[0x00000000]
ADDR[0x60000168],Value[0x00000000]
ADDR[0x6000016c],Value[0x00000000]
ADDR[0x60000170],Value[0x00000000]
ADDR[0x60000174],Value[0x00000000]
ADDR[0x60000178],Value[0x00000000]
ADDR[0x6000017c],Value[0x00000000]
The problem is on the Slave side.
Although it is receiving and firing the interrupt based callback just fine, part of the incoming bytes are being misplaced. Here is the output for the same registers on the Slave device.
Slave Receiving
SpiNum_HSPI(1610613056)
SPI_CMD [0x00000002]
SPI_ADDR [0x00000000]
SPI_CTRL [0x0028a000]
SPI_CTRL2 [0x00800011]
SPI_CLOCK [0x00000000]
SPI_RD_STATUS [0x00000000]
SPI_WR_STATUS [0x00000000]
SPI_USER [0xc9000040]
SPI_USER1 [0x1dfeff00]
SPI_USER2 [0x70000002]
SPI_PIN [0x0008001e]
SPI_SLAVE [0x405403e0]
SPI_SLAVE1 [0x3aff1c70]
SPI_SLAVE2 [0x00000000]
ADDR[0x60000140],Value[0xd6d5d4d3]
ADDR[0x60000144],Value[0x03020100]
ADDR[0x60000148],Value[0x07060504]
ADDR[0x6000014c],Value[0x0b0a0908]
ADDR[0x60000150],Value[0x0000000c]
ADDR[0x60000154],Value[0x00000000]
ADDR[0x60000158],Value[0x00000000]
ADDR[0x6000015c],Value[0x00000000]
ADDR[0x60000160],Value[0x00000000]
ADDR[0x60000164],Value[0x00000000]
ADDR[0x60000168],Value[0x00000000]
ADDR[0x6000016c],Value[0x00000000]
ADDR[0x60000170],Value[0x00000000]
ADDR[0x60000174],Value[0x00000000]
ADDR[0x60000178],Value[0x00000000]
ADDR[0x6000017c],Value[0x00000000]
Slave Received
Note the Command is correct (SPI_CMD) but the address (SPI_ADDR) = 0 and the addresses value is being populated in the first Data field. All the data is offset by this four bytes. Looking at the code for the slave side - there is no parameter or register #define for telling the lower level code what the address length is. Thus, it apparently defaults to zero and thus assumes the address is part of the data coming from the Master and places it into the Data registers.
Anyone know if there is some way of telling the slave side how to properly place the incoming Master bytes?
Thanks.
w/ GUI Admin Client, Drag & Drop File Manager, OTA Built-In, Access Point Manager,
Performance Metrics, Web Socket Comms, App API, All running on ESP8266...
Even usable on ESP-01S --- Please check it out!
https://inqonthat.com/inqportal-the-three-line-promise/
https://InqOnThat.com/inqportal