Skip to main content
MartinSMG
Associate
March 27, 2021
Solved

Problem with generating code for STM32G474RBT6.

  • March 27, 2021
  • 9 replies
  • 2266 views

Hi,

I am running into some problems with generating new code for my MCU (STM32G474RBT6).

I have installed STM32CubeIDE v1.6.0 and FW pack v1.4.0.

I have created my entire pinout with a correct setup (my friend checked it and he is working with these MCUs on profesional level)

Problem is that code does not contain parts for USB CDC.

Everything is generated correctly but there are no:

usb_device.c

usbd_cdc_if.c

etc.

Looking forward for any help.

With regard,

Martin V.

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

Finally I can say that everything is working fine now. At first it was probably caused by something during code generation ans now it is everything working fine, at last point it was caused by my oscilator.

9 replies

MM..1
Chief III
March 27, 2021

Maybe you dont select midleware usb device checkbox...

MartinSMG
MartinSMGAuthor
Associate
March 27, 2021

0693W000008y5pgQAA.pngI am not sure what exactly do you mean. I think I got everything here.

MartinSMG
MartinSMGAuthor
Associate
March 28, 2021

BTW, on that image you can see my another problem which is happening to me almost everytime or everytime I regenerate the code. My main.c file stays with the name main.c_save. I always have to delete entire project and create new one based on my .ioc file or rename it manually. Thankfully I havent started writing most of the code yet.

Khouloud ZEMMELI
ST Employee
March 30, 2021

Hello @Martin Vrlík​ 

Thanks for your feedback,

Could you please share or send me your project to check it?

Khouloud

MartinSMG
MartinSMGAuthor
Associate
April 4, 2021

I have added here some new points. My friend is telling me that it could be caused by the fact that it is the new model of MCU and there might be some bugs in generating code in IDE. I honestly do not know. But last code which should at least act as an COM port is doing nothing at all.

MartinSMG
MartinSMGAuthor
Associate
March 30, 2021

here is the entire project, there is just Systick handler nothing else. Looking forward for any kind of hint for me, on what I am doing wrong way.

MartinSMG
MartinSMGAuthor
Associate
April 1, 2021

I do not know if it matters but here is the fixed project, in first archive there are some errors in my code.

MartinSMG
MartinSMGAuthor
Associate
April 2, 2021

Well, today I have tried it again and regenerated entire code based on .ioc file and now I have even middleware folder there.

MartinSMG
MartinSMGAuthor
Associate
April 2, 2021

Honestly I am starting to be lost. Newly generated code which finaly contains every important part is not working. A have added into it just stupid LED blinking but after powering board up nothing happens. I have tried connecting a debugger into it with this result:

STMicroelectronics ST-LINK GDB server. Version 5.8.0

Copyright (c) 2020, STMicroelectronics. All rights reserved.

Starting server with the following options:

    Persistent Mode      : Disabled

    Logging Level       : 1

    Listen Port Number     : 61234

    Status Refresh Delay    : 15s

    Verbose Mode        : Disabled

    SWD Debug         : Enabled

    InitWhile         : Enabled

Waiting for debugger connection...

Debugger connected

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.7.0-RC1          

   -------------------------------------------------------------------

ST-LINK SN : 50FF66067287555140562167

ST-LINK FW : V2J37S0

Board    : --

Voltage   : 2.97V

SWD freq  : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x469

Revision ID : Rev Z

Device name : STM32G47x/G48x

Flash size : 128 KBytes

Device type : MCU

Device CPU : Cortex-M4

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a02548.srec

 File     : ST-LINK_GDB_server_a02548.srec

 Size     : 38532 Bytes

 Address    : 0x08000000 

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 18]

Download in Progress:

File download complete

Time elapsed during download operation: 00:00:01.132

Verifying ...

Download verified successfully 

Debugger connection lost.

Shutting down...

I am putting here new hopefully completely generated code which should at least blink but it is doing nothing at all.

Thanks for any kind of suggestions.

It is like my IDE is generating every week something new to my project...

MartinSMG
MartinSMGAuthorBest answer
Associate
April 5, 2021

Finally I can say that everything is working fine now. At first it was probably caused by something during code generation ans now it is everything working fine, at last point it was caused by my oscilator.