SPI not functioning: LoPy NFC reader PN5XX case
I'm trying this for days now and I'm desperate. Can you help me ? Here is the problem. I'm trying to communicate with a PN532 board (http://puu.sh/wVkAH/f8804a6549.jpg) via a LoPy board with SPI.
3.3v, GND, SCK(P10), MISO (P12), MOSI (P11) and SS(P9) are well connected on the LoPy board.
I re-wrote some PN532 c/cpp/python libraries for micropython thanks to some pieces of code on forums (here is my code: https://pastebin.com/6h3fuWjF)
Basically I'm starting a SPI connection (SPI.MASTER, baudrate=1000000, polarity=0, phase=0, bits=8, firstbit=SPI.MSB)
First thing, in all libraries I found they all use SPI.LSB but in pycom lopy doc there is ONLY MSB (screenshot of the doc: http://puu.sh/wVkJY/9cf5c92e48.png)
Then to test the connection I'm checking the PN5xx firmware by sending a frame, I logged it:
Then the PN5xx updates its register, when data are ready I'm supposed to make a "Status read" call by sending 0x02 to the PN5xx here is the log:
And that's my problem whatever I send I always get 0x00 data. Sometimes magically I receive 0x10(16) whatever frame I send. I thought it was coming from the MSB/LSB problem (0x10 => 0x01) and 0x01 is what I'm expected to get, but when I try to read the register I'm still getting 0x00
I'm sure the PN5xx is working, I've tried to use an Arduino UNO + AdafruitPN532_SPI lib and it worked pretty well. I logged the frame, it's the same as mine with my python code but when it comes to Read status arduino uno gets a 0x01 response code. (And SPI.cpp lib is using firstbit=LSB)
So 1st, why I can't use LSB instead of MSB on my LoPy and 2nd, Why I'm always getting error response from the PN5xx
Thanks for help !
(Btw, I'm writing this in one block just after 3 days of this thing which is driving me crazy sorry for my english)
I know the topic is quite old, but has someone managed to make it work ?
I have tried with both i2c and HSU (high speed UART), and none is working.
With I2C, nothing with i2c.scan. I detect the pytrack accelerometer and gnss but not the PN532 board when connected to (P22, P21), and nothing when connected to (P9, P10)
I get no data with UART (nothing returned from uart.read) when connected to UART1, after sending the same frame as with the Arduino to get the firmware version.
The board works fine with an Arduino, in both 3.3 and 5V (with PN532 lib & with custom code to get the firmware version)
Thanks for any help !