CHERTS / esp8266-devkit

Unofficial Development Kit for Espressif ESP8266
http://www.programs74.ru
GNU General Public License v3.0
261 stars 102 forks source link

Missing interrupt flags in spi_test.c for SPI slave mode #40

Closed uchobby closed 7 years ago

uchobby commented 7 years ago

Tring the SPI test code with two ESP8266s connected, one as master and one as slave. Using the example code the specific interrupts like Master to Slave status is not occurring. A transfer interrupt is occurring on status transfers but none of the lower 4 bits of the status register are set.

For example, Master sends Status to Slave, Slave ISR is called with the transfer flag set but not the master sent status flag.

I assume some interrupt enables are missing as the test code ISR ends up only seeing the transfer flag.

I have verified that the Master is sending the SPI data in hardware using a logic analyzer, have even verified that the actual bytes are as expected. Just seems that the ESP is not setting the right bits.

uchobby commented 7 years ago

My mistake, had MOSI and MISO reversed. Sorry

The real problem is that it's not clear that the MISO and MOSI pins reverse when you put the port in Slave mode. In other words what is normally MOSI becomes MISO. You might naturally assume that the pin labels would stay the same, as I did.

Maybe this comment will help the next developer.