Content originally posted in LPCWare by pra18 on Wed Nov 05 03:19:33 MST 2014
Hi,
Thanks for the reply.
I now managed to get away with that Structure and use global variables , this works fine as you mentioned.
After doing this change 
when I call RegisterEPHandler , I am passing NULL in the last argument of this call , is this Ok? Earlier it was a 
RetVal = USBD_API->core->RegisterEpHandler(UsbdHndl, EPIndex, EP_INHandler, &g_USB); 
and now it is 
RetVal = USBD_API->core->RegisterEpHandler(UsbdHndl, EPIndex, EP_Handler, NULL);
2. My NAK case looks like below.
 case USB_EVT_OUT_NAK:
  /* queue free buffer for RX */
    if ((RxFlag & (USB_RX_BUF_FULL | USB_RX_BUF_QUEUED)) == 0)
      {
      USBD_API->hw->ReadReqEP(UsbdHandle, USB_CDC_OUT_EP, RxBuff, RX_BUFFER);
      RxFlag |= USB_RX_BUF_QUEUED;
      }
3. As you suggest, I can move the Reception ISR functionality of the UART into my EVT_OUT handler.
4 Main Problem: 
  
  RX: 
   
  I need to find a way how to return the last received character . But the example has a function that returns the number of bytes read 
  Do you know about this? 
  In the example, There is also a buffered Read routine that returns number of bytes read.
I need to first see if there are characters in the Rx buffer and try to pull a character out of the buffer some thing like a Ring buffer with a head    and tail  
and also 
directly go and get the received character by this call USBD_API->hw->ReadEP , is it possible ? much like the standard UART_ReceiveByte following the UART styled way.
        
  TX:
 transmit a single byte over VCOM  much like the standard UART_SendByte, it this possible and how?
 also transmit a block of bytes over VCOM 
Does there any example to do this kind of TX and RX for the USB CDC , 
Can anyone point to a piece of code that could help get going?
Thanks in advance,