Serial Communication Problem

Hello community,

I am currently working with the LinkSprite Cottonwood UHF TTL UART RFID.

I am interfacing my device with the Arduino UNO using the serial TX and RX.

I have come across a problem, when I want to read several tags from my reader. My reader can only send a maximum of 64 bytes report which is equivalent to two tags and a few bytes from the third tag.

However I am working with 15 tags (~330 bytes), is there a way I can work around this problem?

When I use RFIDserial.read() to get the incoming byte, it should afterwards clear that byte if I am not mistaken. Why can't the next byte in the reader's module be added?

From the datasheet:

With byte 2 the module reports how many tags are found by the inventory
command. After sending the first inventory with the next flag set, the module
sends back only the count of the leftover tags. This is used to inform the host
how often it has to call the inventory command with the next flag set until it has
the tag information of all found tags. But the tag information is still in the
module's tag list. No tag information is deleted. The complete report length is
64 bytes and needs to be taken into account in the Host Software.

I would appreciate any help,
Thanks.

You should add RFID to the tread title.

Can you handle serial input when it comes through the USB cable from serial monitor?

When the RFID module is connected, you don't have the UNO plugged into USB, right?

I suspect all you need is to take data from the Serial Inout Buffer as it arrives - that way there is no 64 byte limit. Have a look at the examples in Serial Input Basics. As written it sets aside 32 bytes for incoming data but you can change that to suit your needs. The only limit is the total SRAM available.

...R

GoForSmoke:
You should add RFID to the tread title.

Can you handle serial input when it comes through the USB cable from serial monitor?

When the RFID module is connected, you don't have the UNO plugged into USB, right?

My UNO is plugged by USB to my PC. I can receive the bytes from my reader. However some bytes are lost.

I found this 'datasheet'. If it's not the correct one, please provide link to the correct one.

As far as I understand it, you will only get info of one tag back in a variable length reply. If there are one or more tags, the reply contains a field indicating how many tags there are and information about the first tag. For the number of tags indicated in the reply (minus 1), you can now query the next tag with a modified second byte of the command.

E.g.
send start_inventory_round
reply states 2 tags and contains information about first tag
send next_tag_information
reply states 1 tag and contains information about the second tag

Note:
Be careful when using the same serial port for communication with the PC and with the module; if you transmit something to the module, it's also transmitted to the PC. If you receive something from the module and at the same time receive from the PC, data corruption can be the result.
You might want to consider to use software serial for communication with the module.

sterretje:
I found this 'datasheet'. If it's not the correct one, please provide link to the correct one.

As far as I understand it, you will only get info of one tag back in a variable length reply. If there are one or more tags, the reply contains a field indicating how many tags there are and information about the first tag. For the number of tags indicated in the reply (minus 1), you can now query the next tag with a modified second byte of the command.

E.g.
send start_inventory_round
reply states 2 tags and contains information about first tag
send next_tag_information
reply states 1 tag and contains information about the second tag

Note:
Be careful when using the same serial port for communication with the PC and with the module; if you transmit something to the module, it's also transmitted to the PC. If you receive something from the module and at the same time receive from the PC, data corruption can be the result.
You might want to consider to use software serial for communication with the module.

Yes thanks for the notice I am using software serial with the module.

I managed to fix my problem, the solution was quite simple and trivial.

I had some Serial.print() functions when I was receiving the data which was slowing down transmission. Removing them fixed it.

Thanks all for the help I appreciate it