SDP Interfaces#

Connection options for SDP.

SDP UART#

UART SDP interface implementation.

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(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.SdpUSBInterface(device)#

Bases: SDPBulkProtocol

USB interface.

Initialize the SdpUSBInterface object.

Parameters:

device (UsbDevice) – The device instance

device: UsbDevice#
identifier: str = 'usb'#
classmethod get_devices()#

Get list of all supported devices from the database.

Return type:

Dict[str, List[UsbId]]

Returns:

Dictionary containing device names with their usb configurations

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