cancel
Showing results for 
Search instead for 
Did you mean: 

nedd for Delay between CDC_Transmit_FS calling

leogarberoglio
Associate III
Posted on September 04, 2015 at 14:22

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
2 REPLIES 2
Walid FTITI_O
Senior II
Posted on April 05, 2016 at 19:16

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-

tsuneo
Senior
Posted on April 07, 2016 at 22:43

> Is there a macro or a function to check before the second CDC_Transmit_FS calling?

discussed on this topic, recently

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Way%20to%20be%20notified%20on%20CDC%20transmit%20complete

Tsuneo