STM32G474 strange problem with USB support CDC

Post here first, or if you can't find a relevant section!
Post Reply
jeffs555
Posts: 4
Joined: Fri Sep 11, 2020 3:13 am

STM32G474 strange problem with USB support CDC

Post by jeffs555 »

Having a very strange problem with STM32G474 when enabling USB support CDC. It does this even with a simple LED blink program without any serial code at all. Without USB CDC enabled, the LED comes up blinking after uploading, and if I power the board off then on, the LED comes up blinking as it should.

However, if I enable USB support CDC, the LED comes up blinking after upload, but after powering off then on it never blinks again. If i add some serial.print code it also works fine after uploading, and the serial prints show up in the serial monitor over USB, but after powering off then on it stops working. Enabling USB support HID doesn't cause the problem, just CDC.

This is with the STM32duino core 2.9.0 but have tried several earlier STM cores and it does it with all of them.
fpiSTM
Posts: 1964
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: STM32G474 strange problem with USB support CDC

Post by fpiSTM »

Hi @jeffs555
Which board you used? Target and options?
jeffs555
Posts: 4
Joined: Fri Sep 11, 2020 3:13 am

Re: STM32G474 strange problem with USB support CDC

Post by jeffs555 »

Thanks for responding.

I am using a WEACT board with a STM32G474CEU6

The problem is probably because I was using generic STM32G474CETx as the board part number because there was no STM32G474CEUx selection.
The parts are basically the same with 48 pins, but the STM32G474CEU6 has the 3 ground connections moved to a pad on the bottom and so has 3 extra IO pins. The LED on the WEACT board is on one of the extra IO pins.

I am trying to add a generic STM32G474CEU6 to the boards.txt and hopefully that will fix the problem.
fpiSTM
Posts: 1964
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: STM32G474 strange problem with USB support CDC

Post by fpiSTM »

Pay attention to USB clock source. It have to be 48MHz.
jeffs555
Posts: 4
Joined: Fri Sep 11, 2020 3:13 am

Re: STM32G474 strange problem with USB support CDC

Post by jeffs555 »

Thanks again, it is working now including the USB serial.
I copied the generic_clock.c and ldscript.ld files from the Tx variants directory to the Ux variants directory,
Then edited the copied generic_clock.c and changed the 8 references for Tx parts to Ux

It wouldn't recognize the changes to boards.txt until I deleted the arduino-ide directory as described at this link
https://github.com/arduino/arduino-ide/ ... 1152005617
jeffs555
Posts: 4
Joined: Fri Sep 11, 2020 3:13 am

Re: STM32G474 strange problem with USB support CDC

Post by jeffs555 »

Do you know how i could request the generic STM32G474CEUx be added to the next STM32duino release? The STM32G474CEU6 has a lot of very nice peripherals and I would like to recommend the WeAct board to some people without having to walk them through adding it themselves.
fpiSTM
Posts: 1964
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 108
Location: Le Mans
Contact:

Re: STM32G474 strange problem with USB support CDC

Post by fpiSTM »

Do a Pull Request. See the contributing documentation.
Post Reply

Return to “General discussion”