cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 Discovery USB CDC Class Source code or Example

Sunny T
Associate
Posted on September 04, 2017 at 16:24

Hi,

      I am using STM32L476 Discovery Board, as part of my project i need to enable USB OTG Port as CD C Class. Could some one help me in fining any example for USB OTG CDC Class for STM32L476 Discovery Board. I found an example for STM32L476 Eval board Can i use the same Application Example for Discovery Board also. Please help me out in finding the solution.

10 REPLIES 10
Imen.D
ST Employee
Posted on September 04, 2017 at 16:49

Hello,

You can port the CDC example for STM32L476G_EVAL, get inspired from this working application, change the pins and modify the example depending on your needs.

You can also use the STM32CubeMX tool to initialize peripherals, build and generate your starting project.

For more details, refer to

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fccc%2Fresource%2Ftechnical%2Fdocument%2Fuser_manual%2Fcf%2F38%2Fe5%2Fb5%2Fdd%2F1d%2F4c%2F09%2FDM00108pdf%2Ffiles%2FDM00108pdf%2Fjcr%3Acontent%2Ftranslations%2Fen.DM00108pdf

that explains more the use of STM32Cube USB device library.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Szymon PANECKI
Senior III
Posted on September 06, 2017 at 15:27

Hello,

Below please find attached a presentation, which shows step by step how to develop an USB VCP example application on STM32L4 Discovery kit. In addition I attached a project (for Keil IDE), which implements USB VCP application based on steps described in presentation.

I hope it will be helpful to you.

Regards

Szymon

________________

Attachments :

STM32L4 Discovery USB VCP hands on.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HySo&d=%2Fa%2F0X0000000b83%2FruwYoZ0kJdFaq2Xl2Rl_Iv0bLLjyEDHwdv0IzPewarU&asPdf=false

USB_VCP.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HySe&d=%2Fa%2F0X0000000b7v%2F.q1pP1RgQbDW0zXBRKXWXDP1XWigSGomqYMHymQC9H4&asPdf=false

Hi, I tried following the instructions in the presentation with the latest CubeMX 5.0.1, but when I got to Generate Code it popped up a message "These IPs still have some not configured or wrong parameter values [Clock]. Do you still want to generate code ?". Is that something that can be ignored for this example ? Thanks.

Hi, could you clarify where the "the CDC example for STM32L476G_EVAL" can be found. I tried all the links above and got "page not found" for all. Thanks

Hello,

The CDC example is available under the STM32CubeL4 firmware package (to download from ST web site or STM32CubeMx tool):

STM32Cube_FW_L4_V1.13.0\Projects\STM32L476G-EVAL\Applications\USB_Device\CDC_Standalone

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Ah, I already had the STM32CubeL4 code, but i was looking under 32L476GDISCOVERY rather than under STM32L476G-EVAL. Thanks !

Hi,

You have to configure the clock before generate code.

You can click on the "Resolve Clock Issues" button to resolve automatically your configuration issues .

0690X000006DGVMQA4.pngKind Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi again, so I finally got to try the Resolve Clock Issues button. After double-checking that I've set everything as specified in the "STM32L4 Discovery USB VCP hands on.pdf" that Szymon linked to, when I click Reslove Clock Issues it pops up "Cannot found a solution for some constraints".

Update - When I was getting the Resolve Clock error, I had created the project by specifying the board (STM32L476 Discovery, a.k.a. STM32L4-Discovery, a.k.a. 32L476GDISCOVERY). I went back and started a new project, specifying the CPU this time (STM32L476VG) rather than the board, did all the setup, and there were no Resolve Clock errors this time. Code was generated and ran successfully on the board.