简体   繁体   English

NXP PN532 能否以 38400 波特率在 UART 上工作?

[英]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.我正在尝试将使用 NXP PN532的 RFID1356MIFARE 与使用其 UART 功能的ESP32-EVB集成。

The NXP docs states that the PN532 is able to communicate on High Speed UART. NXP 文档指出 PN532 能够在高速 UART 上进行通信。

I am trying to use 38400 because that's the baud rate fixed by the reader that I'm using.我正在尝试使用 38400,因为这是我正在使用的阅读器固定的波特率。

I've found a modified Adafruit PN532 library that added HSU support.我发现了一个修改后的 Adafruit PN532 库,它添加了 HSU 支持。 This library states that HSU uses 115200 baud rate .该库声明HSU uses 115200 baud rate

Now, I've modified PN532_HSU.cpp , where we can find:现在,我修改PN532_HSU.cpp ,我们可以在其中找到:

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.不幸的是,我无法使用这种方法在阅读器和 ESP 之间建立通信。

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.我可以使用普通的 Serial.read Serial.read()获得可读的 output ,因此 UART 通信有效,但这不是您阅读 MIFARE 卡的方式。

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.我浏览了文档,这是我的建议:如果你有一个 USB 到串行设备,使用它直接将读卡器模块连接到计算机,否则使用模块中的迷你 USB 端口直接连接它。 the follow following steps:请执行以下步骤:

  1. Put device in UART/ USB CDC mode depending on how you connected device to computer.根据您将设备连接到计算机的方式,将设备置于 UART/USB CDC 模式。 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)使用 picoterm / screen 或其他串行终端(如果您使用 Linux)或仅使用具有正确波特率的 Arduino 串行监视器来连接设备。(115200 用于 USB 和 38400 用于 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.键入文档中 COMMAND SET FOR CDC AND UART MODE 部分中列出的命令,以检查模块是否正常工作。
  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.它不适用于常规 PN532 库。 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. PN532 数据表中说主机接口是通过上拉/下拉设备的 I0、I1 引脚来选择的。 For HSU both pins must be pulled down.对于 HSU,两个引脚都必须拉低。 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?查看您为模块发布的链接,它说它使用板上的另一个微控制器来扩展通信能力,所以也许您需要使用特定 controller 固件的驱动程序? 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链接: https://www.olimex.com/wiki/MOD-RFID1356MIFARE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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