Hello,
can me sombody help, please?
I use LPC1837 and usb port - vcom. I am sending data in the for - cycle:
for (...)
{
preparing datagram
send: vcom_write(....)
}
and my problem is, that pc doesn't catch all data. I send 5x datagram from processor and in pc I catch only 2 datagram.
When I use delay between sending, it works. But I dont have time to waiting...Can I use vcom_write in cycle?
thank you
Hi,
I ran into same issue recently. Does anyone know how to solve it?
I am using LPC1549 and LPCOpen 2.20.
EDIT: Never mind, I made a quick fix by creating an alternative function, which waits for VCOM_TX_BUSY flag to clear.
uint32_t vcom_write_blocking(uint8_t *pBuf, uint32_t len)
{
VCOM_DATA_T *pVcom = &g_vCOM;
uint32_t ret = 0;
while(pVcom->tx_flags & VCOM_TX_BUSY){}
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;
}