BiSS Module#
LENZ BiSS Protocol Implementation
Provides BiSS encoder protocol standarts and utilities.
- Author:
LENZ ENCODERS, 2020-2025
- class lenz_flashtool.biss.BiSSBank(*values)#
Bases:
IntEnum
Enumeration of BiSS C encoder register indices and banking constants.
Defines indices for programmable registers (0-63), fixed-address registers (64-127), and constants for the banking system. Each constant represents either a register index or a size/bank definition used for device configuration, operation, and data access.
- BANKS_PER_PAGE = 32#
Number of banks per page.
- Type:
int
- BISS_BANK_SERV = 2#
Service bank index.
- Type:
int
- BISS_USERBANK_END = 37#
End index of user banks.
- Type:
int
- BISS_USERBANK_START = 5#
Start index of user banks.
- Type:
int
- BOOTLOADER_VER_REG_INDEX = 108#
Bootloader version register index.
- Type:
int
- BOOTLOADER_VER_SIZE = 4#
Bootloader version size in bytes.
- Type:
int
- BSEL_REG_INDEX = 64#
Bank select register index.
- Type:
int
- CMD_REG_INDEX = 72#
Command register index - 2 bytes.
- Type:
int
- CMD_STATE_FLAG_REG_INDEX = 97#
Command state flag register index.
- Type:
int
- CRC32_REG_INDEX = 12#
Index for the CRC32 register for data integrity checks while programming.
- Type:
int
- CRC_ARRAY_REG_INDEX = 24#
CRC array programming register index.
- Type:
int
- DEVID_CRC_REG_INDEX = 27#
Device ID CRC programming register index.
- Type:
int
- DEVID_H_REG_INDEX = 58#
Higher part of device ID programming register index.
- Type:
int
- DEVID_L_REG_INDEX = 54#
Lower part of device ID programming register index.
- Type:
int
- DEV_ID_H_REG_INDEX = 120#
Device ID (high part) register index.
- Type:
int
- DEV_ID_H_SIZE = 4#
Device ID (high part) size in bytes.
- Type:
int
- DEV_ID_L_REG_INDEX = 124#
Device ID (low part) register index.
- Type:
int
- DEV_ID_L_SIZE = 2#
Device ID (low part) size in bytes.
- Type:
int
- DEV_SN_REG_INDEX = 68#
Device serial number index.
- Type:
int
- DEV_SN_SIZE = 4#
Device serial number size in bytes.
- Type:
int
- ENC_DATA_REG_INDEX = 74#
Encoder data register index (calibration state, temperature, Vcc, Signal Mod).
- Type:
int
- FIRSTHARMAMP_REG_INDEX = 80#
First harmonic amplitude register index.
- Type:
int
- FIRSTHARMANGLE_REG_INDEX = 82#
First harmonic angle register index.
- Type:
int
- FIXED_ADDRESSES_START_INDEX = 64#
Start index of fixed address registers.
- Type:
int
- FIXED_BANK_SIZE = 64#
Fixed bank size in bytes.
- Type:
int
- KEY_CRC_REG_INDEX = 26#
Key CRC programming register index.
- Type:
int
- KEY_REG_INDEX = 28#
Key programming register index.
- Type:
int
- MFG_ID_SIZE = 2#
Manufacturer ID size in bytes.
- Type:
int
- MFG_REG_INDEX = 116#
Manufacturing date register index.
- Type:
int
- MFG_REG_SIZE = 4#
Manufacturer date register size in bytes.
- Type:
int
- MFR_ID_REG_INDEX = 126#
Manufacturer ID register index.
- Type:
int
- NONCE_REG_INDEX = 0#
Index for the nonce register while programming.
- Type:
int
- PAGENUM_REG_INDEX = 24#
Page number programming register index.
- Type:
int
- PRODDATE_REG_INDEX = 20#
Index for the production date programming register.
- Type:
int
- PROGVER_REG_INDEX = 112#
Program version register index.
- Type:
int
- PROGVER_REG_SIZE = 4#
Program version size in bytes.
- Type:
int
- REGISTER_PLUS_BSEL_SIZE = 65#
Size of each bank in bytes (64) plus BSEL reg size (1) (data + bank number).
- Type:
int
- REGISTER_PLUS_FIXED_BANK_SIZE = 128#
Register bank (64) and Fixed Addresses (64) size.
- Type:
int
- REV_RES_REG_INDEX = 84#
Revolution and resolution register index.
- Type:
int
- SERIALNUM_CRC_REG_INDEX = 25#
Serial number CRC programming register index.
- Type:
int
- SERIALNUM_REG_INDEX = 16#
Index for the serial number programming register.
- Type:
int
- SHIFT_REG_INDEX = 85#
Shift register index (3 bytes for 180° shift).
- Type:
int
- STATE_FLAG_REG_INDEX = 98#
State flag register index.
- Type:
int
- lenz_flashtool.biss.biss_crc6_calc(data)#
Calculate the BiSS C CRC6 checksum for a 32-bit data word.
- Parameters:
data (int) – A 32-bit integer representing the data for which to calculate the CRC6 checksum.
- Returns:
The calculated 6-bit CRC checksum.
- Return type:
int
- lenz_flashtool.biss.interpret_biss_commandstate(state_int)#
Interpret a given integer as a BiSS command state.
- Parameters:
state_int (int) – An integer representing the current command state.
- Returns:
- A list containing the description of the current command state.
If the state is not recognized, returns [“Unknown state”].
- Return type:
List[str]
- lenz_flashtool.biss.interpret_error_flags(error_int)#
Interpret a given integer as a set of error flags.
- Parameters:
error_int (int) – An integer where each bit represents a different error flag.
- Returns:
- A list of active error flags based on the set bits in the input integer.
If no flags are set, returns [“No error flags set”].
- Return type:
List[str]