Skip to content

HydraFW HydraNFC v2 guide dnfc mode

Benjamin Vernoux edited this page Jan 23, 2021 · 6 revisions

HydraNFC Shield v2 must be plugged on the front side of HydraBus! (PowerOff the HydraBus before to plug HydraNFC)

This guide is updated towards firmware release HydraBus v1 HydraNFC Shield v2 firmware v0.2 Beta

Debug/Developer mode for NFC Shield v2 with dnfc mode, main commands

dnfc2>
   show           Show DNFCv2 parameters
   frequency      Set SPI Bus frequency
   trigger        Setup DNFCv2 SPI2 trigger
   set-nfc-mode   Set NFC Mode and TX/RX BitRate in kbit/s
   get-nfc-mode   Get NFC Mode
   set-nfc-obsv   Set NFC Observer(ON=1/OFF=0) and 8bits value for TX/RX
   get-nfc-obsv   Get NFC Observer(ON=1/OFF=0) and 8bits value for TX/RX
   nfc-off-on     Set RF field off/on
   nfc-reqa       Send ISO 14443-A REQA
   nfc-wupa       Send ISO 14443-A WUPA
   send           Send bytes according to the selected mode
   send-auto      Send bytes according to the selected mode and add CRC
   nfc-transp     Enter NFC Transparent Test Mode
   nfc-stream     Enter NFC Stream Test Mode
   sniff          Enter NFC Sniff Test Mode
   read           SPI Read byte (repeat with :<num>)
   hd             SPI Read byte (repeat with :<num>) and print hexdump
   write          SPI Write byte (repeat with :<num>)
   <integer>      SPI Write byte (repeat with :<num>)
   <string>       SPI Write string
   cs-on          SPI Alias for "chip-select on"
   cs-off         SPI Alias for "chip-select off"
   [              SPI Alias for "chip-select on"
   ]              SPI Alias for "chip-select off"
   &              Delay 1 usec (repeat with :<num>)
   %              Delay 1 msec (repeat with :<num>)
   ~              SPI Write a random byte (repeat with :<num>)
   -              Toggle PC3 pin high
   _              Toggle PC3 pin low
   exit           Exit DNFCv2 mode

Debug/Developer mode for NFC Shield v2 with dnfc mode using nfc-mode and doing "manual" anti-collision on NFC-A

Help on set-nfc-mode

dnfc2> help set-nfc-mode
Set NFC Mode and TX/RX BitRate in kbit/s
 nfc-mode       Set NFC Mode
      POLL_NFCA=1, POLL_NFCA_T1T=2, POLL_NFCB=3, POLL_B_PRIME=4, POLL_B_CTS=5
      POLL_NFCF=6, POLL_NFCV=7, POLL_PICOPASS=8, POLL_ACTIVE_P2P=9
      LISTEN_NFCA=10, LISTEN_NFCB=11, LISTEN_NFCF=12, LISTEN_ACTIVE_P2P=13
 nfc-mode-tx_br Set TX BitRate
      BR_106=0, BR_212=1, BR_424=2, BR_848=3
      BR_52p97=235, BR_26p48=236, BR_1p66=237
 nfc-mode-rx_br Set RX BitRate
      BR_106=0, BR_212=1, BR_424=2, BR_848=3
      BR_52p97=235, BR_26p48=236, BR_1p66=237

dnfc2> set-nfc-mode nfc-mode 1 nfc-mode-tx_br 0 nfc-mode-rx_br 0
nfc-mode = 1
nfc-mode-tx_br = 0
nfc-mode-rx_br = 0
rfalSetMode OK
dnfc2> get-nfc-mode
nfc-mode = 1
nfc-mode-tx_br = 0
nfc-mode-rx_br = 0

Example usage of nfc-mode with basic anti-collision on NFC-A:

>dnfc
 dnfc2> set-nfc-mode nfc-mode 1
 nfc-mode = 1
 nfc-mode-tx_br = 0
 nfc-mode-rx_br = 0
 rfalSetMode OK
 dnfc2> nfc-off-on
 dnfc2> nfc-reqa
 02 00
 dnfc2> send 9320
 9A A5 0F C8 F8
 dnfc2> send-auto 93709AA50FC8F8
 18

Debug/Developer mode for NFC Shield v2 with dnfc mode SPI low level

Example SPI low level communication with HydraNFC Shield v2 ST25R3916:

>dnfc
dnfc2>
  • Write a register in Space A
    • Write register 0x00 to value 0x00
      • [0x00 0x00]
    • Write register 0x2C to value 0x84
      • [0x2C 0x84]
  • Read a register in Space A (Register OR 0x40)
    • Read register 0x00 in Space A
      • [0x40 r]
    • Read register 0x2C in Space A
      • [0x6C r]
  • Write a register in Space B
    • Write register 0x05 to value 0x00 in Space B
      • [0xFB 0x05 0x00]
    • Write register 0x33 to value 0x84 in Space B
      • [0xFB 0x33 0x84]
  • Read a register in Space B (Register OR 0x40)
    • Read register 0x05 in Space B
      • [0xFB 0x45 r]
    • Read register 0x2C in Space B
      • [0xFB 0x73 r]
  • Send direct command
    • Set Default (Puts the ST25R3916 into power-up state)
      • [0xC0]
  • Analog Test and Observation Register 1 (Test Output CSI/CSO)
    • Write Analog Test and Observation Register 1 to value 0x05 => Pin CSI = Tag demodulator analog / Pin CSO = Tag demodulator OOK digital out
      • [0xFC 0x01 0x05]
    • Read Analog Test and Observation Register 1 (Register OR 0x40)
      • [0xFC 0x41 r]

TODO

  • Finalize code for following modes:
    • nfc-transp Enter NFC Transparent Test Mode
    • nfc-stream Enter NFC Stream Test Mode
    • sniff Enter NFC Sniff Test Mode

For more details on ST25R3916