Skip to content
Benjamin Vernoux edited this page Mar 16, 2017 · 49 revisions

HydraFW Bus UART (Universal Asynchronous Receiver/Transmitter)

Bus: UART, MIDI (universal asynchronous receiver transmitter).
Connections: two pins (RX/TX) and ground.
Output types: 3.3volt normal output, or open drain
(pull-up/pull-down resistors integrated in MCU or external).
Pull-up resistors: required for open collector output mode (2K – 10K).
Maximum Voltage: 5.5volts (5volt safe).

UART is also known as the common PC serial port.
The PC serial port operates at full RS232 voltage levels
(-13volts to +13volts) though, which are not compatible with the HydraBus.

This guide is updated towards firmware release HydraFW v0.8 Beta: HydraFW (HydraBus) v0.8-beta-0-ga2aab9d 2016-10-13

Protocol configuration syntax description:

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

  • device with parameter 1 or 2 to choose UART device (1 or 2)

  • speed with integer baudrate value (support k, m suffix or no suffix)

    • UART1 Baudrate from 1281 and up to 10.5M
    • UART2 Baudrate from 640 and up to 5.25M
    • Standard UART baudrate: 2400, 4800, 9600, 19200, 38400, 57600, 115200, 31250
  • parity with parameter none or even or odd for parity value

  • stop-bits with parameter 1 or 2 for number of stop bits

  • bridge to enter USB <-> UART mode

  • exit to exit UART mode

Note default value for device 1 or 2: 
For device 1 (UART1):
> uart device 1
Note: UART parameters have been reset to default values.
Device: UART1
Speed: 9600 bps
Parity: none
Stop bits: 1

For device 2 (UART2):
> uart device 2
Note: UART parameters have been reset to default values.
Device: UART2
Speed: 9600 bps
Parity: none
Stop bits: 1

Configuration options:

Hardware Informations:

uart1> show pins
TX: PA9
RX: PA10

uart2> show pins
TX: PA2
RX: PA3

Protocol configuration example:

Configuration of UART1 9600bauds 8bits data, 1stop, no parity:

> uart device 1
Note: UART parameters have been reset to default values.
Device: UART1
Speed: 9600 bps
Parity: none
Stop bits: 1

Protocol interaction syntax description:

r or read Read one byte. (r:1…255 for bulk reads)

hd Read one byte. (hd:1…255 for bulk reads). Displays a hexdump of the result (See Hexdump guide)

w or write Followed by values to write byte(s). (w:1…255 for bulk writes)

0 Write this Octal value. Format is prefixed by a 0 (values from 000 to 077)

0b Write this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.

0x Write this HEX value. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.

0-255 Write this decimal value. Any number not preceded by 0x, or 0b is interpreted as a decimal value.

" Write an ASCII-encoded string

Write support optional repeat : (eg.: 10:1…255 for repeated write of same value 10 in this example)

space Value delimiter. Use a space to separate numbers/commands. Any combination is fine, delimiter is required between each number/command, Example: 0x1 0xff 0 10 0b11 077

& Delay 1uS. (&:1…1000000 for multiple delays)

% Delay 1mS. (%:1…1000000 for multiple delays)

Protocol interaction example usage UART1 write:

uart1> 0xFF 0 1 0x80 0x55 0xAA 0xFF 0x11:4
WRITE: 0xFF 0x00 0x01 0x80 0x55 0xAA 0xFF 0x11 0x11 0x11 0x11

Bridge mode

Hydrabus can be used as a USB to UART bridge with the bridge command :

> uart 
Device: UART1
Speed: 9600 bps
Parity: none
Stop bits: 1
uart1> bridge 
Interrupt by pressing user button.

UART baudrate and error

Example of baudrates and related error:

Extreme baudrate example:

Baudrate 10,500,000 8,400,000 6,000,000 5,250,000 4,000,000
Final baudrate 10,500,000 8,400,000 6,000,000 5,250,000 4,000,000
Error % 0.000 0.000 0.000 0.000 0.000
Baudrate 3,000,000 2,000,000 2,500,000 1,000,000 921,600
Final baudrate 3,000,000 2,000,000 2,470,588 1,000,000 923,076
Error % 0.000 0.000 1.190 0.000 0.160

Standard baudrate example:

Baudrate 460,800 250,000 230,400 115,200 57,600 38,400
Final baudrate 461538 250,000 230,136 115,226 57,613 38,408
Error % 0.160 0.000 0.110 0.030 0.030 0.030

baudrate from 33,600 to 2400 bauds 0% error

Additional informations about UART

For more details on UARTprotocol see: http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter

Tests & informations from Philippe Teuwen Wiki: http://wiki.yobi.be/wiki/HydraNFC#HydraBus_UART

Recommended USB High Speed to UART interface (for realtime data input/output using High Speed UART):

  • FTDI C32HM-DDHSL-0 (3.3V Output Level, 0.5M cable) See http://wiki.yobi.be/wiki/HydraNFC#HydraBus_UART

  • I recommend to use FTDI C32HM-DDHSL-0 cable with 6MegaBaud (8N1) settings on both side (tested with HydraBus uart1 bridge & FTDI C32HM-DDHSL-0)

  • FTDI C232HM-EDHSL-0 (5V Output Level, 0.5M cable) => Not tested

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