[LF 125kHz] Interfacing Arduino/HTRC110 - Read a tag

Hey there,

Scope I'm trying to interface the Arduino (Nano) with the NXP chip HTRC110. The datasheet of HTRC110 and the application note are there : http://www.nxp.com/documents/application_note/AN98080.pdf http://www.nxp.com/documents/data_sheet/037031.pdf

The chip communicates through a similar SPI with the Arduino Nano : DIN, DOUT, SCK (no Chip Select). I have implemented that communication and I manage to configure the different registers of the chip and to re-read them back and confirm what I've done. So the communication with the chip is well established and works. DIN and DOUT are sync with CLK as expected, its all good.

Problem My problem is when I need to read a tag. According to the datasheet/AN, one should send with the Arduino, three '1', to make the chip entering in the reading process. Through all I've read on the internet, the CLK need to be SET LOW after the 3 '1's are sent, which I do in my code. Normally commands are one byte but the reading is specific and is '111' + CLK Low. So well, I've done that but I have two problems :

  1. When I look the RF driving signal at the output of the chip (or if I look the RF signal with a loop probe), I don't see any modulation in the driving signal or in the EM field.

  2. I have things on Dout (Chip -> Arduino line), but it's erratic. It looks like it changes when I approach a tag to the antenna but still, it looks random so I can't tell, I can't indentify what I'm seeing on the oscilloscope.

What have I done wrong ? There's no chronogramme or anything in the datasheet and I havent found a lot of information ... I've seen some people had same troubles as I have but I havent found any followings in their topics. So I don't know whether they gave up or found a solution.

If someone has implemented that chip, even if not with an Arduino, I'd be very grateful for any kind of help. Thanks all.

Please post your sketch and a wiring diagram. How do you power your setup?

/*
 Connexions HTRC110 <--> Arduino
 > SCLK: HTRC110_pin8  -- Arduino_D13
 > DIN:  HTRC110_pin9  -- Arduino_D11
 > DOUT: HTRC110_pin10 -- Arduino_D12 
 */

// Variables
byte Cde  = B00000000;
byte Data = B10000001;

// Interface HTRC110 - Function transfer
// rappel: CLK-> 13, HTRC110_Din-> 11, HTRC110_Dout-> 12
byte Transfer(byte Cde)
{
  int Tdemi = 20; //µs
  int i;
  boolean b;
  byte Rep;
  // initialisation
  digitalWrite(13,HIGH); //CLK High
  delayMicroseconds(Tdemi);
  digitalWrite(11, LOW);
  delayMicroseconds(Tdemi);
  digitalWrite(11, HIGH);
  delayMicroseconds(Tdemi);
 //8 clock periods to send the commands
  for (i=7;i>=0;i--)
  {
    // Falling edge
    digitalWrite(13, LOW);
    b = bitRead(Cde,i);
    digitalWrite(11, b);
    delayMicroseconds(Tdemi);
    // Rising edge
    digitalWrite(13, HIGH);
    delayMicroseconds(Tdemi);
  }
  // 8 clocks period for data
  for (i=7;i>=0;i--){
    // Falling edge
    digitalWrite(13, LOW);
    delayMicroseconds(Tdemi);
    digitalWrite(13, HIGH);
    //Rising edge
    b = digitalRead(12);
    bitWrite(Rep,i,b);
    delayMicroseconds(Tdemi);
  }
  digitalWrite(13,LOW);
  digitalWrite(12,HIGH);
  digitalWrite(11,HIGH);
  return Rep; 
}


//------------------------
// Specific function to send the READ_TAG command
// '111' sent and clock low
void READmode()
{
  int Tdemi = 20; // en microseconde
  int i;
  int j;
  boolean b;
    // INIT
    digitalWrite(13,HIGH); //CLK High
    delayMicroseconds(Tdemi);
    digitalWrite(11, LOW);
    delayMicroseconds(Tdemi);
    digitalWrite(11, HIGH);
    delayMicroseconds(Tdemi);
// 3 clocks for the three '1'
  for (i=2;i>=0;i--){
    //falling
    digitalWrite(13, LOW);
    digitalWrite(11, 1);
    delayMicroseconds(Tdemi);
    // rising
    digitalWrite(13, HIGH);
    delayMicroseconds(Tdemi);
  }
  digitalWrite(13,LOW);
  delay(200);
   digitalWrite(13,HIGH);
}

//SETUP
void setup() { 
 // Serial
 Serial.begin(9600);
 Serial.print("Demarrage:\n");  
 //Link with HTRC110
 // CLK-> 13, HTRC110_Din-> 11, HTRC110_Dout-> 12
  pinMode(11,OUTPUT);
  pinMode(12,INPUT);
  pinMode(13,OUTPUT);
  delay(10);
}


//MAIN
void loop() {

digitalWrite(11,HIGH);
digitalWrite(12,HIGH);
digitalWrite(13,LOW);

//CONFIG PAGES
//Page 3
Transfer(B01110000);
delay(2);
//Page 0
Transfer(B01000011);
delay(2);
//Page 2
Transfer(B01101100);
delay(2);
//Page 1
Transfer(B01010000);
delay(2);

////-----------------------------------------------
//CALCULATING SAMPLING TIME
byte t_ant;
t_ant = Transfer(B00001000);
//Calculation
t_ant <<= 1;
t_ant += B00111111;
t_ant &= B00111111;
Serial.println("t_ant sent=");
Serial.println(t_ant);
delay(2);
//Set sampling time
Transfer((B10000000 | t_ant));
delay(2);
//Get sampling time
byte resp_samp_time;
resp_samp_time = Transfer(B00000010);
Serial.println("t_ant read=");
Serial.println(resp_samp_time);

////-----------------------------------------------


//-------------------------------------------------  
//GENERAL SETTLING SEQUENCE
Transfer(B01101011);
delay(4);
Transfer(B01101000);                                                                                                                                                                                                                                                                 
delay(1);
Transfer(B01100000);
delay(2);
//------------------------------------------------- 

READmode();

delay(1000);
}

Here is just my code.
Transfer : function to activate CLK, 16 clocks period, 8 to sent data, 8 to read Dout. Works ok, cause I read the registers.
Read_mode : special function for READ_TAG command. Send ‘111’ and setup clok low. Looks like it works well too.
The command READ_TAG is well interpreted by the chip cause if I add a ‘1’ or if I forget to set up CLK low, I don’t have anything on DOUT.
At the moment, I have things on DOUT but erratic, whatever I do in the code.
I still can’t see the commands on the 125kHz sin wave sent by the chip. No command are RF sent.

My setup is powered by USB and I just disconnect and reconnect when I update the registers.

Also for the wiring its like that : http://www.embedded-code.com/manuals/125khz-rfid-reader/downloads/htrc110_rfid_reader_driver_example_project_circuit.pdf For the HTRC Part, its wired like that. I have a 125kHz antenna, 726µH, 2.2nF and the rest is all same than that schematic. My Dout doesn't go to an Interrupt Pin yet. It just goes to the arduino pin which is mentionned in the code ive quoted. But my problem for now is not to recieve but to emitt datas. I've tried lof of things but I still can't see the command going through the EM field.

I've checked the standard for 125kHz and communication from reader to tag is 100% ASK modulation with (if I remember well) something like 8/10 period of 125 kHz to do a hole. I've never seen that on my scope, either on the TX output, either on the field. Thank you

My Dout doesn't go to an Interrupt Pin yet. It just goes to the arduino pin which is mentionned in the code ive quoted. But my problem for now is not to recieve but to emitt datas. I've tried lof of things but I still can't see the command going through the EM field.

I've checked the standard for 125kHz and communication from reader to tag is 100% ASK modulation with (if I remember well) something like 8/10 period of 125 kHz to do a hole. I've never seen that on my scope, either on the TX output, either on the field.

Why do you expect anything going out the EM field if you don't send anything? From the datasheet I get the impression that this chip is not more than a simple antenna driver. Once you sent the three ones for read tag, the chip simply switches into transparent mode and pipes out through the Dout pin the amplified and "comparatored" signal it receives from the antenna. So the chip doesn't handle anything of the RFID communication, you have to do everything yourself. So you have to tell the tag that it has to identify itself or send any of the other stored data. That means you have to get deeply familiar with the internals of the RFID system, you cannot just read out some tags and write some information to them was with the more convenient systems.

On the antenna I would expect to have a steady 125kHz signal if you sent the READ_TAG command. Is that the case?

First, thanks a lot for your answer.

To be honnest, what I had understood was that the chip would have sent by itself an inventory command when it has received the '111' from the micro controller through Din. What you're saying is that the HTRC110 is just a simple RF front-end, nothing more ? What is the particular interest/purpouse of the chip compared ? Cause it's written HITAG Reader Chip which would let me think that its a bit more than a simple antenna driver.

What's transparent mode then ?

Although if you're interested, I had checked a long time that driver for PIC with the HTRC110 here : http://www.embedded-code.com/source-code/rfid/125khz-rfid-readers/htrc110-em4102-rfid-reader-driver The manual is here http://www.embedded-code.com/manuals/125khz-rfid-reader/category/how-the-driver-works

I had seen nowhere that the user has to write and code all the standard command as inventory in the microcontroler. What I had understood is that with 3 '111' the chip send an ID request (wich is in the standard) and the tag just answers with his Id. So what I thought was that after the '111' I would see in the EM field the modulated command UID request..

Thank you

'The HTRC110 reader chip was mainly intended for integration into systems that need to identify one single RFID tag at a time. At the request of the host the chip sends the adequate command to the tag, retrieves the answer of th e latter in analog form, digitizes the data and offers to the host the data retrieved from the tag in binary format. The chip does not provide support for collision detection and anticollision id entification procedures in case that several tags in the antenna field respond to the same command at the same time. '

http://cdn.intechopen.com/pdfs-wm/6035.pdf

What do you think ? Not sure it's a simple driver now .. Im a bit lost :)

What's transparent mode then ?

I understood it to be transparent from the antenna to the DOUT pin, so the data coming in from the antenna is directly reflected on the DOUT pin.

Although if you're interested, I had checked a long time that driver for PIC with the HTRC110 here : http://www.embedded-code.com/source-code/rfid/125khz-rfid-readers/htrc110-em4102-rfid-reader-driver

I didn't analyze it thoroughly but it seems that it does react as I would expect it from the datasheet. It sends some commands to the chip (which probably instruct the tag to identify itself) and after that it changes to transparent mode and tries to parse the data that is sent back by the tag. The chip is a rather low level interface to the RFID tags, I would use a simpler one except if you want to do quite special things with your RFID tags. If you want to use this chip (for whatever reason), use the PIC code to access it, translating this PIC code to AVR code is not that hard.

Well, from what I've read in his code, he does pretty much same as I do. He send three one and then gather the demodulated data on Dout. Not decoded tho. So normally, just after he sent the 111, he should see a modulation in the EM field. He doesnt sent any particular command, there's nothing like that.

Its a bit irrelevant to recode his code for the AtMega cause I did exactly same as he does. What he has more is just the decoding part but my problem is way before being able to decode :)

Thank you again.

I agree that you did more or less the same as he did. What kind of tag do you have in the antenna range?

Once in read mode the HTRC110 outputs a 125kHz sine wave. The tag (if present) will interfear with the RF sine wave signal in order to pass its data stream back which the HTRC110 detects for us. When reading is active the Dout pin of the HTRC110 contains the raw data output of the tag after being filtered into a digital signal by the HTRC110.

That means to me that the chip emmits a 125kHz sine wave and nothing else. Do you see that sine wave? If you see it, the tag should modulate it as soon as it gets into range. Can you see a change in the wave if you move the tag into the antenna range?

Yes I have a sin wave when I look the field with a spy probe close to the antenna and I also see on output TX1/2 the driving signal (125kHz) of the antenna. The field is emitted. When I approach the tag I see nothing in the field - no modulation. It should be 100% ASK modulation so I really should see it. I haven't done any mistake on the scope with the time/div. I've checked the timing in the standard. Also I dont see any modulation at the driving output of the antenna either. Its' like the chip doesn't understand the order but I doubt a bit about that cause as soon as I sent the '111' I see things on DataOut (trash random datas, confirmed on other websites). But no modulation, no action in the field. Whatever the tag (I use HiTag) the chip even doesnt send the command. The problem is before the tag. I really would expect to see the command, even without any tag in the field. Im used to 13.56MHz RFID.

I don't know the 125kHz RFID standard but if the datasheet of the chip is correct, there is no need to send a command to the tag but the tag should start sending it's data as soon as it gets into the antenna range and gets enough power from the field. I just used RDM6300 based 125kHz readers and there you also don't have to send commands, you just get the serial number as soon as the tag gets into the antenna range. Are you sure that the standard dictates a read command for the tag to get active?

I need to read again the standard. I just found that on the internet : http://www.priority1design.com.au/rfidread-mrw.pdf

Hitags will be detected if programmed to Talk first otherwise a scan tag command is needed to detect the tag.

So maybe im using a tag which is not in Talk First mode.. But still, if the tag talks first, I should see modulation in the EM field. I'll check all that tomorrow and let you know if I can find out some more.

Thanks again for your time.