简体   繁体   中英

Can the NXP PN532 work on UART at a 38400 baud rate?

I am trying to integrate an RFID1356MIFARE , which uses NXP PN532, with an ESP32-EVB using their UART capabilities.

The NXP docs states that the PN532 is able to communicate on High Speed UART.

I am trying to use 38400 because that's the baud rate fixed by the reader that I'm using.

I've found a modified Adafruit PN532 library that added HSU support. This library states that HSU uses 115200 baud rate .

Now, I've modified PN532_HSU.cpp , where we can find:

void PN532_HSU::begin()
{
    _serial->begin(115200);
}

into

void PN532_HSU::begin()
{
    _serial->begin(38400, SERIAL_8N1, 36, 4);
}

Unfortunately, I haven't been able to establish communication between the reader and the ESP using this method.

I am able to get a readable output using normal Serial.read() , so UART communication works, but that's not how you read MIFARE cards.

I don't know what the problem is.

What do you think?

[EDIT]

I went through the documentation and here is what i suggest: If you have a USB to serial device use it to directly connect reader module to computer else connect it directly using mini USB port in module. the follow following steps:

  1. Put device in UART/ USB CDC mode depending on how you connected device to computer. Exact method to do this is provided in operation section of documentation
  2. Use picoterm / screen or other serial terminal (if you are using Linux) or just use Arduino serial monitor with correct baud rate to connect device.(115200 for USB and 38400 for UART)
  3. Type in commands listed in COMMAND SET FOR CDC AND UART MODE section in documentation to check if module is working or not.
  4. Place some cards over reader to check what response does module sends when card is detected.
  5. Use this information to develop your own library for reader.

It will not work with regular PN532 libraries. Instead you'll need to use regular Serial read and write to communicate.

[Original]

PN532 datasheet says host interface is selected by pulling up/down I0, I1 pins of device. For HSU both pins must be pulled down. This is implemented in hardware so you need to verify if the mode you want to use is set.

Looking into the link you posted for module, it says that it uses another micro-controller on board to extend communication capabilities, so maybe you need to use driver for that specific controller firmware? The link seems to have document explaining how to setup different communication system in Document section, please have a look there and check if it works. Link: https://www.olimex.com/wiki/MOD-RFID1356MIFARE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM