2016-10-24 07:39 AM
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!2016-10-25 04:04 AM
Hello,
May be you should check if VCP driver is correctly installed on PC ?Regards2016-11-14 01:43 PM
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!