cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 discovery usb and example applications

krestan
Associate II
Posted on July 07, 2016 at 16:38

I just got on my talbe STM32L476 discovery board, but I can not find anywhere any link to download sample applications or some sample code. It looks like there is no such link on ST website. I also downloaded ST CubeMX but I can not find any examples there as well. I jus need some sample code (preferably some IAR project) with functional USB OTG device. I've my own board, where is my whole application already almost done, but I can not make USB to work at all so I decided to try STM32 discovery, but there is no example application for it. Alternatively is there any easy way how to port mass storage device from STM32L1 to STM32L476? The registers in L476 are completely different. I also tried to generate project from ST CubeMX, but the generated code is not working on a discovery board, in general cube generates more bugs than a useful piece of code.

2 REPLIES 2
Walid FTITI_O
Senior II
Posted on July 11, 2016 at 16:38

Hi krestan.michal.001,

You can download the last version of STM32CubeL4 library from this

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubel4.html

. You find USB device examples in the  USB_Device foldres :

- For the STM32L476G-discovery at this path:

STM32Cube_FW_L4_V1.5.0\Projects\STM32L476G-Discovery\Applications\USB_Device

- For the STM32L476G-EVAL at this path: (more examples)

STM32Cube_FW_L4_V1.5.0\Projects\STM32L476G_EVAL\Applications\USB_Device

For CubeMx, you should select ''Board selector'' instead of ''MCU selector '' in the window that appears after you click on new project. Then you choose the board/discovery suitable for you.

Any questions or feedbackcs about SMT32cube and CubeMx are welcome . Just post it and we and other community' users will answer you.

-Hannibal-
Posted on October 13, 2017 at 13:31

I using STM32L476-Disco, in STM32CubeMX

- Select board STM32L476G-DISCO

- ProjectSetting change ProjectName to 'USBtestV2', toolchain SW4STM32, other parameters default

- In Pinout tab, Peripherals change USB_OTG_FS - Mode to Device_Only

- MiddleWares change USB_DEVICE - Class For FS IP to CDC VirtualComPort

- In ClockConfiguration (Error) - Select Yes to automatic clock issue solver (this change clock USB to 48MHz)

- Generate source code, open in IDE, compile without errors (Only warning for passing arguments for USB (char *) and (uint8_t *)). Code is 16352B, Data 376B

- Via STM32 ST-LINK Utility flashing generated BIN to board ...

- unplug USB cable and plug .... and nothing. Nothing. PC is not recognized this device, recognize only STM32 ST-LINK ...

Where is issue(s)?

PS: These step with STM32F103 on my board working fine ...