LPC11U68 & USB CDC: why doesn't it send a message until it recevies one?

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC11U68 & USB CDC: why doesn't it send a message until it recevies one?

Jump to solution
422 Views
chrispflieger
Contributor IV

I'm using the CDC / VCOM example for USB ROM and I modified it a bit to be interrupt driven.

 

I want to write "hello world" on startup, and I call USBD_API->hw->WriteEP(), but it doesn't show up on the terminal until I type a character on the terminal; it's like it wait for something first. After the first, it seemingly work OK, but it's really odd. Is there something I'm missing?

Labels (3)
0 Kudos
1 Solution
397 Views
chrispflieger
Contributor IV

Yeah, it seems the USB wasn't fully enumerated, or whatever.

Since my code didn't do a connection check, the string just went into a buffer and never came out till it got "bumped" with a new character.

 

Adding a delay fixed the glitch.

View solution in original post

0 Kudos
2 Replies
409 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Can you use the vcom_write("Hello World!!\r\n", 15);? If is the same as you call the USBD_API->hw->WriteEP(),but the status is checked before it is called.

 

/* Virtual com port write routine*/
uint32_t vcom_write(uint8_t *pBuf, uint32_t len)
{
VCOM_DATA_T *pVcom = &g_vCOM;
uint32_t ret = 0;

if ( (pVcom->tx_flags & VCOM_TX_CONNECTED) && ((pVcom->tx_flags & VCOM_TX_BUSY) == 0) ) {
pVcom->tx_flags |= VCOM_TX_BUSY;

/* enter critical section */
NVIC_DisableIRQ(USB0_IRQn);
ret = USBD_API->hw->WriteEP(pVcom->hUsb, USB_CDC_IN_EP, pBuf, len);
/* exit critical section */
NVIC_EnableIRQ(USB0_IRQn);
}

return ret;
}

 

BR

XiangJun Rong

0 Kudos
398 Views
chrispflieger
Contributor IV

Yeah, it seems the USB wasn't fully enumerated, or whatever.

Since my code didn't do a connection check, the string just went into a buffer and never came out till it got "bumped" with a new character.

 

Adding a delay fixed the glitch.

0 Kudos