BiSS CLI Module#

LENZ BiSS Encoder Command Line Interface Module

Provides a command-line interface for interacting with LENZ BiSS encoders through the FlashTool library. Supports all major device operations including register access, command execution, and device information reading.

Features:

  • Direct register reading (single/bank/range)

  • Predefined command execution

  • Raw hex command sending

  • Serial number and device info reading

  • Comprehensive error handling

  • Sending hex files to the encoder

Usage:
>>> python -m lenz_flashtool.biss.cli <command> [arguments]
Example Commands:
>>> python -m lenz_flashtool.biss.cli run
>>> python -m lenz_flashtool.biss.cli registers 2
>>> python -m lenz_flashtool.biss.cli reg 0x02 0x10
>>> python -m lenz_flashtool.biss.cli hex 41 82 AA55FF
>>> python -m lenz_flashtool.biss.cli readserial
>>> python -m lenz_flashtool.biss.cli sendhexfile SAB039_1_1_4.hex
class lenz_flashtool.biss.cli.BiSSCommandLine(flashtool)#

Bases: object

Command line interface for BiSS encoder operations

execute_command(args)#

Execute a command provided via command-line arguments.

Supports a wide range of operations with LENZ BiSS encoders through the FlashTool backend. This function serves as the central dispatcher for interpreting CLI arguments and executing the appropriate action.

Parameters:

args (List[str]) – A list of command-line arguments (typically from sys.argv).

Return type:

None

Supported Commands:
run
  • Description: Runs the encoder or initiates default operational mode.

  • Usage: run

registers [bank]
  • Description: Reads all registers in a given bank.

  • Default bank: 2 (service bank)

  • Usage: registers # reads from bank 2

    registers 1 # reads from bank 1

reg <addr> <len>
  • Description: Reads a specific number of bytes from a register address.

  • Address and length must be in hex or decimal format.

  • Usage: reg 0x10 2 # reads 2 bytes from address 0x10

regb <bank> <addr> <len>
  • Description: Reads registers from a specific bank and address.

  • Usage: regb 1 0x10 4 # reads 4 bytes from address 0x10 in bank 1

hex <addr> <cmd> [data…]
  • Description: Sends a raw command composed of address, command byte, and optional data bytes.

  • The data is sent as-is and interpreted by the encoder.

  • Usage:

    hex 0x00 0x0B 0x10 # turns off power of first channel hex 0x40 0x82 0x11 # reads one byte from register 0x40 hex 0x40 0x82 0x1122 # reads two bytes from 0x40 and 0x41 hex 0x80 0x91 # generic command with no data

readserial
  • Description: Reads device serial number, date of manufacture, firmware version, and ID.

  • Usage: readserial

readhsi
  • Description: Reads the hardware status indicator.

  • Usage: readhsi

sendhexfile <filename>
  • Description: Sends a hex file to the encoder.

  • Usage: sendhexfile <filename.hex>

<predefined command>
  • Description: Executes a predefined command from the biss_commands registry.

  • Examples:

    run ampcalibrate reboot2bl zeroing

  • Use _show_usage() or run without arguments to list all predefined commands.

Raises:
  • ValueError – If arguments are missing or invalid.

  • FlashToolError – On communication or device interaction failure.

Notes

  • All addresses and data bytes can be in either hexadecimal (0xNN) or decimal (NN) format.

  • The method logs each step and captures errors for user-friendly CLI output.

lenz_flashtool.biss.cli.main()#

Command line entry point, making the library script executes directly: >>> python -m lenz_flashtool.biss.cli <command>