EmbeddedRelated.com
Forums

GCC and AT91SAM7 USB CDC Core Example

Started by Ralph Hempel June 13, 2007
HI Kris,

I'll study over this info, and see what I can apply! I'm not up on all the
enumeration steps yet. But clearing the bank flag sounds a little familiar.
...Like it was a fix of some sort that I remember seeing.

Thanks!

Alan KM6VV

>
> Hi Alan,
>
> The 2 main bugs are/were these :
>
> 1. One of the endpoints was incorrectly initialised to ISO.
>
> 2. When a setup or ZLP packet is received, the EP0 (enumeration) handler
> simply returns.
> This is incorrect. A windows host during standard enum requests 0xFF
> config bytes, and then
> aborts this request. (Data IN stage has been stopped by a status OUT)
> After return, the BK0 flag is still set, thus resulting in continuous
> calls to the handler.
> With the polling code this is not so bad, but when you use INTs you get
> constant vectoring...
>
> handler. The simple solution is to always clear the BK0 & BK1 flag
> after RX of SETUP
> within the enumeration (EP0) handler :
>
> // Received a SETUP packet ?
> if (! (USB_CSR0 & USB_CSR0_RXSETUP) )
> {
> USB_CSR0 &= ~(USB_CSR0_RX_DATA_BK0+USB_CSR0_RX_DATA_BK1);
> return;
> }
>
> HTH
> Best Regards,
> Kris
>