Hello,
I have a project in one of my courses and I need to communicate between an Arduino and Basys 3 Board. I will use Basys as a receiver and Arduino as a transmitter, and I'm using MFRC522 library. However, I could not figure out how to read data from a variable stored in Arduino and send it to Basys using UART.
Say you had a Mega with 4 serial ports.
Serial() is connecting to a PC via USB/Serial chip next to the USB connector.
Serial1, Serial2, Serial3 are all available.
If you had an FTDI Basic (or clone) Serial/USB adapter connected to one of Serial1,2,3, then you could just use
Serial1.print(yourVariable);
and it would go out via USB to the other device.
The MFRC522 has:
The following host interfaces are provided:
• Serial Peripheral Interface (SPI)
• Serial UART (similar to RS232 with voltage levels dependant on pin voltage supply)
• I2C-bus interface
so you could use the UART interface and do the same directly, connecting Serial1RX to the MFRC522 TX, and the Serial1TX to the MFRC522 Rx.
SPI and I2C are more complicated, using dedicated hardware pins (SCK/MOSI/MISO/SS, or SDA/SCL) on the Arduino side to talk to similar pins on the MFCR522 side.
If you using an Uno, which has only 1 hardware serial port (same as the Mega) then you could use Software Serial to talk to the MFRC522 at a slower rate (38400 is reported as the fastest reliable rate). (In the IDE, see Sketch:Import Library:Software Serial).
Actually, I have an RFID reader and I read the data from an NFC card.Then, I need to send this data to FPGA board using UART. I don't need to see the signal in serial port. And I'm using an Arduino uno.
Okay, so you read the 28 or 65 bytes or whatever info from the card into an array, and then send the array out.
After setting up the pins and starting the library per the example, the captured bytes (using 66 as as an example) stored in array can easily be sent out:
for (x = 0; x<66; x=x+1){
mySerial.write(dataArray[x]);
}
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.