Reputation: 13
I am trying to use a PN532(NFC controller). Lately something in my SPI-communication is off. I start comunication by asking for the firmewareversion (D4 02). Next I try to set the SAM-Config. But the PN532 wont give an ACK nor an response.
What I observed is this. (all in hex)
GetFirmewareversion --- ACK<br>
MOSI: 01 00 00 FF 02 FE D4 02 2A 00 --- 02 00 03 00 00 00 00 00 00<br>
MISO: 00 FF FF FF FF FF FF FF FF FF --- FF 01 01 00 00 FF 00 FF 00
Receive Firmewareversion after ACK<br>
MOSI: 02 00 03 00 00 00 00 00 00 00 00 00 00 00 00<br>
MISO: 00 01 01 00 FF 06 FA D5 03 32 01 06 07 E8 00
Set SAMConfig --- see if ready(endless)<br>
MOSI: 01 00 00 FF 05 FB D4 14 01 14 01 02 00 --- 02 00 --- 02 00 --- 02 00<br>
MISO: AA AA AA AA AA AA AA AA AA FF FF FF FF --- FF 00 --- 00 00 --- 00 00
When I write my getFiremware he responds 0xFF, but when i try to set SAM he always responds with 0xAA. He also never replies an ACK or response to setSAMConfig.
Where is my Mistake? where is this Coming from? How to fix it? THX in advance.
Upvotes: 0
Views: 917
Reputation: 11
Insert some delay after asserting the PN532 chip select.
Had the same problem, this works for me:
void pn532_select (void)
{
FIO2CLR = PN532_CS; // assert CS
msleep (1); // relax a bit
}
Upvotes: 1