HydraFW HydraNFC v2 guide dnfc Bus interaction commands - hydrabus/hydrafw_hydranfc_shield_v2 GitHub Wiki
This guide is updated towards firmware release HydraBus v1 HydraNFC Shield v2 firmware v0.2 Beta
All commands have to be delimited with spaces.
Example1 Compressed mode:
dnfc2> [0x1 0xff 0 10 0b11 077]
/CS ENABLED
WRITE: 0x01 0xFF 0x00 0x0A 0x03 0x3F
/CS DISABLED
Example2 Compressed mode:
dnfc2> [0x3a:2 0x0f 0b1111 0 1][2:5][0x3b r:4]["hello"]
/CS ENABLED
WRITE: 0x3A 0x3A 0x0F 0x0F 0x00 0x01
/CS DISABLED
/CS ENABLED
WRITE: 0x02 0x02 0x02 0x02 0x02
/CS DISABLED
/CS ENABLED
WRITE: 0x3B
READ: 0x00 0x00 0x00 0x00
/CS DISABLED
/CS ENABLED
WRITE: 0x68 0x65 0x6C 0x6C 0x6F
/CS DISABLED
- Note: The "compressed" mode (multiple commands without space) is decompressed internally so it will not allow to enter more "words"
- Example with spi compressed commands:
dnfc2> "a"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
- Output of the spi compressed command:
Uncompressed form too big
dnfc2> [ 0x1 0xff 0 10 0b11 077 ]
/CS ENABLED
WRITE: 0x01 0xFF 0x00 0x0A 0x03 0x3F
/CS DISABLED
Read one byte on the selected bus.
When applicable (in SPI mode for instance), Hydrabus will send
0xffwhile reading
Suffix command with :<int> to read <int> bytes up to 255.
dnfc2> read read
READ: 0xFF
READ: 0xFF
dnfc2> r:5
READ: 0xFF 0xFF 0xFF 0xFF 0xFF
dnfc2>
Read one byte and display value in hexdump format.
When applicable (in SPI mode for instance), Hydrabus will send
0xffwhile reading
Suffix command with :<int> to read <int> bytes up to 4294967295.
See Hexdump guide for more information.
dnfc2> hd:32
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ................
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ................
Followed by values to write byte(s).
This command is fully optional and can be omitted.
dnfc2> write 0xcc
WRITE: 0xCC
dnfc2> w 0xcc
WRITE: 0xCC
Each value can be written multiple times by using the :<int> suffix to write <int> bytes.
dnfc2> 0x55:5
WRITE: 0x55 0x55 0x55 0x55 0x55
dnfc2> 0xcc:0xc
WRITE: 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC
dnfc2>
To write a binary value, prefix it with 0b
In any case, a full byte will be written on the bus.
Values range from 0b0 to 0b11111111
dnfc2> 0b1010101
WRITE: 0x55
dnfc2> 0b11001100
WRITE: 0xCC
To write an hexadecimal value, prefix it with 0x
Values range from 0x0 to 0xff
dnfc2> 0x55
WRITE: 0x55
dnfc2> 0xcc
WRITE: 0xCC
To write a decimal value, just write it without any leading data.
Values range from 0 to 255
dnfc2> 85
WRITE: 0x55
dnfc2> 204
WRITE: 0xCC
To write an octal value, prefix it with 0
Values range from 00 to 0377
dnfc2> 0125
WRITE: 0x55
dnfc2> 0314
WRITE: 0xCC
Repeating the command will generate a new random value, but using the repeat suffix will reuse the same byte.
dnfc2> ~ ~
WRITE: 0x8C 0xAE
dnfc2> ~:2
WRITE: 0x6B 0x6B
It is possible to write ASCII strings by enclosing them between ".
It is also possible to include non-ASCII characters within the string by using the \x.. syntax.
dnfc2> "Hello"
WRITE: 0x48 0x65 0x6C 0x6C 0x6F
dnfc2> "Hello World"
WRITE: 0x48 0x65 0x6C 0x6C 0x6F 0x20 0x57 0x6F 0x72 0x6C 0x64
dnfc2> "Hello\x20World"
WRITE: 0x48 0x65 0x6C 0x6C 0x6F 0x20 0x57 0x6F 0x72 0x6C 0x64
Delay can be repeated using the :<int> suffix
Due to timing constraints, the microseconds will not be displayed in the CLI.
dnfc2> 0x55 &:10 0xcc
WRITE: 0x55
WRITE: 0xCC
Delay can be repeated using the :<int> suffix
dnfc2> 0x55 %:10 0xcc
WRITE: 0x55
DELAY: 10 ms
WRITE: 0xCC