lpcware

ROM_USB_cdc Example for LPC1347

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ECamino on Fri Sep 28 13:57:54 MST 2012
Hi,

I am running the LPC1347 demo board with the project ROM_USB_cdc from NXP_LPC1347_2012_02_22.zip in my \\\nxp\LPCXpresso_4.2.3_292\lpcxpresso\Examples\NXP\LPC1000\LPC13xx_12bitADC

I build with [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#define[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] UART_BRIDGE 1 [/SIZE]defined and the bridge program works OK.

I build without the define and I'm trying to ping pong a byte from Hyperterm. When I run the program, my USB protocol analyzer catches the out report with the key I typed. The problem is the in report.

[SIZE=2][COLOR=#000080][SIZE=3][COLOR=#000080]URB [B]Bulk or Interrupt Transfer [/B]issued[/COLOR][/SIZE]
[/COLOR][/SIZE][B][SIZE=1][SIZE=3]Device Object [/SIZE][/SIZE][/B][SIZE=1][SIZE=3]USBPDO-6[/SIZE]
[B][SIZE=3]Driver Object [/SIZE][/B][SIZE=3]usbuhci[/SIZE]
[B][SIZE=3]URB Function [/SIZE][/B][SIZE=3]URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER[/SIZE]
[B][SIZE=3]Endpoint 82h [/SIZE][/B][SIZE=3]2 In, Bulk[/SIZE]
[B][SIZE=3]Buffer Length [/SIZE][/B][SIZE=3]1000h (4096)[/SIZE]

[SIZE=3]The buffer length should only be a byte as the Zero-Copy Data Transfer model is being used?[/SIZE]

[SIZE=3]Here's the demo code as supplied:[/SIZE]


[SIZE=3][COLOR=#005032][COLOR=#005032]ErrorCode_t[/COLOR][/COLOR][/SIZE][COLOR=#005032]
[LEFT][/COLOR][SIZE=3][B]VCOM_bulk_in_hdlr[/B]([COLOR=#005032][COLOR=#005032]USBD_HANDLE_T[/COLOR][/COLOR] hUsb, [B][COLOR=#7f0055][COLOR=#7f0055]void[/COLOR][/COLOR][/B]* data, [COLOR=#005032][COLOR=#005032]uint32_t[/COLOR][/COLOR] event) [/SIZE][/LEFT]

[LEFT][SIZE=3]{[/SIZE][/LEFT]

[SIZE=3][LEFT][COLOR=#3f7f5f][COLOR=#3f7f5f]// VCOM_DATA_T* pVcom = (VCOM_DATA_T*) data;[/COLOR][/COLOR][/SIZE]
[LEFT][SIZE=3][COLOR=#3f7f5f][COLOR=#3f7f5f]// Not needed as WriteEP() is called in VCOM_usb_send() immediately. [/COLOR][/COLOR][/SIZE][COLOR=#3f7f5f]
[SIZE=3][COLOR=#3f7f5f]// if (event == USB_EVT_IN) {[/COLOR][/SIZE]
[SIZE=3][COLOR=#3f7f5f]// }[/COLOR][/SIZE]
[/COLOR][SIZE=3][B][COLOR=#7f0055][COLOR=#7f0055]return[/COLOR][/COLOR][/B][I][COLOR=#0000c0][COLOR=#0000c0]LPC_OK[/COLOR][/COLOR][/I];[/SIZE][/LEFT]
[/LEFT]



[LEFT][SIZE=3]}[/SIZE][/LEFT]


[LEFT][SIZE=3][B][COLOR=#7f0055][COLOR=#7f0055]void[/COLOR][/COLOR][/B][/SIZE][/LEFT]
[SIZE=3][SIZE=2]

[LEFT][SIZE=3][B]VCOM_usb_send[/B]([COLOR=#005032][COLOR=#005032]VCOM_DATA_T[/COLOR][/COLOR]* pVcom)[/SIZE][/LEFT]

[LEFT][SIZE=3]{[/SIZE]

[COLOR=#3f7f5f][SIZE=3][COLOR=#3f7f5f]/* data received send it back */[/COLOR][/SIZE][/COLOR]
[LEFT][SIZE=3]pVcom->[/SIZE][/LEFT]
[/LEFT]




[LEFT][SIZE=3][COLOR=#0000c0][COLOR=#0000c0]txlen[/COLOR][/COLOR] -= pUsbApi->[COLOR=#0000c0][COLOR=#0000c0]hw[/COLOR][/COLOR]->[COLOR=#0000c0][COLOR=#0000c0]WriteEP[/COLOR][/COLOR] (pVcom->[COLOR=#0000c0][COLOR=#0000c0]hUsb[/COLOR][/COLOR], USB_CDC_EP_BULK_IN,[/SIZE][/LEFT]

[LEFT][SIZE=3]pVcom->[COLOR=#0000c0][COLOR=#0000c0]txBuf[/COLOR][/COLOR], pVcom->[COLOR=#0000c0][COLOR=#0000c0]txlen[/COLOR][/COLOR]);[/SIZE][/LEFT]

[LEFT][SIZE=3]}[/SIZE][/LEFT]

[LEFT][SIZE=2][SIZE=3]Why is the incorrect buffer size being sent? [/SIZE][/SIZE][/LEFT]

[LEFT][SIZE=2][SIZE=3]What would I have to do to ping pong data on the USB endpoints from Hyperterm? [/SIZE][/LEFT]
[/SIZE][/SIZE][/SIZE]

[/SIZE]

Outcomes