Skip to content

Commit 9573498

Browse files
committed
Add fix for USB CDC ECM example
Additional delay is required to setup usb device before starting transmission.
1 parent ce5a550 commit 9573498

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

APIs_USB/USBCDC_ECM/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
The example sends an Ethernet frame that carries "Hello world" payload with a custom EtherType to the host PC. You can capture the frame by using a program called "Wireshark":
44

55
1. Flash the board, and ensure the target's USB is plugged into the PC.
6-
2. Open Wireshark.
7-
3. Click **Capture > Options** to select the correct capture interface.
8-
4. Click **Capture > Start**.
9-
5. Click captured packet from source address 12:34:56:78:9a:bc to see the "Hello world" payload.
6+
2. Use `dmesg -w` linux command to determine address of the USB CDC Ethernet device.
7+
3. Use `ifconfig` linux command to determine interface related to the the USB CDC Ethernet device.
8+
4. Open Wireshark.
9+
5. Click **Capture > Options** to select the correct capture interface.
10+
6. Click **Capture > Start**.
11+
7. Click captured packet from source address 12:34:56:78:9a:bc to see the "Hello world" payload.
1012

11-
**Note:** Because Windows doesn't provide native support for the USB CDC-ECM model, you must use third party drivers to use this class on Windows.
13+
**Note:** Because Windows doesn't provide native support for the USB CDC-ECM model, you must use third party drivers to use this class on Windows. It is suggested to run this example on Linux.

APIs_USB/USBCDC_ECM/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ USBCDC_ECM ecm;
2020

2121
int main()
2222
{
23+
// Let the USB device to setup
24+
ThisThread::sleep_for(10);
25+
26+
// Send "Hello world" packets in loop
2327
while (true) {
2428
ecm.send((uint8_t *)&packet, sizeof(packet));
2529
ThisThread::sleep_for(1000);

0 commit comments

Comments
 (0)