Skip to content

HydraFW HydraNFC v2 guide dnfc Bus interaction commands

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

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

Combining commands

All commands have to be delimited with spaces.

Compressed mode (allows no space between commands) example:

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

Compressed mode (allow no space between commands) constraint:

  • 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

Example non compressed mode

dnfc2> [ 0x1 0xff 0 10 0b11 077 ]
/CS ENABLED
WRITE: 0x01 0xFF 0x00 0x0A 0x03 0x3F 
/CS DISABLED

Read bytes

r or read

Read one byte on the selected bus.

When applicable (in SPI mode for instance), Hydrabus will send 0xff while reading

Suffix command with :<int> to read <int> bytes up to 255.

Examples

dnfc2> read read
READ: 0xFF
READ: 0xFF

dnfc2> r:5
READ: 0xFF 0xFF 0xFF 0xFF 0xFF 
dnfc2>

hd

Read one byte and display value in hexdump format.

When applicable (in SPI mode for instance), Hydrabus will send 0xff while reading

Suffix command with :<int> to read <int> bytes up to 4294967295.

See Hexdump guide for more information.

Example

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  |  ................ 

Write bytes

w or write

Followed by values to write byte(s).

This command is fully optional and can be omitted.

Example

dnfc2> write 0xcc
WRITE: 0xCC

dnfc2> w 0xcc
WRITE: 0xCC

Multiple writes

Each value can be written multiple times by using the :<int> suffix to write <int> bytes.

Example

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> 

Write modes

Write binary value : 0b

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

Examples

dnfc2> 0b1010101
WRITE: 0x55

dnfc2> 0b11001100
WRITE: 0xCC

Write hexadecimal value : 0x

To write an hexadecimal value, prefix it with 0x

Values range from 0x0 to 0xff

Examples

dnfc2> 0x55
WRITE: 0x55

dnfc2> 0xcc
WRITE: 0xCC

Write decimal value

To write a decimal value, just write it without any leading data.

Values range from 0 to 255

Examples

dnfc2> 85
WRITE: 0x55

dnfc2> 204
WRITE: 0xCC

Write octal value : 0

To write an octal value, prefix it with 0

Values range from 00 to 0377

Examples

dnfc2> 0125
WRITE: 0x55

dnfc2> 0314
WRITE: 0xCC

Write random byte : ~

Repeating the command will generate a new random value, but using the repeat suffix will reuse the same byte.

Examples

dnfc2> ~ ~
WRITE: 0x8C 0xAE 

dnfc2> ~:2
WRITE: 0x6B 0x6B

Write ASCII strings: "

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.

Examples

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

Timing and delays

Delay microseconds : &

Delay can be repeated using the :<int> suffix

Due to timing constraints, the microseconds will not be displayed in the CLI.

Example

dnfc2> 0x55 &:10 0xcc
WRITE: 0x55
WRITE: 0xCC

Delay miliseconds : %

Delay can be repeated using the :<int> suffix

Example

dnfc2> 0x55 %:10 0xcc
WRITE: 0x55
DELAY: 10 ms
WRITE: 0xCC
Clone this wiki locally