USB enumeration

Hi All, I'm desining a USB CDC (communication device class) device using MAX3420. The configuration descriptor is 67 bytes long. for Full-speed operation maximum payload in a packet is 64 bytes. Does anyone know how to send 67bytes to the host's request? The USB spec says you can do it by sending 64bytes + remaining bytes and Zero-length-packet. I'didn't quite get that. If anyone come accross this before, please help me. Regards, Thanushan

Reply to
Thanushan
Loading thread data ...

Assuming that your device descriptor has specified a control endpoint (endpoint 0) size of 64, you send it as a 64 byte packet and a 3 byte packet (which is "short").

Andrew

Reply to
Andrew Jackson

It may have been my imagination, but I had a feeling I once put 0 into EP0OUTBC and it sent 64 bytes BUT that could be my imagination (or another bug while I was dveloping code).

Basically:

wait for EP0OUTBAVIRQ push 64 bytes into EP0OUTFIFO put 64 into EP0OUTBC (which resets EP0OUTBAVIRQ so do NOT do that explicilty) wait for EP0OUTBAVIRQ push 3bytes into EP0OUTFIFO put 3into EP0OUTBC Pour yourself a large one, and consider buying USBTrace.

Reply to
Bill Davy

r

Thanks Andrew, It works. Thanks very much, really appriciated. Thanushan

Reply to
Thanushan

configuration descriptor is 67 bytes long. for Full-speed

Hi, Thanushan several days ago i try to make usb cdc with my own board max3420.(not finished yet). maybe you can try this :

.... in send_configuration :(Get configuration descriptor -->67 bytes, send

64 first and 3 latter ... if (desclen!=0) { sendlen = (reqlen 64); sendlen = desclen; while(!rreg(rEPIRQ& bmIN0BAVIRQ)); if(sendlen>0) writebytes(rEP0FIFO,sendlen,pDdata);//3 bytes more wregAS(rEP0BC,sendlen);

} }

may be you can send me information if you have done your work, because i still confuse with CDC class request like set_line ... and get_line..

thanks

Reply to
YP

. The configuration descriptor is 67 bytes long. for Full-speed

ode

descriptor, 67

4 bytes, because 67 =3D 64

bytes

Hi YP, I've similar code as yours. and it's working. I'm not worried about the SET_LINE and GET_LINE commands at the moment. now when I plugin my device to the PC, it find it as a com port. and I can send and receive data using a terminal program (hyperterminal). It's good enough for me now... Thanushan

Reply to
Thanushan

Hi Thanushan, is your project is full duplex??? can you guide me how to make it happen?

Thank you

Reply to
YP

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.