Skip to content

USB Overflow problem for continuous transfer with solution (set packet_size to multiple of 512) #2

Description

@west-rynes

David: Thanks again for the great work on this package!

I ran into an issue when trying to stream data from our USB 1608GX device. When calling code to get continuous data I would get a USB Overflow Error (sample code shown below).

dev.start_continuous_transfer(rate_hz, 1000, packet_size=packet_size)  
dev.send_message("AISCAN:START")
while True:
    data = dev.get_new_bulk_data(wait=True)  # ERROR HERE: USBError: [Errno 84] Overflow

The fix for this is that the packet_size needs to be in multiples of 512. If I manually set the packet size to:

  packet_size = X (where X is some integer multiple of 512 that you want)
  dev.start_continuous_transfer(rate_hz, 1000, packet_size=packet_size)  

then it works! In your module code for start_continuous_transfer you appear to be setting the packet size based on multiples of 64.

This reference I found indicated that the packet sizes must be multiples of 512: http://libusb.sourceforge.net/api-1.0/packetoverflow.html

I have also noticed that if I try to stream data at rates beyond 100kHz for our 1608GX it stops after a bit. I've seen this with the .NET library from measurement computing and with your code. The 1608GX is supposed to go up to 500kHz. I think their devices can't stream long term as fast as they claim. I've had to tune the speed down to get it to work in a stable manner.

-Anthony

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions