Jump to content
IGNORED

Anyone design/program USB?


supercat

Recommended Posts

I'm trying to design a 4A50 programmer and would like to use a CY8C24894 as a USB HID-class device. I think I have things pretty much working, but even though I've set the endpoint latencies in the device descriptor to 1, the thing is still limited to one packet every 2ms (the limit should be one packet every ms). Does anyone have experience working with such things?

 

I started out with the 'buttons and lights' demo in Cypress' application note AN2298 but added code to use an interrupt-OUT endpoint rather than using control transfers for output. When a packet is received, it will update a byte on an LCD display and will then send 0-15 packets in response (based upon bits 0-3 of the first byte of the received packet). What is necessary to get maximum throughput, and is it possible to use more than one endpoint for input or output to boost speed further?

 

Thanks for any assistance.

Link to comment
Share on other sites

How do's,

 

I've got some experience, but mainly with the FX2LP family. They're somewhat different as they're all digital, Fast or High, only provide for a generic driver (instead of the class drivers like HID, etc.), operate at Fast or High speed and they use the c-coded FrameWorks to do most of the hard work in setting up and managing the USB. I'm not sure off-hand how much the CY8C24894 USB differs ... we'll see ...

 

Please excuse me if some of the questions seem dumb or insulting; it's not intentional, I've just got little information to go on or I'm thinking of the FX2LP equivalent.

 

Right, you've changed the descriptors, so the PC/Host knows what the end-points should be doing. Have you made sure the Peripheral is correctly configuring the endpoints themselves? The descriptors only tell the PC/Host about the endpoints, they don't set up the Peripheral's endpoints. After that, I suppose there's the ever-present problems with real-time stuff; is the Peripheral completing all necessary tasks within the 1ms between packets? And finally, is the Peripheral code timer- or interrupt-based; differences between clocks mean using interrupt-based programming is essential - a timer-based method will likely miss some packets and have to wait until the next timer period.

 

What kind of "maximum throughput" and "speed" are you after?:

 

Throughput on any one endpoint is limited by the minimum time between packets and maximum packet size. For maximum throughput you need the smallest interval between packets and the largest packet size. For a Fast-speed Interrupt endpoint, that means 1ms with 64B packets ~ 64kBps. It's a meaty document, but the USB 2.0 specifications from www.usb.org has details on the limits for the different endpoint types in "Chapter 5: USB Data Flow Model: <endpoint type> Transfers".

 

"Speed" in terms of bandwidth can likely be increased using multiple end-points, though you'd have to code handling which end-points're used for what. "Speed" in terms of latency is not likely to be helped using multiple end-points. It _might_, but the Host decides the ordering of data transfers; it could well process two endpoints straight after each other or neatly 0.5ms apart in the 1ms cycle - there's no way for the Peripheral to control this.

 

Btw, was there a particular reason for picking a PSoc?

Link to comment
Share on other sites

I've heard it's a limitation in Windows.

I noticed the same thing (worse performance than expected from interrupt endpoints) when I was designing a USB device a few years ago, and that was with a custom driver I've written. I've heard other USB designers complaining from similar problems too.

Can you use a bulk endpoint instead ?

Edited by Zerosquare
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...