cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine USB Data OUT end of packet

bluscape
Associate III

I'm busy with a USB to Ethernet implementation using the ST USB library and LwIP.

When I send a packet to the host (Data IN) that came from the ethernet interface, I know where is the end of an ethernet frame send a zero length packet (ZLP) accordingly.

But how do I know when it is the end of a USB packet from the host (Data OUT)? So that I can send an entire frame to the ethernet?

1 ACCEPTED SOLUTION

Accepted Solutions
bluscape
Associate III

Actually, the logic is the same as the IN transfers. A transfer is considered to be complete if one of these two conditions are detected:

  1. A transaction with less than max-packet-size bytes
  2. A full length transaction followed by a ZLP

View solution in original post

6 REPLIES 6
Pavel A.
Evangelist III

Which driver runs on the host? A "standard" CDC EEM Ethernet type? (usbnet.sys on Windows 10) or custom?

-- pa

bluscape
Associate III

Well, I'm implementing CDC ECM and windows does not have a driver for this. Unless you know of one that I can modify.

So I'm testing on an Ubtuntu VM. Still CDC ECM.

Ubuntu detects the network connection and I can ping the STM32. I've also implemented a DHCP and DNS on the STM32 but I can't get Ubuntu to get an IP from the DHCP so for now I'm giving it a static IP until the ethernet is working properly.

I chose CDC ECM because I actually want to interface the USB to iOS and Android. Apple detects the ethernet connection but I think my Android phone (Samsung) kernel version is too old or the USB implementation is not perfect.

bluscape
Associate III

Anybody?

Pavel A.
Evangelist III

Windows has in-box RNDIS driver. I don't know which model works everywhere. Try to ask on Stack Overflow.

-- pa

bluscape
Associate III

Actually, the logic is the same as the IN transfers. A transfer is considered to be complete if one of these two conditions are detected:

  1. A transaction with less than max-packet-size bytes
  2. A full length transaction followed by a ZLP
Ben K
Senior III

This example uses CDC-NCM interface: https://github.com/IntergatedCircuits/IPoverUSB