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.
Hi im currently working on USB drivers for LP2468 MCU.I want to send data to the host PC as fast as I can.Since i dont have much knowledge on USB HID development on the PC end Ive decided to implement USBCDC class which will appear as a virtual comport on PC. In my code i have initialised USB using the following statements
CDC_Init (); /*VCOM Initialization*/ USB_Init( EA_BOARD_LPC24XX ); USB_Connect(TRUE);
After i get USB_Configuration flag when an USB cable is connected i send data to PC using
USB_WriteEP (CDC_DEP_IN,str,len );
Where str is the string i want to write and len is the length
This works as far as I insert a delay between 2 succesive USB writes. If i reduce the delay the MCU hangs.Ive tried increasing the buffer size by sending more data collectively by changing usbpacket size #define USBPKTLEN 1000
i have also commented out the following code as im not using CDC to send data packets to the serial port
void USB_EndPoint2 (DWORD 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; } }
Can someone please suggest what measures can i take to increase the throughput of USBCDC or is there anyway to monitor the status of USB clear to send flag if any Thank you
Hi thanks for your pointing that out,following which i have made modified my code as below
In my custom USB_write I fill the bytes to be transmitted in a global buffer. When the call back even from usb stack is triggered.I send my buffer on USB using writeEP in CDC_BulkIn(); and i clear the counters to indicate my buffer is empty again.
switch (event) { case USB_EVT_OUT: CDC_BulkOut (); /* data received from Host */ break; case USB_EVT_IN: CDC_BulkIn (); /* data expected from Host */ break; } }
However im facing the following problem USB_EndPoint2 call back function is not being called automatically.Hence CDC_bulkin(); doesnt get called.Also i would like to point out that when iam directly writing to writeEP the call back function CDC_BulkIn (); gets called. Please suggest how do i get over this issue.
Also i would like to point out that when iam directly writing to writeEP the call back function CDC_BulkIn (); gets called. Please suggest how do i get over this issue.
this is not an issue at all but normal behavior. did you not figure that out from my first post? I posted:
Once you 'USB_WriteEP', you can expect 'BulkIn' callbacks until you transmitted all the data
yes?
if 'CDC_BulkOut' is not called then you probably changed your USB stack somehow or your connection is not alive.
Yeah i think that hit it...Its working with good speed now thanks so much
My pleasure.
Hello,
From the MCB2300 USBCDC example I'm trying to write a CDC driver but since I can ready any incoming character, there's no way for me to get the CDC_BulkIn function called on the Endpoint2.
As far as I can see from the example, whenever a character is read from the UART there's a call to USB_WriteEP but what I want is that the CDC_BulkIn function is called automatically requesting data from my internal buffer.
Is there any 'straightforward' way to modify this example in order to get a 'simple' virtual com driver?
Thanks and best regards, Daniel