MBoot Interfaces

Contents

MBoot Interfaces#

Module implementing the Mboot communication protocol.

MBoot UART#

UART Mboot interface implementation.

class spsdk.mboot.interfaces.uart.ScanArgs(port, baudrate)#

Bases: object

Scan arguments dataclass.

port: Optional[str]#
baudrate: Optional[int]#
classmethod parse(params)#

Parse given scanning parameters into ScanArgs class.

Parameters:

params (str) – Parameters as a string

Return type:

Self

class spsdk.mboot.interfaces.uart.MbootUARTInterface(device)#

Bases: MbootSerialProtocol

UART interface.

Initialize the MbootUARTInterface object.

Parameters:

device (SerialDevice) – The device instance

default_baudrate = 57600#
device: SerialDevice#
identifier: str = 'uart'#
classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected UART devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Timeout for the scan

Return type:

List[Self]

Returns:

list of matching RawHid devices

classmethod scan(port=None, baudrate=None, timeout=None)#

Scan connected UART devices.

Returns list of serial ports with devices that respond to PING command. If ‘port’ is specified, only that serial port is checked If no devices are found, return an empty list.

Parameters:
  • port (Optional[str]) – name of preferred serial port, defaults to None

  • baudrate (Optional[int]) – speed of the UART interface, defaults to 56700

  • timeout (Optional[int]) – timeout in milliseconds, defaults to 5000

Return type:

List[Self]

Returns:

list of interfaces responding to the PING command

MBoot USB#

USB Mboot interface implementation.

class spsdk.mboot.interfaces.usb.ScanArgs(device_id)#

Bases: object

Scan arguments dataclass.

device_id: str#
classmethod parse(params)#

Parse given scanning parameters into ScanArgs class.

Parameters:

params (str) – Parameters as a string

Return type:

Self

class spsdk.mboot.interfaces.usb.MbootUSBInterface(device)#

Bases: MbootBulkProtocol

USB interface.

Initialize the MbootUSBInterface object.

Parameters:

device (UsbDevice) – The device instance

identifier: str = 'usb'#
device: UsbDevice#
usb_devices = {'IMXRT': (8137, 309), 'LPC55': (8137, 33), 'LPC551x': (8137, 34), 'LPC553x': (8137, 37), 'LPC55xx': (8137, 32), 'MCXA1xx': (8137, 341), 'MCXN23x': (8137, 344), 'MCXN9xx': (8137, 335), 'MKL27': (5538, 115), 'MXRT20': (5538, 115), 'MXRT50': (5538, 115), 'MXRT60': (5538, 115), 'RT5xx': (8137, 35), 'RT5xx_A': (8137, 32), 'RT5xx_B': (8137, 35), 'RT5xx_C': (8137, 35), 'RT6xx': (8137, 33), 'RT6xxM': (8137, 36)}#
property name: str#

Get the name of the device.

classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected USB devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Timeout for the scan

Return type:

List[Self]

Returns:

list of matching RawHid devices

classmethod scan(device_id=None, timeout=None)#

Scan connected USB devices.

Parameters:
  • device_id (Optional[str]) – Device identifier <vid>, <vid:pid>, device/instance path, device name are supported

  • timeout (Optional[int]) – Read/write timeout

Return type:

List[Self]

Returns:

list of matching RawHid devices

MBoot USBSIO#

USBSIO Mboot interface implementation.

class spsdk.mboot.interfaces.usbsio.MbootUsbSioI2CInterface(device)#

Bases: MbootSerialProtocol

USBSIO I2C interface.

Initialize the UsbSioI2CDevice object.

Parameters:

device (UsbSioI2CDevice) – The device instance

device: UsbSioI2CDevice#
identifier: str = 'usbsio_i2c'#
classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected USBSIO devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Timeout for the scan

Return type:

List[Self]

Returns:

list of matching RawHid devices

classmethod scan(config=None, timeout=5000)#

Scan connected USB-SIO bridge devices.

Parameters:
  • config (Optional[str]) – Configuration string identifying spi or i2c SIO interface and could filter out USB devices

  • timeout (int) – Read timeout in milliseconds, defaults to 5000

Return type:

List[Self]

Returns:

List of interfaces

class spsdk.mboot.interfaces.usbsio.MbootUsbSioSPIInterface(device)#

Bases: MbootSerialProtocol

USBSIO I2C interface.

Initialize the UsbSioSPIDevice object.

Parameters:

device (UsbSioSPIDevice) – The device instance

FRAME_START_NOT_READY_LIST = [0, 255]#
device: UsbSioSPIDevice#
identifier: str = 'usbsio_spi'#
classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected USBSIO devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Timeout for the scan

Return type:

List[Self]

Returns:

list of matching RawHid devices

classmethod scan(config=None, timeout=5000)#

Scan connected USB-SIO bridge devices.

Parameters:
  • config (Optional[str]) – Configuration string identifying spi or i2c SIO interface and could filter out USB devices

  • timeout (int) – Read timeout in milliseconds, defaults to 5000

Return type:

List[Self]

Returns:

List of interfaces

MBoot SDIO#

Sdio Mboot interface implementation.

class spsdk.mboot.interfaces.sdio.ScanArgs(device_path)#

Bases: object

Scan arguments dataclass.

device_path: str#
classmethod parse(params)#

Parse given scanning parameters into ScanArgs class.

Parameters:

params (str) – Parameters as a string

Return type:

Self

class spsdk.mboot.interfaces.sdio.MbootSdioInterface(device)#

Bases: MbootSerialProtocol

Sdio interface.

Initialize the MbootSdioInterface object.

Parameters:

device (SdioDevice) – The device instance

identifier: str = 'sdio'#
device: SdioDevice#
sdio_devices = {'RW61x': (1137, 521)}#
property name: str#

Get the name of the device.

Returns:

Name of the device.

classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected USB devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Interface timeout

Return type:

List[Self]

Returns:

list of matching RawHid devices

classmethod scan(device_path, timeout=None)#

Scan connected SDIO devices.

Parameters:
  • device_path (str) – device path string

  • timeout (Optional[int]) – Interface timeout

Return type:

List[Self]

Returns:

matched SDIO device

open()#

Open the interface.

Return type:

None

read(length=None)#

Read data on the IN endpoint associated to the HID interface.

Return type:

Union[CmdResponse, bytes]

Returns:

Return CmdResponse object.

Raises:

MBoot BUSPAL#

Buspal Mboot device implementation.

class spsdk.mboot.interfaces.buspal.ScanArgs(port, props)#

Bases: object

Scan arguments dataclass.

port: Optional[str]#
props: Optional[List[str]]#
classmethod parse(params, extra_params=None)#

Parse given scanning parameters and extra parameters into ScanArgs class.

Parameters:
  • params (str) – Parameters as a string

  • extra_params (Optional[str]) – Optional extra parameters as a string

Return type:

Self

class spsdk.mboot.interfaces.buspal.SpiModeCommand(value)#

Bases: Enum

Spi mode commands.

exit = 0#
version = 1#
chip_select = 2#
sniff = 12#
bulk_transfer = 16#
config_periph = 64#
set_speed = 96#
config_spi = 128#
write_then_read = 4#
class spsdk.mboot.interfaces.buspal.SpiConfigShift(value)#

Bases: Enum

Spi configuration shifts for the mask.

direction = 0#
phase = 1#
polarity = 2#
class spsdk.mboot.interfaces.buspal.SpiClockPolarity(value)#

Bases: Enum

SPI clock polarity configuration.

active_high = 0#
active_low = 1#
class spsdk.mboot.interfaces.buspal.SpiClockPhase(value)#

Bases: Enum

SPI clock phase configuration.

first_edge = 0#
second_edge = 1#
class spsdk.mboot.interfaces.buspal.SpiShiftDirection(value)#

Bases: Enum

SPI clock phase configuration.

msb_first = 0#
lsb_first = 1#
class spsdk.mboot.interfaces.buspal.SpiConfiguration#

Bases: object

Dataclass to store SPI configuration.

speed: int#
polarity: SpiClockPolarity#
phase: SpiClockPhase#
direction: SpiShiftDirection#
class spsdk.mboot.interfaces.buspal.BBConstants(value)#

Bases: Enum

Constants.

reset_count = 20#
response_ok = 1#
bulk_transfer_max = 4096#
packet_timeout_ms = 10#
class spsdk.mboot.interfaces.buspal.Response(value)#

Bases: str, Enum

Response to enter bit bang mode.

BITBANG = 'BBIO1'#
SPI = 'SPI1'#
I2C = 'I2C1'#
class spsdk.mboot.interfaces.buspal.BuspalMode(value)#

Bases: Enum

Bit Bang mode command.

RESET = 0#
SPI = 1#
I2C = 2#
class spsdk.mboot.interfaces.buspal.MbootBuspalProtocol(device)#

Bases: MbootSerialProtocol

Mboot Serial protocol.

Initialize the MbootBuspalProtocol object.

Parameters:

device (SerialDevice) – The device instance

default_baudrate = 57600#
default_timeout = 5000#
device: SerialDevice#
mode: BuspalMode#
open()#

Open the interface.

Return type:

None

classmethod scan(port=None, props=None, timeout=None)#

Scan connected serial ports and set BUSPAL properties.

Returns list of serial ports with devices that respond to BUSPAL communication protocol. If ‘port’ is specified, only that serial port is checked If no devices are found, return an empty list.

Parameters:
  • port (Optional[str]) – name of preferred serial port, defaults to None

  • timeout (Optional[int]) – timeout in milliseconds

  • props (Optional[List[str]]) – buspal target properties

Return type:

List[SerialDevice]

Returns:

list of available interfaces

class spsdk.mboot.interfaces.buspal.MbootBuspalSPIInterface(device)#

Bases: MbootBuspalProtocol

BUSPAL SPI interface.

Initialize the BUSPAL SPI interface.

Parameters:
  • port – name of the serial port, defaults to None

  • timeout – read/write timeout in milliseconds

TARGET_SETTINGS = ['speed', 'polarity', 'phase', 'direction']#
HDR_FRAME_RETRY_CNT = 3#
ACK_WAIT_DELAY = 0.01#
device: SerialDevice#
identifier: str = 'buspal_spi'#
classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected Buspal devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Timeout for the scan

Return type:

List[Self]

Returns:

list of matching RawHid devices

class spsdk.mboot.interfaces.buspal.I2cModeCommand(value)#

Bases: Enum

I2c mode commands.

exit = 0#
version = 1#
start_bit = 2#
stop_bit = 3#
read_byte = 4#
ack_bit = 6#
nack_bit = 7#
bus_sniff = 15#
bulk_write = 16#
configure_periph = 64#
pull_up_select = 80#
set_speed = 96#
set_address = 112#
write_then_read = 8#
class spsdk.mboot.interfaces.buspal.MbootBuspalI2CInterface(device)#

Bases: MbootBuspalProtocol

BUSPAL I2C interface.

Initialize the BUSPAL I2C interface.

Parameters:
  • port – name of the serial port, defaults to None

  • timeout – read/write timeout in milliseconds

TARGET_SETTINGS = ['speed', 'address']#
HDR_FRAME_RETRY_CNT = 3#
device: SerialDevice#
identifier: str = 'buspal_i2c'#
classmethod scan_from_args(params, timeout, extra_params=None)#

Scan connected Buspal devices.

Parameters:
  • params (str) – Params as a configuration string

  • extra_params (Optional[str]) – Extra params configuration string

  • timeout (int) – Timeout for the scan

Return type:

List[Self]

Returns:

list of matching RawHid devices