cancel
Showing results for 
Search instead for 
Did you mean: 

STM32446RE Nucleo as a USB CDC device

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

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!

#stm32446re-nucleo
2 REPLIES 2
benjaminbrammer9
Associate II
Posted on October 24, 2016 at 17:02

Ok..I uninstalled the old VCP driver and installed the new one, so now windows recognizes my COM Port, but I can't open a serial connection via puTTy to it. although I use the right serial connection configuration..

Any ideas?

 

From: brammer.benjamin

Posted: Monday, October 24, 2016 4:41 PM

Subject: STM32446RE Nucleo as a USB CDC device

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!
benjaminbrammer9
Associate II
Posted on October 24, 2016 at 17:20

Perfect! I managed it on my own. I forgot to write the apropriate CDC_Control_FS() routines. The CDC_SET_LINE_CODING case and the CDC_GET_LINE_CODING.

Now it works.