CR95HF SPI read value shifting
Hi,
I am working with the CR95HF on the xnucleo nfc03a1 and using a custom Atmega328 board.
I can communicate with the CR95HF but the read sequence is kind of like in a shift register. See attached figures.
Fig 1: I am only reading the device ID, notice how the bytes shift for some reason.
Fig 2: I also read echo and all the bytes are out of order.
The code I am using is as follows:
startCR95HF(); transmitSPI(0x00); transmitSPI(0x01); transmitSPI(0x00); stopCR95HF(); // send ID command
pollCR95HF();
startCR95HF(); transmitSPI(0x02); // read ID
transmitUart0('ID ');
for (int i = 0; i<17; i++){
transmitUart0(receiveSPI());
}
stopCR95HF();
startCR95HF(); transmitSPI(0x00); transmitSPI(0x55); transmitSPI(0x00); stopCR95HF();
pollCR95HF(); // send command for echo
startCR95HF(); transmitSPI(0x02); transmitUart0(receiveSPI()); stopCR95HF(); // read echo
Any idea what might be causing this?
Thanks in advance
Regards,
Salman
