CR95HF tag detection and recognition

To detect a tag, the CR95HF must be set in WFE (Wait For Event) mode sending an Idle command, from which it will exit upon one of four cases: Timeout, Tag Detection, Low Pulse on IRQ_IN pin, Low Pulse on SPI_SS pin or any combination of the previous. To return to Ready mode from a Tag Detection event a Tag Detector Calibration procedure must be executed first to calibrate the internal ADC's reference values.


The datasheet explains in more detail each of the parameters in section 5.6.1, but the most important ones are described below:

WU Source: Sets the source for the wakeup event

  • 0x01: Time out
  • 0x02: Tag Detection
  • 0x08: Low pulse on IRQ_IN
  • 0x10: Low pulse on SPI_SS

A combination of the previous can be selected by setting to 1 the corresponding bits:

  • bit0: Timeout
  • bit1: Tag Detection
  • bit2: 0
  • bit3: IRQ_IN
  • bit4: SPI_SS
  • bit5: 0
  • bit6-7: Low Frequency Oscillator: 00=32kHz, 01=16kHz, 10=8kHz, 11=4kHz

For example, 0x03 would set the source to either Timeout or Tag Detection, while 0x0A would be Tag Detection or Low pulse on IRQ_IN.

Enter Control: These two bytes (EnterCtrlL and EnterCtrlH) define the resources when entering WFE mode.

  • 0x0400: Hibernate
  • 0x0100: Sleep (or 0x2100 if Timer source is enabled)
  • 0xA200: Tag Detector Calibration
  • 0x2100: Tag Detection

WU Control: These two bytes (WuCtrlL and WuCtrlH) define the wake-up resources.

  • 0x0400: Hibernate
  • 0x3800: Sleep
  • 0xF801: Tag Detector Calibration
  • 0x7901: Tag Detection

Leave Control: 0x1800

WU Period: 0x20 (recommended)

OSC Start: 0x60 (recommended)

DAC Start: 0x60 (recommended)

DAC Data: DacDataL and DacDataH, given by Tag Calibration process

Swing Count: 0x3F (recommended)

Max Sleep: 0x28 (recommended)

Tag Detector Calibration

The calibration procedure is described in the datasheet, but it basically sets the DacDataL to 0x00 and iterates DacDataH from 0xFF to 0x00, while going from WFE to Ready mode, until the WU event is Tag Detection instead of Timeout. This value is DacDataRef, where DacDataL= DacDataRef - 0x08 and DacDataH= DacDataRef + 0x08

However, one would think that once calibrated, the chip would detect a tag when it is placed between DacDataL and DacDataH but the datasheet (5.6.5) states that "The CR95HF will exit WFE mode through a Tag Detection event if the DAC data register value is greater than the DAC Data parameter high value (DacDataH) or less than the DAC Data parameter low value (DacDataL)"  which means that the tag will be detected when it's NOT between the values.

So, since a tag will be detected when either below or over the calibration window, the best thing to do was to set DacDataH to maximum and DacDataL to DacDataRef, so a tag will be detected at a distance of DacDataL or less.

Tag Recognition

Finally, once a tag has been detected, the controller must set the tag's protocol, activate it and read its contents, after which they can be used as regular data.

In the following video we can see how the system recognizes each tag and lights each led accordingly

Leave a Reply

Your email address will not be published. Required fields are marked *