Near Field Communication, NFC and the CR95HF

nfc2

I started work on a Near Field Communication (NFC) module.  The design uses ST Micro’s CR95HF chip.   The module above is the first shot prototype unit.  This device uses a 13.56MHz RF carrier frequency and amplitude-shift keying .  The CR95HF carrier frequency powers the loop antenna shown on the module above and the resulting field couples with a similar loop antenna on an NFC enabled card.  The field coupling, like two loops of a transformer, powers the card.  Powering up the card allows the CR95HF to transmit data to and from NFC cards.  That’s the theory anyway.

NFC is also used in some newer cell phones.  Below is a Samsung commercial touting the feature.  It has a cute wife allegedly sending her husband a naughty video, which I guess is a pretty cool selling point.

 

In my world I’m not trying to send or receive a video.  I’m just trying to write and read from an NFC card.  One example of this kind of card is the ISO 15693 “Tag-it” provided by Texas Instruments.  Another is ST Micro’s LRi2K.  The Tag-it is shown below, and you can see the loop antenna built into the device.  The LRi2K looks more like a credit card, and the antenna is not visible.  On a side note, sorry about the dirty fingernails in the picture.  I spent last weekend beating the ball joints out of my 1964 Galaxie 500.  That’s a dirty job I haven’t yet recovered from.

nfc4

I started off having pretty good success with the project.  But I’m starting to understand why some engineers go bald.  The CR95HF can be interfaced via an SPI or UART port.  I opted to connect to it using a serial UART interface and write some Visual Studio 2010 code.  The CR95HF is supposed to handle all of the NFC particulars including CRC16 generation, ASK modulation of data, and transmit and receive protocols.  All you have to do is select the parameters of the protocol you want to use (in my case ISO 15693), and then embed the command to the NFC card within a Send-Receive command sent to the CR95HF.  This last part is where my project seems to be going south.

Using my Visual Studio software I was able to communicate with the module I designed.  I was able to verify using a spectrum analyzer that I was transmitting at 13.56Mhz.  In fact, when comparing my module to the CR95HF demo kit I could see that the magnitude of my signal was pretty close, even though my loop antenna is much smaller.  That’s an indication that my antenna matching is on par with the demo board.  A good sign.

My software could read the ID from the CR95HF, turn on/off the NFC carrier wave, adjust the RF modulation and receiver gain, and even run through a recommended calibration process.  I could even get it to wake up when a tag was brought close to the loop antenna, so it is detecting the cards.  The one thing I couldn’t get it to do was talk to the card.

nfc3

After re-reading the CR95HF datasheet, then re-re-reading it, I couldn’t see what I was doing wrong.  I had a CR95HF demo board with software and I was able to determine that the cards I was trying to read do work.  This led me to believe that the problem might be on the RF side.  Perhaps my module wasn’t successfully transmitting and receiving the ASK data.   I decided to make a few adjustments to the CR95HF demo board.  I removed the microcontroller they had on the board and jumpered the UART TX, RX and ground connections to BM010 USB to serial converter I had on a breadboard.

nfc1

The setup above guaranteed that I had an RF section that worked since I was just sending my software commands to the functional demo board hardware.  If my prototype had a mismatched antenna then the demo board hack should work with the software I had written.  With this setup I could see that my calibration values were different.  They seemed “better”.  But the end result was no change.  The demo board that could read the cards would not interface to them using my software.

After a few hours of reviewing the source code of the software ST Micro provides for the demo board, and the source code of the microcontroller used on the demo board, I still haven’t found any indication of what I’m doing wrong.  I seem to be sending the same data to the CR95HF that the demo board code sends.  But I’m getting nothing back from the NFC cards.

Like all engineering problems, this one will get solved.  Unfortunately, I’m getting close to last resorts.  ST Micro’s microcontroller that was on the demo board was used to convert USB commands to SPI commands that are sent to the CR95HF.  I may need to put the demo board back together, and use an oscilloscope to capture the SPI data.  At that point I could compare what is being sent over SPI that works with my serial commands that don’t.  Manually decoding SPI is not what I would consider fun.  So maybe I’ll re-re-re-read the datasheet first.

Update:  Shortly after finishing this blog I tried something a little different in my Visual Studio software, and ta-da, it worked.  I was activating every command to the CR95HF via a button on my software form.  When I implemented a series of communications between the software and the CR95HF I was able to link up with the NFC cards.  I still don’t have a complete grasp on why the previous method didn’t work, but there appears to be a timing requirement at play.  I’ll post more later, but as of now things are looking good.

Comments

  1. Hi,
    I’m Tien , from Viet Nam.I like your post. Glad to know you.
    Like you, I like NFC technologies , I worked with PN532 (from NXP) and it worked well , the range is about 4-6 cm.
    I’m looking for a distance reader , could you tell me the distance you archived with TagIt and LRI2K tags ?

    • Hi Tien,

      We can probably get 3-4cm with the tagit tags. The CR95HF does allow you to route a 5V supply to the antenna to provide for greater range, although we did not do that with our BM019 module.

      Lon

  2. Hiiii Lon Glazner,
    am working exactly with the same board at ST India. I need to enhance the power output of Rf drivers and i got stuck.
    i read the datasheet, there it was witten that i have to bring cr95 vps_tx pin 5V operation. But i dont know how to exactly do it. If u can help , i shall be very much thankful to u.
    one more thing if u have some manual, schematic of this board, do send it to me as this is an old version board and tha sources are now not available at st site.
    Thanks in advance
    harisalg92@gmail.com

  3. Ben Johnson says:

    Hi,
    I have one of your excellent modules here. I am building a device to read the Abbott Libre sensor but i want to make a circular design of no more than 30mm diameter as this will place on top of the abbott sensor.
    Your BM 019 is too large.
    I know that it is tuned to the board, the antenna but If it could be removed before C11 capacitor and extended with silicone shielded wires under neath the BM 019 board then this would allow me to incorporate into a circular casing.
    I take it that this will destroy the tuning and it would not work at all?
    How could i go about achieving this?
    Many thanks.

Trackbacks

  1. […] Part 1 – my first attempts to interface with the CR95HF and use NFC Part 2 –an overview of the communication protocol used with the CR95HF chip […]

Speak Your Mind

*