cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446RE Nucleo 64

benjaminbrammer9
Associate II
Posted on October 24, 2016 at 16:39

Hi Guys,

i try to experiment a bit with the USB CDC library. Sadly I don't get it to work out of the box after I configured everything in STMCubeMX.

I tried to learn something from the F4 firmware libraray tutorial projects on CDC. But I find it quite complicated to understand, since there's a complete different board used and also an USART used for communicating.

Basically I want to configure my STM446RE to behave as a USB CDC device with messages send over parallel port as a VCP device. But when I run the program Windows doesn't recognize my new device. Just the one created by the STV/Link debugger.

To send data over USB I added a message which I send in main while(1) loop:

/* USER CODE BEGIN 0 */

uint8_t HiMsg[] = ''hello  HHI\r\n'';

/* USER CODE END 0 */

int main(void)

{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

  HAL_Init();

  /* Configure the system clock */

  SystemClock_Config();

  /* Initialize all configured peripherals */

  MX_GPIO_Init();

  MX_TIM3_Init();

  MX_TIM2_Init();

  MX_USB_DEVICE_Init();

  MX_USART3_UART_Init();

  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */

  /* USER CODE BEGIN WHILE */

  while (1)

  {

 CDC_Transmit_FS(HiMsg, strlen(HiMsg));

 HAL_Delay(500);

  }

  /* USER CODE END 3 */

}

Would be glad if someone could help.

Thanks!
2 REPLIES 2
slimen
Senior
Posted on October 25, 2016 at 13:04

Hello,

May be you should check if  VCP driver is correctly installed on PC ?

Regards

kmehranh
Associate II
Posted on November 14, 2016 at 22:43

Hello,

I had the same problem for 5 days and finally found the answer! Your code needs to wait for the USB to finish initialization.

Just add delay before while(1) loop (HAL_Delay(2000)), I hope it works for you too!