We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello!
I have a board with atmel sam3u mcu. Unfortunately, I didn't find USB-CDC example for this mcu, so I ported example for MCB2300 using some USB code from USB-HID and USB-MSC examples which are available. USB and CDC initialization works fine, data sending works without problems as well. But I have problems receving data via virtual COM-port. When I try to send data from terminal application on my PC it just reports communication error (tried other terminal applications - some of them just freeze, some also give errors). I suppose the problem is here (usbuser.c):
/* * USB Endpoint 2 Event Callback * Called automatically on USB Endpoint 2 Event * Parameter: event */ void USB_EndPoint2 (U32 event) { switch (event) { case USB_EVT_OUT: CDC_BulkOut (); /* data received from Host */ break; case USB_EVT_IN: CDC_BulkIn (); /* data expected from Host */ break; } }
I set a breakpoint and it seems that USB_EVT_OUT event is never raised, so CDC_OutBufAvailChar reports 0 bytes in buffer and so on.
What can I check? Maybe some misconfiguration?
Thanks a lot!
Looks like you've assigned endpoint numbers same as MCB2300 example. The endpoint assignment is different on these two MCUs The SAM3U endpoints are single direction.
MCB2300 CDC EP1 IN : interrupt IN EP2 IN : bulk IN EP2 OUT: bulk OUT SAM3U CDC EP1: interrupt IN EP2: bulk IN EP3: bulk OUT
Fix the endpoint descriptors, on both of FS and HS configurations.
Also, the callbacks are,
void USB_EndPoint2 (U32 event) { CDC_BulkIn (); /* data expected from Host */ } void USB_EndPoint3 (U32 event) { CDC_BulkOut (); /* data received from Host */ }
And usbcfg header is,
usbcfg_SAM3U.h #define USB_IF_NUM 1 // <--- 2 // two interfaces #define USB_EP_NUM 3 // <--- 4 // four EPs (EP0, 1, 2, 3) ... #define USB_EP_EVENT 0x0007 // <--- 0x000F // EP0, 1, 2, 3
Tsuneo