You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ESP8266 is configured as an SPI-Master and transmits 2 messages to an SPI-Slave. After these two message are transmitted, one SPI-read of 8-bits is performed.
The first message, called writeMsg in code, consists of five individual bytes. The second message, called readMsg in code, consists of four individual bytes. writeMsg[1:3] and readMsg[1:3] are equal (as you can see in the example code) but for whatever reason, readMsg[1:3] show up as 0 on my LogicAnalyzer even though writeMsg is transmitted perfectly fine.
However, if I don't transmitwriteMsg, readMsg is sent correctly.
Expected Behavior
Bytes readMsg[1:3] should be equal to [0x00, 0x16, 0xC5].
Actual Behavior
Bytes readMsg[1:3] are [0x00, 0x00, 0x00].
Steps to repropduce
Copy linked code
Compile and flash
Watch SPI-Pins of HSPI_HOST via LogicAnalyzer / digital oscilloscope
Hi, this problem is related with a small error in the spi driver. When the data is unaligned, only the first byte is sent (or read), all the other bytes will be zero. Since your first byte is already zero, you will end up with 3 zeros. Check out #723.
Environment
Problem Description
The ESP8266 is configured as an SPI-Master and transmits 2 messages to an SPI-Slave. After these two message are transmitted, one SPI-read of 8-bits is performed.
The first message, called
writeMsg
in code, consists of five individual bytes. The second message, calledreadMsg
in code, consists of four individual bytes. writeMsg[1:3] and readMsg[1:3] are equal (as you can see in the example code) but for whatever reason, readMsg[1:3] show up as0
on my LogicAnalyzer even thoughwriteMsg
is transmitted perfectly fine.However, if I don't transmit
writeMsg
,readMsg
is sent correctly.Expected Behavior
Bytes readMsg[1:3] should be equal to [0x00, 0x16, 0xC5].
Actual Behavior
Bytes readMsg[1:3] are [0x00, 0x00, 0x00].
Steps to repropduce
Code to reproduce this issue
https://gist.github.com/Bresenham/f5c016361e21b9a3711ef5e7565f7874
Another version of the code which behaves the same but is more refined:
https://gist.github.com/Bresenham/fdda4ff163c68188a6f150df19bc4727
LogicAnalyzer of
writeMsg
: https://pasteboard.co/IMVfzCV.pngLogicAnalyzer of
readMsg
: https://pasteboard.co/IMVfHs1.pngDebug Logs
Other items if possible
The text was updated successfully, but these errors were encountered: