Skip to content

HydraFW HydraNFC v2 guide dnfc SPI

Benjamin Vernoux edited this page Sep 12, 2020 · 3 revisions

HydraFW HydraNFC Shield v2 Bus SPI (Serial Peripheral Interface)

Connections: four pins (MOSI/MISO/CLOCK/CS) and ground(GND).
Output type: 3.3volt normal, or open drain
(pull up/pull down resistors integrated in MCU or external).
Pull-up resistors: required for open drain output mode (2K – 10K).
Pull-up/down resistors Integrated in MCU: Between 30 to 50K (Typical 40K).
Maximum voltage: 5.5volts (5volt safe).

Output type - open drain/open collector (high=Hi-Z, low=ground),
 normal (high=3.3volts, low=ground).
Use open drain/open collector output types with pull-up resistors
for multi-voltage interfacing.

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

Protocol configuration syntax description:

  • show Show SPI parameters or show pins Show pins used in this mode

  • frequency with floating frequency value (support k (for khz), m (for mhz) suffix or no suffix)

    • Frequencies available for SPI2: 160khz, 320khz, 650khz, 1.31mhz, 2.62mhz, 5.25mhz, 10.5mhz, 21mhz
  • exit to exit SPI mode

Configuration options:

Hardware Informations:

dnfc2> show
Selected technology: NFC-A/B/V/F
Device: SPI2
GPIO resistor: floating
Mode: master
Frequency: 10.50mhz (160khz, 320khz, 650khz, 1.31mhz, 2.62mhz, 5.25mhz, 21mhz)
Polarity: 0
Phase: 1
Bit order: MSB first

dnfc2> show pins
CS:   PC1 (SW)
SCK:  PB10
MISO: PC2
MOSI: PC3
IRQ: PA1

Protocol interaction syntax description:

Bus interaction commands

trigger configures the trigger mode

cs-on or [ Chip select(CS) enable/active (low=state 0/GND).

cs-off or ] Chip select(CS) disable (high=state +3.3V).

Protocol interaction example usage SPI2 write/read:

dnfc2> [ 0xFF r ] [ 0 r ] [ 1 r ] [ 0x80 r ] [ 0x55 r 0xAA r 0xFF r 0x11:4 r:4 ]
/CS ENABLED
WRITE: 0xFF
READ: 0x00
/CS DISABLED
/CS ENABLED
WRITE: 0x00
READ: 0x00
/CS DISABLED
/CS ENABLED
WRITE: 0x01
READ: 0x00
/CS DISABLED
/CS ENABLED
WRITE: 0x80
READ: 0x00
/CS DISABLED
/CS ENABLED
WRITE: 0x55
READ: 0x00
WRITE: 0xAA
READ: 0x00
WRITE: 0xFF
READ: 0x00
WRITE: 0x11 0x11 0x11 0x11
READ: 0x00 0x00 0x00 0x00
/CS DISABLED

Additional informations about SPI

For more details on SPI protocol see: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus