Problem is always coming as “Error constructing PN532: Message transmission failed”.
Can someone help me with IRQ pin attaching with which hardware PIN?
For Eg:
spi <- hardware.spiBCAD;
ncs <- hardware.pinD;
rstpd_l <- hardware.pinM;
irq <- spi0.pinN; // The problem is coming here
There’s no diagram, no, this is just a SPI peripheral.
SCK goes to SCK/SCLK on a SPI port
MISO goes to MISO on a SPI port
MOSI goes to MOSI in a SPI port
SS goes to CS on a SPI port
IRQ goes to a GPIO
RSTO goes to a GPIO (and may need to be driven inactive for the target device to work)
// Label all pins
local spi = hardware.spi0;
local ncs = hardware.?;
local rstpd_l = hardware.?;
local irq = hardware.?;
// Pre-configure SPI bus
spi.configure(? , ?);
Please help what to write for MISO for SPI port? Should I write ncs = hardware.spi0.MISO or something else?
Read the docs. nCS is not a separate pin on imp005, you may need to modify the library to make it work with 005 because of this (or use a totally separate pin for nCS I guess).
@hugo Can you please help me find the exact pins usage for imp005:
local spi = hardware.spi257;
local ncs = hardware.pin1;
local rstpd_l = hardware.pin3;
local irq = hardware.pin4;
spi.configure(LSB_FIRST | CLOCK_IDLE_HIGH, 2000);
Note: This is for imp001, but I want pin configuration for imp005.
@hugo I am using the following configuration and I am getting this error: "ERROR: Error constructing PN532: Message transmission failed"
The following configuration I am using:
// Label all pins
local spi = hardware.spiBCAD;
// Pre-configure SPI bus
spi.configure(SIMPLEX_TX | MSB_FIRST | CLOCK_IDLE_LOW, 400);
local ncs = hardware.pinD;
local rstpd_l = hardware.pinXA;
local irq = hardware.pinXC;
You can’t do this with the 005; the hardware itself is only capable of LSB_FIRST mode and I believe the PN532 expects MSB_FIRST, so you will have to bitflip all bytes (both in and out) before you call the spi APIs. You’ll need to modify the library yourself to do this.
If you’re configuring SIMPLEX_TX then you’re telling the device not to receive, so it’s not surprising that it isn’t managing to work.