Trying to let Nano V3 communicate with RFID using UART.

Hi,
I just would like to find out how to let my nano v3 communicate with my RFID-RC522 pcb using the UART serial communication. I tried the SPI example program and it works fine. I read the datasheet and the RFID can communicate through I2C, SPI or UART depending on the pin levels of pin 1 (called I2C) and pin 32 (called EA) after powerup or reset. Default pin 1 is VCC and pin 32 is GND selecting SPI. I disconnected pin 32 from VCC by cutting the pcb trace near pin 1. With a probe I connect pin 32 to GND (selecting UART). After powerup and sending a RESET signal to the RFID then when sending data to the RFID through the SDA pin no response is received on the MISO pin. If I run the SPI program while pin 32 is GND (UART mode) then SPI communication still works! It seems as if pin 32 does not do anything. Also I can't find any project on the Internet using the RFID with UART. Who can help me out?

See RC522 RFID-RC522 Switching SPI to UART interface or i2c ! POSSIBLE ! - #5 by farthinder for some informing pictures.
Somewhere it says: "I gave this a try, trying to convert to UART without much success. I used this project to verify but couldn't really get anything to work:"

Can you give a link to the technical documentation on the BOARD you are using? All I find is on the IC that is on the board.

Hi, I allways create a powerpoint file when starting a new project so I uploaded a stripped version as a pdf file.
rfid.rc522.nano.v3.serial.communication.tryout.pdf (735,3 KB)

I read that pins 1 and 32 must be 0 or ground when power is applied to the device. That will enable the UART serial component of the IC. Is that what you see?

The thing is that the RC522 system is a 3V3 system. If you want to connect it to a 5V nano then you will have to use level shifters for what ever protocol you use.

However, if you use a 3V3 powered nano (with an 8MHz clock) then you can connect it all up without any level converters.

5V levels is a good issue. First I connected the Nano V3 directly to the RFID which did not work. Then I inserted some levelshifters, see pdf. The RFID card still worked. I tested another RFID card showing the same results.
Pin 1 is grounded by hardware and I grounded pin 32 by some probe. Still the SPI communication is fully operational which I would not expect to be so. My application sends byte 0x37 (software version register request) or' ed with 0x80 meaning a read operations whereas the rfid uC should send some data byte. In stead, the data on the SDA pin is copied to the MISO pin real time so the MISO pin shows value 0xB7 (0x37 or'ed 0x80) which should return the register value directly AFTER receiving the request byte. But after the first byte being send and realtime being copied on the MISO pin no extra data is send by the rfid uC. Hope this makes things clear.

When you say here "The RFID card still worked" do you actually mean that "The RFID card still did not work."? If not I can't follow what you mean.

What exactly do you mean by "some probe"

It is my understanding of this board is that while the chip is capable of an I2C and serial output, the RFID reader board prevents this from happening by connecting the I2C pin to ground, as shown in the reader board's schematic.

It would be a lot clearer if you posted the code (using code tags). When I have used this RFID board I have only used the SPI interface and have never called the software version register request.

However looking at the data sheet for the chip, I see the software version register request returns only one byte so when you say:-

Would seem to be how the chip works.

Hi,
This may help,
https://codebender.cc/sketch:26509#RFID%20UART%20Example.ino

How are you powering your project?

Tom.. :smiley: :+1: :coffee: :australia:

@TomGeorge

Thanks, I knew this example and I spend almost half a day on this example before posting to this forum. I crawled through the code and in SoftwareSerial.cpp it says ATmega1280/2560 support so I'm not sure if it is working on the ATMega328P on the Nano V3 board. Also the TX pin is declared here as RFID_RX_PIN + 1 so the RX pin is 4 (PD4) en TX pin is 5 (PD5). First I had to find the "RFID.h" which was not included. That cost me a lot of time . Then finally after uploading it nothing happens on the TX pin (oscilloscoop). Without any transmission there will be no reception. So I disgarded this project.

The RFID board is powered by the 5V0 to 3V3 converter on the Arduino Nano V3 board which on it's turn is powered by USB. I monitored the 3V3 power pin of the RFID bij oscilloscoop and all seems fine.
rfid.rc522.nano.v3.serial.communication.tryout.002.pdf (908,0 KB)


@Grumpy_Mike

When you say here "The RFID card still worked" do you actually mean that "The RFID card still did not work."? If not I can't follow what you mean.

I still worked in SPI mode.

What exactly do you mean by "some probe"

I use a PC-BITE system and connect one probe to GND and let it's tip rest on pin 1 as there is only a small piece of this pin available.

It would be a lot clearer if you posted the code (using code tags). When I have used this RFID board I have only used the SPI interface and have never called the software version register request.

I wrote my code in Microchip Studio. With all my observations I forgot to tell I monitored all signals with my oscilloscoop.

I think my question is a little out of the Arduino box but Arduino uses the SPI library succesfully and the RFID UART Example inspired me that's why I try it here in this forum. As there is nothing litterally nothing to find on the Internet about using RFID with UART (except 1) I suspect nobody has ever done this successfully at least not on a simple Arduino PCB or maybe I am overlooking something quite simple.

Also see the attached pdf file.

It is probably as I said the the popular RFID card is constructed so that SPI is the only one that will work. If you see your PDF you will see that the line that is supposed to output serial and I2C data is connected to ground. So that is not going to allow those modes to work. You would have to take a scalpel and cut tracks to wire that pin to anything useful.

He only way I could see that working is if the ground on the probes is connected to the ground of the other processors.

It is probably as I said the the popular RFID card is constructed so that SPI is the only one that will work. If you see your PDF you will see that the line that is supposed to output serial and I2C data is connected to ground.

I think there is a misunderstanding. The real I2C signals I2C.SCL (uC pin 31 = MOSI connector pin) and I2C.SDA (uC pin 24 = _NSS connector pin) are being used if the uC is in the I2C mode. Pin 1 which is confusingly named I2C is only used to let the uC startup in I2C mode.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.