cancel
Showing results for 
Search instead for 
Did you mean: 

Virtual Com Stm32f429

ASSAAD.ASSAAD
Associate II

Hello All

This is my first try of Vcom ;

I can trasmit to PC but I cant receive from PC ;

/* Init Device Library */
  USBD_Init(&USBD_Device, &VCP_Desc, 0);
  
  /* Add Supported Class */
  USBD_RegisterClass(&USBD_Device, USBD_CDC_CLASS);
  
  /* Add CDC Interface Class */
  USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);
  
  /* Start Device Process */
  USBD_Start(&USBD_Device);
	
	 USBD_CDC_SetTxBuffer(&USBD_Device, UserTxBuffer, 0);
  USBD_CDC_SetRxBuffer(&USBD_Device, &UserRxBuffer[0]);
 
	
 
  sprintf((char *)UserTxBuffer, "TEST VCOM 2019 \n\r");
	 HAL_Delay(1000);
		/*
  /* Run Application (Interrupt mode) */
  while (1)
  {
  
    USBD_CDC_SetTxBuffer(&USBD_Device, (uint8_t*)&UserTxBuffer[0], 17);
    
    if(USBD_CDC_TransmitPacket(&USBD_Device) == USBD_OK)
    {
       }
		
		 HAL_Delay(1000);
		   USBD_CDC_SetRxBuffer(&USBD_Device, &UserRxBuffer[0]);
		 USBD_CDC_ReceivePacket(&USBD_Device);
}

I use a termal program to recieve and send data from PC side ;

I can see the send data by STM32f429 but I cant see the data received bt STM32 in userRxBuffer

what I am missing here ?

Thank you inadvaced

1 REPLY 1

I think you need to move beyond the delaying/blocking model, and have things work concurrently. If you want to send episodically, monitor the progression of time, not delay.

Check status, and output instrumentation data so you can see what's happening real-time, you can't block or stop/step in a debugger.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..