Difference between revisions of "RDM6300"
(4 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
You can connect pins 4 (VCC 5V), 6 (GND), 8 (UART1 TX) and 10 (UART1 RX) to the corresponding pins in the board (of course, TX to RX and vice versa). | You can connect pins 4 (VCC 5V), 6 (GND), 8 (UART1 TX) and 10 (UART1 RX) to the corresponding pins in the board (of course, TX to RX and vice versa). | ||
+ | |||
+ | Note: the "Porco Dio" pinout should be read this way: N. 2 left upper corner, ethernet and USB on the bottom. | ||
Check, using npi-config, that UART1 is enabled (npi-config -> Advanced options -> Serial -> serial1). | Check, using npi-config, that UART1 is enabled (npi-config -> Advanced options -> Serial -> serial1). | ||
Line 20: | Line 22: | ||
./comtest -d /dev/ttyS1 -s 9600 | ./comtest -d /dev/ttyS1 -s 9600 | ||
+ | |||
+ | Note 2: comtest must be killed from another tty, there is no way to close it. | ||
If you put an RFID near to the antenna, you should see its ID repeated on the console until it's near the antenna (about 1cm). | If you put an RFID near to the antenna, you should see its ID repeated on the console until it's near the antenna (about 1cm). | ||
Line 30: | Line 34: | ||
Parity none | Parity none | ||
Flow controlo XON/XOFF | Flow controlo XON/XOFF | ||
+ | |||
+ | In node: | ||
+ | |||
+ | const SerialPort = require('serialport').SerialPort; | ||
+ | const sp = new SerialPort({path: "/dev/ttyAMA2", baudRate: 9600}); | ||
+ | |||
+ | var reading = true; | ||
+ | |||
+ | sp.on("open", function() { | ||
+ | console.log("port has opened"); | ||
+ | }); | ||
+ | |||
+ | sp.on('data', function(data){ | ||
+ | if (reading == true) { | ||
+ | var enc = new TextDecoder(); | ||
+ | var arr = new Uint8Array(data); | ||
+ | ready = enc.decode(arr) | ||
+ | console.log('Data received: ', ready); | ||
+ | reading = false; | ||
+ | setTimeout(function() { | ||
+ | reading = true; | ||
+ | }, 1000); | ||
+ | } | ||
+ | }); |
Latest revision as of 15:16, 19 August 2022
Pins and voltage[edit]
RDM6300 can be powered from NanoPI +5V pin. However, it does not require voltage adapters for signals, as the signals are 3.3V (in and out).
Test[edit]
You can connect pins 4 (VCC 5V), 6 (GND), 8 (UART1 TX) and 10 (UART1 RX) to the corresponding pins in the board (of course, TX to RX and vice versa).
Note: the "Porco Dio" pinout should be read this way: N. 2 left upper corner, ethernet and USB on the bottom.
Check, using npi-config, that UART1 is enabled (npi-config -> Advanced options -> Serial -> serial1).
Download and compile comtest
git clone https://github.com/friendlyarm/comtest.git cd comtest gcc -o comtest comtest.c
then test it
./comtest -d /dev/ttyS1 -s 9600
Note 2: comtest must be killed from another tty, there is no way to close it.
If you put an RFID near to the antenna, you should see its ID repeated on the console until it's near the antenna (about 1cm).
Configurarion (it can be tested with putty on Windows with an USB debug device with 5V power supply enabled):
Baud 9600 Data 8 Stop 1 Parity none Flow controlo XON/XOFF
In node:
const SerialPort = require('serialport').SerialPort; const sp = new SerialPort({path: "/dev/ttyAMA2", baudRate: 9600}); var reading = true; sp.on("open", function() { console.log("port has opened"); }); sp.on('data', function(data){ if (reading == true) { var enc = new TextDecoder(); var arr = new Uint8Array(data); ready = enc.decode(arr) console.log('Data received: ', ready); reading = false; setTimeout(function() { reading = true; }, 1000); } });