Pages: [1]   Go Down
Author Topic: PN532 Breakout Board  (Read 964 times)
0 Members and 1 Guest are viewing this topic.
Santander
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

I hope you could help me. I have a PN532 and an Arduino FIO board. My question is How can I connect it? I saw in adafruit web page a tutorial, and a library. But I do not understand.  I saw this: http://www.adafruit.com/products/364A a few minutes ago. It seems   that there is an intermediaty between the fio and the PN532, and they develop a library to arduino. But it seems to complicated to me. What I mean is, if there is a easiest way to connect both of them. My PN532 has sel0 and sel1 off, the uart mode is selected. Can I use this mode to connect to the fio directly? Is there any sketch example to do it? Because it must work with a baudrate of 115200 8N1 .... but I do not know how to choose this parameters.

I tried the next:

Code:
#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);
 
}

Evidentely it doesn´t work. I´ve tried to read the datasheet but ... Also I´ve read the library from adafruit to understand how it could work but sadly I am pretty lost.

So I hope you could help me, give me some tips or clues to figure out how make this work.

Thank you for your time

greetings!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 650
Posts: 50833
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Because it must work with a baudrate of 115200 8N1
That is a very difficult rate for software serial to deal with. Only hardware serial seems capable of that rate.

What are you intending to do with the information you get from the card?
Logged

Santander
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi PaulS,

I read it on the datasheet. Besides my teacher told me.  He told me to try some commands and watch the results. So my first step is trying to send a command and just read the answer. On the adafruit library I saw that you must send some byte before sending a commad as a sensor. But like I said it seems that it´s necessary an intermediate... Maybe one of you know a web page where I can find a tutorial ... o some clue to solve my problem.

anyway, thank you for your time!!

greetings!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 650
Posts: 50833
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I read it on the datasheet. Besides my teacher told me.
The data sheet, and your teacher, may says that the baud rate of the device is 115200. But, if either one said that SoftwareSerial absolutely, positively could hand that baud rate, they were wrong. Sometimes it can. Sometimes it can't.

Quote
I saw in adafruit web page a tutorial, and a library. But I do not understand.
Then, perhaps you need to try harder. What don't you understand?
Logged

Pages: [1]   Go Up
Jump to: