SDP Interfaces#

Connection options for SDP.

SDP UART#

UART SDP interface implementation.

class spsdk.sdp.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.sdp.interfaces.uart.SdpUARTInterface(device)#

Bases: SDPSerialProtocol

UART interface.

Initialize the SdpUARTInterface object.

Parameters:

device (SerialDevice) – The device instance

default_baudrate = 115200#
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 serial ports.

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

SDP USB#

USB SDP interface implementation.

class spsdk.sdp.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.sdp.interfaces.usb.SdpUSBInterface(device)#

Bases: SDPBulkProtocol

USB interface.

Initialize the SdpUSBInterface object.

Parameters:

device (UsbDevice) – The device instance

usb_devices = {'MX6DQP': (5538, 84), 'MX6SDL': (5538, 97), 'MX6SL': (5538, 99), 'MX6SLL': (5538, 296), 'MX6SX': (5538, 113), 'MX6UL': (5538, 125), 'MX6ULL': (5538, 128), 'MX7SD': (5538, 118), 'MX7ULP': (8137, 294), 'MX815': (8137, 318), 'MX865': (8137, 326), 'MX8MQ': (8137, 299), 'MX8QM': (8137, 297), 'MX8QM-A0': (8137, 297), 'MX8QXP': (8137, 303), 'MX8QXP-A0': (8137, 125), 'MX91': (8137, 334), 'MX93': (8137, 334), 'MX95': (8137, 349), 'MXRT20': (8137, 304), 'MXRT50': (8137, 304), 'MXRT60': (8137, 309), 'VYBRID': (5538, 106)}#
device: UsbDevice#
identifier: str = 'usb'#
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

SDP Protocol#

SDP protocol base.

class spsdk.sdp.protocol.base.SDPProtocolBase(device)#

Bases: ProtocolBase

SDP protocol base class.

Initialize the MbootSerialProtocol object.

Parameters:

device (DeviceBase) – The device instance

configure(config)#

Configure device.

Parameters:

config (dict) – parameters dictionary

Return type:

None

expect_status = True#

SDP Bulk#

SDP bulk implementation.

class spsdk.sdp.protocol.bulk_protocol.SDPBulkProtocol(device)#

Bases: SDPProtocolBase

SDP Bulk protocol.

Initialize the MbootSerialProtocol object.

Parameters:

device (DeviceBase) – The device instance

close()#

Close the interface.

Return type:

None

configure(config)#

Set HID report data.

Parameters:

config (dict) – parameters dictionary

Return type:

None

property is_opened: bool#

Indicates whether interface is open.

open()#

Open the interface.

Return type:

None

read(length=None)#

Read data from device.

Return type:

CmdResponse

Returns:

read data

write_command(packet)#

Encapsulate command into frames and send them to device.

Parameters:

packet (CmdPacketBase) – Command packet object to be sent

Raises:

SPSDKAttributeError – Command packed contains no data to be sent

Return type:

None

write_data(data)#

Encapsulate data into frames and send them to device.

Parameters:

data (bytes) – Data to be sent

Return type:

None

SDP Serial#

SDP serial implementation.

class spsdk.sdp.protocol.serial_protocol.SDPSerialProtocol(device)#

Bases: SDPProtocolBase

SDP Serial protocol.

Initialize the MbootSerialProtocol object.

Parameters:

device (DeviceBase) – The device instance

close()#

Close the interface.

Return type:

None

property is_opened: bool#

Indicates whether interface is open.

open()#

Open the interface.

Return type:

None

read(length=None)#

Read data from device.

Return type:

CmdResponse

Returns:

read data

write_command(packet)#

Encapsulate command into frames and send them to device.

Parameters:

packet (CmdPacketBase) – Command packet object to be sent

Raises:

SPSDKAttributeError – Command packed contains no data to be sent

Return type:

None

write_data(data)#

Encapsulate data into frames and send them to device.

Parameters:

data (bytes) – Data to be sent

Return type:

None