- Sat Jul 20, 2019 3:29 pm
#83174
Hi Me-no-dev, I've been having a hell of a time with the ESP8266 SPI as slave and an ATmega328pb.
The project involves using ESP8266 as wifi module controlled via SPI from a master ATMega328pb.
I have a simple 16 bit command protocol where the slave let's the ATMega know there is data via gpio and ATMega sends a read command, give some time for the ESP send the data and then reads it with 0X03 + 0X00
There is a lot more involved and I can sure send more details if you need.
This is the master transaction
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
Then I read slave with
SPI.transfer(0x03);
SPI.transfer(0x00);
for (uint8_t i = 0; i < 33; i++) {
message.dataBuffer[i] = SPI.transfer(0);
message.dataLen++;
}
First time I get some left shifting of bits on the data coming from slave, then this will happen on each third attempt. Two reads in the middle seem fine.
It seems you are very knowledgeable with this, would you be able to point me in a direction on where to look. I am reaching out because I am running out of ideas.
I'd be happy to send details via email or any other method, it's been beyond frustration at this point, any help would be greatly appreciated.
Thanks in advance.
Cheers.