Skip to main content
Explorer
May 15, 2024
Solved

STMG474RE USB FS implementation

  • May 15, 2024
  • 1 reply
  • 1033 views

Hi together,

i´m trying to set up a communication via usb using the usb cdc class to communicate with additional software via a virtual com port running on a local pc using the Nucleo G474RE board.

However i can't find a sufficient documentation what i do have to implement / settings that have to be done to send and recieve data.

I`ve also watched the youtube tutorial from stm on the topic usb cdc but it didn't help me.

 

I made the following steps until now in the cube ide:

I´ve activated the usb in the communication section and the usb_device in the middleware where i also set the communication device class option.

j_ic_0-1715774325310.pngj_ic_1-1715774344179.png

 

Afterwards i solved the clock issue using the HSI48RC clock for usb.

j_ic_2-1715774369039.png

 

But from that on the next steps are unclear to me. Can i now just use the "uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)" function to transmit data? This function is located in the usbd_cdc_if.h/c file.

 

j_ic_3-1715774395021.pngj_ic_4-1715774419885.png

 

I tried a short example using this function to send a short hello world char array but it didn't work. So i think i missed something.

I searched in the reference manual, the datasheet and the HAL documentation for any hints but i couldn't find any - have i overlooked something?

Especially for the USB functions i couldn't find any description except in the corresponding h/c files.

I hope this description is sufficient. Thank`s for your help.

 

 

 

 

    This topic has been closed for replies.
    Best answer by FBL

    Hi @j_ic 


    First, you can find in UM1734_STM32Cube.book the documentation for device library. Second, you can have a look a the following example STM32CubeG4/Projects/STM32G474E-EVAL/Applications/USB_Device/CDC_Standalone at master · STMicroelectronics/STM32CubeG4 (github.com) developed for the same chip on eval board. Maybe, your implementation is just missing clock recovery synchronization CRS. 

    1 reply

    FBLAnswer
    Technical Moderator
    May 15, 2024

    Hi @j_ic 


    First, you can find in UM1734_STM32Cube.book the documentation for device library. Second, you can have a look a the following example STM32CubeG4/Projects/STM32G474E-EVAL/Applications/USB_Device/CDC_Standalone at master · STMicroelectronics/STM32CubeG4 (github.com) developed for the same chip on eval board. Maybe, your implementation is just missing clock recovery synchronization CRS.