UART Multiplexing

Experimental V1 firmware documentation. Koheron products currently ship with V0.x firmware by default. V1 firmware executables are not publicly available yet. Please contact us if you are interested in early access or would like to evaluate V1 on your device.

UART multiplexing lets several controllers share one UART communication link. When multiplexing is enabled, a controller only executes commands that are addressed to it, or broadcast commands.

This mode is controlled by muxon and bdid.

When to use it

Use UART multiplexing when several controllers are connected to the same serial bus and the host needs to address them individually.

Do not enable it for a normal one-controller USB serial connection unless your software is prepared to send addressed commands.

Configure the board ID

bdid reads or writes the decimal board ID:

>> bdid
1
>> bdid 2
2

Writing bdid requires advanced access. The board ID is saved by the UART configuration path.

The board ID is independent of the serial number. Use whichever addressing form is more convenient for your system.

Enable multiplexing

Read the current state:

>> muxon
0

Enable addressed mode:

>> muxon 1
1

Disable addressed mode:

>> muxon 0
0

Writing muxon requires advanced access. The value is saved by the UART configuration path.

After muxon 1, the normal prompt is suppressed and plain commands are ignored. Your host software must switch to addressed commands immediately.

Address by board ID

Use this form to address a decimal board ID:

@1 version
V1.x
@2 err
0
@3 rtset
10000.000

There must be at least one space or tab after the decimal address. The controller strips the address header before executing the command.

Address by serial number

Use this form to address a controller by serial number:

@SN12345 version
V1.x
@sn12345 err
0

The SN prefix is case-insensitive. There must be at least one space or tab after the serial number.

Broadcast commands

Use @* to broadcast a command to every controller on the link:

@* errclr

Broadcast commands execute silently. Controllers do not return replies for broadcast commands. Use broadcast only for commands where no response is needed.

Ignored commands

When muxon is enabled:

  • plain unaddressed commands are ignored;
  • commands addressed to another board ID are ignored;
  • commands addressed to another serial number are ignored;
  • malformed address headers are ignored because they do not produce a valid addressed command.

Ignored commands are dropped silently and do not redraw the prompt.

Replies and prompt behavior

In single-controller mode, the firmware echoes characters and prints the >> prompt. In multiplexed mode, the prompt is suppressed. Commands addressed to the controller still return the command response, but there is no prompt delimiter.

Host software should read the expected response for the command it sent, rather than waiting for >>.

For text commands in multiplexed mode:

def mux_query_line(ser, address, command):
    ser.write((address + " " + command + "\r\n").encode("ascii"))
    ser.flush()
    return ser.readline().decode("ascii", errors="replace").strip()

print(mux_query_line(ser, "@1", "version"))
print(mux_query_line(ser, "@SN12345", "err"))

For binary commands, read the exact number of bytes expected for the addressed command.

Recovery

If you accidentally enable multiplexing on a single controller, send an addressed command using either the board ID or serial number:

@1 muxon 0
0
@SN12345 muxon 0
0

If the board ID and serial number are unknown, use a broadcast disable command:

@* muxon 0

The broadcast form does not reply, so reconnect or send a plain command afterward to confirm that normal mode is restored.

[email protected]