2015-09-04 05:22 AM
I have this code:
while (1)
{
if(fUSB_rcv)
{
CDC_Transmit_FS((uint8_t *)''Mensaje Recibido\n\r'', 18);
HAL_Delay(10);
if (msg[0]=='L' && msg[1]=='E' && msg[2]=='O' && msg[3]=='1')
{
CDC_Transmit_FS((uint8_t *)''Mensaje Correcto\n\r'', 18);
}
else
{
CDC_Transmit_FS((uint8_t *)''Mensaje Incorrecto\n\r'', 20);
}
fUSB_rcv=0;
}
}
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
char i = 0;
fUSB_rcv=1;
for (i = 0; i < *Len; i++)
msg[i] = *(Buf + i);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
/* USER CODE END 6 */
}
I would like to remove HAL_Delay before
CDC_Transmit_FS((uint8_t *)''Mensaje Recibido\n\r'', 18);
If I remove that delay, the second msg (Message Correct or Incorrect) is not received on PC side.
Is there a macro or a function to check before the second CDC_Transmit_FS calling?
regards
#usb #cdc #device
2016-04-05 10:16 AM
Hi elgarbe
,
You can manage several CDC_Transmit calls based on the USBH_CDC_TransmitCallback. In this callback function, you can call the CDC_Transmit functions as it is done in the example STM32Cube_FW_F4_V1.8.0\Projects\STM324xG_EVAL\Applications\USB_Host\CDC_Standalone (have a look to the implementation in Src/cdc_send.c). -Hannibal-2016-04-07 01:43 PM
> Is there a macro or a function to check before the second CDC_Transmit_FS calling?
discussed on this topic, recently Tsuneo