Skip to content

Bus interaction commands

Benjamin Vernoux edited this page Oct 5, 2019 · 12 revisions

Combining commands

All commands have to be delimited with spaces.

Since 19c2fbdd497cc81731aa198a025d15cf8025e3dc it is possible to skip the spaces between tokens

Compressed mode (allows no space between commands) example:

Example1:

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

Example2:

spi1> [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:
spi1> "a"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
  • Output of the spi compressed command:
Invalid command.
"a ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ]]]]]]]]]]]]]]]]]]
-------------------------------------------------------------------------------------------------------------^
  • We see internally it decompress the commands ] and add space and so we see it exceed max line length in that case it is why it returns Invalid command and show where is the max.

Example

spi1> [ 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

spi1> read read
READ: 0xFF
READ: 0xFF

spi1> r:5
READ: 0xFF 0xFF 0xFF 0xFF 0xFF 
spi1>

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

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

spi1> write 0xcc
WRITE: 0xCC

Multiple writes

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

Example

spi1> 0x55:5
WRITE: 0x55 0x55 0x55 0x55 0x55 
spi1> 0xcc:0xc
WRITE: 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 0xCC 
spi1> 

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

spi1> 0b1010101
WRITE: 0x55

spi1> 0b11001100
WRITE: 0xCC

Write hexadecimal value : 0x

To write an hexadecimal value, prefix it with 0x

Values range from 0x0 to 0xff

Examples

spi1> 0x55
WRITE: 0x55

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

spi1> 85
WRITE: 0x55

spi1> 204
WRITE: 0xCC

Write octal value : 0

To write an octal value, prefix it with 0

Values range from 00 to 0377

Examples

spi1> 0125
WRITE: 0x55

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

spi1> ~ ~
WRITE: 0x8C 0xAE 

spi1> ~: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

spi1> "Hello"           
WRITE: 0x48 0x65 0x6C 0x6C 0x6F 

spi1> "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

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

Delay miliseconds : %

Delay can be repeated using the :<int> suffix

Example

spi1> 0x55 %:10 0xcc
WRITE: 0x55
DELAY: 10 ms
WRITE: 0xCC

How to Flash/Use HydraFW

How to Build/Flash/Use HydraFW

Developer Getting-Started with HydraBus and STM32CubeIDE

Hardware

Firmware (hydrafw) performances

Firmware (hydrafw) Application guides

Firmware (hydrafw) guides

How to Help

Clone this wiki locally