USBCDC test

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USBCDC test

278 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by AIV on Thu Jun 02 07:55:22 MST 2011
First, sorry for my english.

I've started to work with LPCXpresso LPC1343 board and want to use vcom in my work.

I loaded usbcdc project and test it by using terminal and shorted TXD and RXD pins.

But now, i want to send and get byte witout using jumper.

Can you help and give me this project or places where i can see how to do this?
0 Kudos
3 Replies

236 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elturko on Thu Apr 12 08:18:49 MST 2012
Hi, i need connect the LPCXPRESSO (lpc1343) with a pc via USB. I use USBCDC, and i see LPC13xx USB VCom Port (COM3). i can write via Labview the serial port, (data string) but i can´t see any data in the lpc1343 buffer. In the lpcxpresso i connect a jumper between TXD and RXD. can you help me with this application?? This is my first time with the cortex arm. best regards.
0 Kudos

236 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by slawer on Thu Oct 27 01:06:09 MST 2011
Hello!

I encountered the following strange situation to me.

Example USBCDC for LPC1343 Keil  work as expected: when jumped is on lines TxD and RxD, echo  comes through the virtual port.

Then I rewrote this example, as follows:

send the package via the UART
send and receive data through USB

And this is work. But when lines TxD and RxD is closed, I receive from USB echo data and  sended in UART data is in end of it.

This situation paint in attached zip-file.

Thanks..
0 Kudos

236 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Thu Oct 06 02:50:03 MST 2011
If you want to handle the character mirroring in software, you would need to combine the USB read an write functions.

The main while(1) loop would then become:
  while (1) {                    // Loop forever  
      //VCOM_Serial2Usb();        // Read serial and write to USB
      VCOM_CheckSerialState();    // Update serial states
      //VCOM_Usb2Serial();        // Read USB and write serial
      VCOM_Usb2Usb();            // Read USB and write to USB
  } // end while
And you need the new [COLOR=black][FONT=&quot]VCOM_Usb2Us[/FONT][/COLOR] function:
/*----------------------------------------------------------------------------
  Reads character from USB buffer and writes back to USB buffer
 *---------------------------------------------------------------------------*/
void VCOM_Usb2Usb(void){
    static char serBuf [32];
    int  numBytesToRead, numBytesRead, numAvailByte;

    /* Get USB VCOM received bytes */
    CDC_OutBufAvailChar (&numAvailByte);
    if (numAvailByte > 0) {
            numBytesToRead = numAvailByte > 32 ? 32 : numAvailByte;
            numBytesRead = CDC_RdOutBuf (&serBuf[0], &numBytesToRead);

               /* Write bytes to USB VCOM */
               USB_WriteEP (CDC_DEP_IN, (unsigned char *)&serBuf[0], numBytesRead);
    }
}
Does this answer your question?
0 Kudos