PN512 selftest

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PN512 selftest

Jump to solution
1,055 Views
slavko_kocjanci
Contributor II

Hello...
I try to make own reader with PN512 and AtXmega. I assume that board is working, and SPI communication is ok.
At least if I read some registers from PN512 (CommandReg, CommIRqReg, WaterLevelReg, ModeReg) I got correct values as should be at poweron. Also if I write WaterLevelReg for example and read back I got correct value.

But if I try to perform selftest I got totally unexpected result.
Here is 'pseudocode' I execute. What are wrong.

//1. Perform a soft reset.
SpiWrite(CommandReg,SoftReset);

//2. Clear the internal buffer by writing 25 bytes of 00h and perform the Config Command.
SpiWrite(FIFODataReg,00*25);
SpiWrite(CommandReg,Configure);

//3. Enable the Selftest by writing the value 09h to the register AutoTestReg.
SpiWrite(AutoTestReg,0x09);

//4. Write 00h to the FIFO.
SpiWrite(FIFODataReg,0x00);

//5. Start the Selftest with the CalcCRC Command.
SpiWrite(CommandReg,CalcCRC);

//6. The Selftest will be performed.
_delay_ms(1000); //do I need to check bussy? for now just wait

//7. When the Selftest is finished, the FIFO contains the following bytes:
SpiRead(FIFODataReg,64 bytes);

And result is:
0x00 0x05 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09
0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09

0 Kudos
1 Solution
911 Views
slavko_kocjanci
Contributor II

Indeed was my software bug. Read FIFO routine was faulty as didn't correctly set address for next read.

View solution in original post

0 Kudos
1 Reply
912 Views
slavko_kocjanci
Contributor II

Indeed was my software bug. Read FIFO routine was faulty as didn't correctly set address for next read.

0 Kudos