Reads and Writes using the USBDAPI on lpc43xx

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by pra18 on Sun Oct 26 08:38:50 MST 2014

I am trying to make UART styled interfaces for the USB Virtual COM on my lpc43xx device I mean actually migrating from 43xx's UART to virtual COM  method using USB.

If we look at the USBD APIs provided ,
I have the following queries w.r.t. USB driver functions

1.when it comes to things needed on a UART like  Send a byte, Receive a byte , Send a block of bytes  over USB Virtual COM

using both ways - buffered mode and non buffered. does anyone have some suggestions on this?

What I see is that the ReadEP and WriteEP are the APIs provided by the USBD to do this . But I want to know how it is really to be used.

How could the ReadEP be used to receive a byte over virtual COM and WriteEP used to transmit a single byte over Virtual COM and if I want to send a big block of data also, how to use these APIs. I am also considering that I need to handle buffered method also.

Can anyone point to some piece of code to do this kind of UART styled methods for 43xx Virtual COM?

2. I have a UART Rx ISR that handles some functionality in my current device and I want to move it to the USB's ISR.
   But the USB ISR is not available to the User to modify and not exposed to user app.

   In this case where can this functionality present in my current UART's RX ISR put in the case of USB's Virtual COM port.
   For example , can I move this Rx functionality into Bulk IN Handler or OUT handlers?

3.In the CDC VCOM exampel there is a structure for the VCOM data having members of type USBD_HANDLE_T  like handle to CDC class and handle to USBD
  and some pointers to TX Buffr and RX Buffer.

  Is it a must to maintain this VCOM structure in this way or can I make each one of the members of this structure as  global variables in my implementation?

4. Lastly, If one uses USB1 and wants to use same sources for  USB0 on lpc43xx , does anything change apart from clockmuxing and PLL during initialisation?
   Are there any other changes like Patches or Errata associated with the USB0 on the lpc433x?

Thanks in advance,