Page 1 of 1
USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 12:24 pm
by Mangy_Dog
Hi again new issue so new thread. we have USART3 on PC10/PC11 for debug output. But for some reason its outputting garbage.
I created a hello world in cubeIDE and it works fine there.
I am using the same clock config as cubeIDE so I know its not some strange clock sync issue.
The output is bad enough that it doesnt even show in my IDE serial out, only in putty.
Set my baud to 115200, and even tried a slower 9600. Neither work.
So is there something else deeper in the variant files that need to be tweaked for this to work correctly?
Any help would be great.
Re: USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 1:39 pm
by fpiSTM
Mangy_Dog wrote: Thu Jun 05, 2025 12:24 pm
Hi again new issue so new thread. we have USART3 on PC10/PC11 for debug output. But for some reason its outputting garbage.
I created a hello world in cubeIDE and it works fine there.
I am using the same clock config as cubeIDE so I know its not some strange clock sync issue.
Is it using HSE? if yes which value?
Default value is:
#define HSE_VALUE 16000000UL /*!< Value of the External oscillator in Hz */
So if you use HSE with another value you have to redefine it else all frequencies computed will be wrong.
Re: USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 2:06 pm
by Mangy_Dog
Im using HSE as the main clock in the clocks setup I have the uarts connected to SYSCLK which is derived from HSE through PLLM /1 X23 /6 to give a target of 32mhz main clock.
Its a 8mhz source.
In what file does "#define HSE_VALUE 16000000UL /*!< Value of the External oscillator in Hz */" go? Looks like that might be the issue...
Re: USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 2:20 pm
by fpiSTM
Simply redefine it in your variant*.h file
Example for NUCLEO_F722ZE:
https://github.com/stm32duino/Arduino_C ... 2ZE.h#L224
Re: USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 2:27 pm
by Mangy_Dog
Looking in the file that used to be called variant_generic.h it was never defined to begin with.
Re: USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 2:32 pm
by Mangy_Dog
WOOHOO! adding the define worked

#define HSE_VALUE 8000000UL
Thank you
Re: USART3/Serial3 outputting garbage... U575
Posted: Thu Jun 05, 2025 2:46 pm
by fpiSTM
If you used the generic and not a dedicated variant then you can use the build_opt.h or the hal_conf_extra.h
https://github.com/stm32duino/Arduino_C ... uild_opt.h
https://github.com/stm32duino/Arduino_C ... definition