Skip to main content
kristoffer
Associate
May 11, 2015
Question

STM32L152 Usb transfer length > 64

  • May 11, 2015
  • 2 replies
  • 759 views
Posted on May 11, 2015 at 17:18

I am as the title is trying to suggest attempting to transfer a large packet over an usb endpoint. I am using bulk-transfer and have modified code from the Virtual comport example to neatly package my buffer into 64 bytes packages and then transfer them. However on the host-system (linux) my packages are received as independent 64 bytes frames, which then generates errors.

So my question is, can i change my settings somewhere so that if i have for example 134 bytes package that needs to be transmitted, then i would send them 64 bytes then 64 bytes then 6 bytes. And have them reaseembled into the 134 bytes usb frame that i want?

for clarification i am trying to send a 134 bytes ethernet frame to the cdc_eem driver found at 

http://lxr.free-electrons.com/source/drivers/net/usb/cdc_eem.c?v=3.16

but i keep erroring out at line 287. because the skb->len is 64 and my package is 134 bytes. (I recompiled the linux kernel and added print messages)

kindly help or suggest where to turn, i have been trying for long now. 

- Kristoffer

    This topic has been closed for replies.

    2 replies

    Lutz.Tilo
    Associate
    May 12, 2015
    Posted on May 12, 2015 at 14:40

    134byte packages are violating usb standard. Sometimes it works, sometimes not.

    http://www.beyondlogic.org/usbnutshell/usb4.shtml#Bulk

    kristoffer
    Associate
    May 12, 2015
    Posted on May 12, 2015 at 15:35

    I solved it, i wasnt sending my 64 bytes that i thought i was, my processor did so much between usb polls so that it did not have time to fill 64 bytes into usb buffer with my implementation.

    When i changed it so that the frimware sends 64 bytes + 64 bytes + 6 bytes in succession, the program works. At least the sending part.