PN532 - arduino fio

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
pawqar
 
Posts: 3
Joined: Fri Mar 30, 2012 3:42 am

PN532 - arduino fio

Post by pawqar »

Hi everyone,

I hope I am not duplicanting the same question. Well, I read a tutorial to connect the PN532 Board to an Arduino UNO Board, http://www.ladyada.net/products/rfidnfc/ as yours http://www.adafruit.com/products/364A it seems necessary an NPX chip to communicate the arduino board to the PN532. But my question is, can you connect the PN532 to an arduino board directly? I tried the next:

Code: Select all

#include "NewSoftSerial.h"
#define SS   5
#define MOSI 4
#define VCC  2
#define GND  3
NewSoftSerial cardSerial(5,4);

void setup() {
  cardSerial.begin(115200);
  Serial.begin(115200);
  Serial.print("probando lector de tarjeta\n");
  digitalWrite(VCC, HIGH);
  digitalWrite(GND, LOW);
}
void loop() {
  cardSerial.print(0x55, BYTE);
  cardSerial.print(0x55, BYTE);
  cardSerial.print(0x00, BYTE);
  cardSerial.print(0xFF, BYTE);
  cardSerial.print(0x03, BYTE);
  cardSerial.print(0xFD, BYTE);
  cardSerial.print(0xD4, BYTE);
  cardSerial.print(0x14, BYTE); 
  cardSerial.print(0x01, BYTE);
  cardSerial.print(0x17, BYTE);
  cardSerial.print(0x55, BYTE);

  if (cardSerial.available()>0){
    Serial.print(cardSerial.read(), HEX);
    Serial.print("\nleo\n");
  }
  delay(1000);
 
}
I paste this because I want to explain the baudrate, but I do not know how choose the parity and the bit error (115200 8N1) ... I thought that the NewSoftSerial was enough. But watching the library It´s like a sensor you must send bytes before sending a command ...

Sorry for my english...

and thank you for your time.

greetings

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: PN532 - arduino fio

Post by adafruit »

your post is a little confusing, did you purchase the PN532 breakout board from adafruit?

pawqar
 
Posts: 3
Joined: Fri Mar 30, 2012 3:42 am

Re: PN532 - arduino fio

Post by pawqar »

Hi,

I have an PN532 BREAKOUT BOARD, www.microBuilder.eu... this is what is written on the board.

Well, I've read the datasheet. As I understand there is 3 ways to send information from the host (in my case an arduino fio board) to the PN532. HSM or UART, I2C and SPI.

My question was if It's possible to use the 3,3v, gnd, tx and rx ports, just these four... to connect to my arduino board. And communicate with it. I was asked to sent the next bytes:

55 55 00 FF 03 FD D4 14 01 17 55
as I understand, 00 FF is the start of packet code, 03 the length, FD ?( I do not know), D4 means that the frame is from the host to de PN532 and the next 3 bytes could be the data or the command.... and finally the 55 I thought it should be "00".
The answer is an ack, 00 00 ff 00 ff 00 and 00 00 ff 02 fe d5 15 16 00
again the preamble, start of packet code 00 ff, 02 could be the length of the data, fe ????, d5 indicates the frame was sent from de pn532 to the host, 15 the data. 16 the checksum and the 00 the postamble

the other ones are:


HOST TO PN532 --> 55 55 00 FF 06 FA D4 32 05 00 01 00 f4 55
PN532 TO HOST --> 00 00 ff 00 ff 00
00 00 FF 02 FE D5 33 F8 00


HOST TO PN532 --> 55 55 00 FF 04 FC D4 4A 02 00 E0 55
PN532 TO HOST --> 00 00 ff 00 ff 00
00 00 FF 0C F4 D5 4B 01 01 00 04 08 04 52 D5 90 28 EF 00

the coloured one is the UID of the card.

Well, I want to nkow if is there a easiest way to send the command and read the answer, maybe using just the UART mode... instead of the SPI.

By now, I am using the library from adafruit and trying to understand how to send a command and print out the answer ....

anyway thank you for your time

greetings and sorry for my english

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: PN532 - arduino fio

Post by adafruit »

the library does not support UART - use SPI instead

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”