MCTP USB Endpoint Node Sample

Browse source code on GitHub

Overview

Sets up an MCTP endpoint node that listens for messages from the MCTP bus owner with EID 20. Responds with “Hello, bus owner” message.

Requirements

A board and SoC that provide support for USB device capability (either FS or HS, though DMTF spec specifies only HS). Testing requires a USB host that has the ability to enumerate the MCTP interface and interact with the board using the MCTP protocol. An easy way to do this is a Python script.

An example script to test this interface is provided with this sample application. To run the script, you must first install pyusb.

pip install requirements.txt
python usb_host_tester.py

If the test is successful, you will see the following output from the script:

Sending message with size smaller than USB FS MPS (<64b)
Received: b'\x1a\xb4\x00\x15\x01\x14\n\xc0Hello, bus owner\x00'
Sending message spanning two USB FS packets (>64b)
Received: b'\x1a\xb4\x00\x15\x01\x14\n\xc0Hello, bus owner\x00'
Sending message with two MCTP messages in a single USB FS packet
Received: b'\x1a\xb4\x00\x15\x01\x14\n\xc0Hello, bus owner\x00'
Received: b'\x1a\xb4\x00\x15\x01\x14\n\xc0Hello, bus owner\x00'

Wiring

Connect a USB cable between the host (likely a PC) and the board. The type of cable (mini, micro, type C) depends on the host and board connectors.

Building and Running

west build -b frdm_mcxn947_mcxn947_cpu0 samples/subsys/pmci/mctp/usb_endpoint
west build -t run

References

MCTP Base Specification 2019

See also

USB device core API