I've got a Waveshare PN532 RFID reader/writer. I want to use it with a Pi 4B, but since it is already using a HAT with no free GPIO, I want to use it in UART mode, but not connecting to the GPIO pins 8 and 10, but rather using a TTL-to-USB adapter. Now I want to follow the first step in the wiki, "Quick testing", which is explaining this for a windows PC and "Serial assistant software". It says the connection should be baud rate 115200 and 8N1. The instruction then is:
Select correct serial port and open.
Send data below to wake up FN532 module：
55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 03 FD D4 14 01 17 00
The response from PN532 module should be：
00 00 FF 00 FF 00 00 00 FF 02 FE D5 15 16 00
How do I do this on the Pi (Raspbian Buster)? I guess I must somehow send these bytes to
/dev/ttyUSB0 and poll the response.
Here is an attempt:
- terminal 1:
cat /dev/ttyUSB0 >out.bin
- terminal 2:
echo -en '\x55\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x03\xFD\xD4\x14\x01\x17\x00' > /dev/ttyUSB0
But how do I stop cat? If I ctrl-C it, the contents of
out.bin is empty. If I use use
cat /dev/ttyUSB0, I can see a response of five unprintable characters; my idea was to
hexdump -C -n out.bin, but apparently I need to flush and quit cat, or can I pipe it into a "live" hex view without it waiting for linefeed or flush?