STM32G071 No PLL Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Tabulous
Posts: 502
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

STM32G071 No PLL  Topic is solved

Postby Tabulous » Wed Sep 21, 2022 5:21 pm

Hi trying to run the STM32G071 at a low power(1Mhz sys clock), thus don't want/need PLL.

mcuconf.h is this
#define STM32_HSIDIV_VALUE 16
#define STM32_HSI16_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_LSE_ENABLED FALSE
#define STM32_SW STM32_SW_HSISYS
#define STM32_PLLSRC STM32_PLLSRC_NOCLOCK

but getting a load of errors ?


In file included from ../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.h:1259,
from ../chibiOS/os/hal/include/hal.h:243,
from ../chibiOS/os/hal/src/hal.c:25:
../chibiOS/os/hal/ports/STM32/LLD/RCCv1/stm32_pll_v2.inc:165:2: error: #error "PLL activation required but no PLL clock selected"
165 | #error "PLL activation required but no PLL clock selected"
| ^~~~~
../chibiOS/os/hal/ports/STM32/LLD/RCCv1/stm32_pll_v2.inc:204:2: error: #error "STM32_PLLVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"
204 | #error "STM32_PLLVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"
| ^~~~~
../chibiOS/os/hal/ports/STM32/LLD/RCCv1/stm32_pll_v2.inc:232:2: error: #error "STM32_PLL_P_CLKOUT outside acceptable range (STM32_PLLP_MIN...STM32_PLLP_MAX)"
232 | #error "STM32_PLL_P_CLKOUT outside acceptable range (STM32_PLLP_MIN...STM32_PLLP_MAX)"
| ^~~~~
../chibiOS/os/hal/ports/STM32/LLD/RCCv1/stm32_pll_v2.inc:264:2: error: #error "STM32_PLL_Q_CLKOUT outside acceptable range (STM32_PLLQ_MIN...STM32_PLLQ_MAX)"
264 | #error "STM32_PLL_Q_CLKOUT outside acceptable range (STM32_PLLQ_MIN...STM32_PLLQ_MAX)"
| ^~~~~
../chibiOS/os/hal/ports/STM32/LLD/RCCv1/stm32_pll_v2.inc:302:2: error: #error "STM32_PLL_R_CLKOUT outside acceptable range (STM32_PLLR_MIN...STM32_PLLR_MAX)"
302 | #error "STM32_PLL_R_CLKOUT outside acceptable range (STM32_PLLR_MIN...STM32_PLLR_MAX)"

User avatar
Giovanni
Site Admin
Posts: 14169
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1020 times
Been thanked: 871 times
Contact:

Re: STM32G071 No PLL

Postby Giovanni » Wed Sep 21, 2022 5:28 pm

Hi,

Moving in bug reports, probably there are some missing conditions in checks.

Giovanni

User avatar
FXCoder
Posts: 375
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 175 times
Been thanked: 127 times

Re: STM32G071 No PLL

Postby FXCoder » Sat Sep 24, 2022 2:04 pm

Hi,
As a work around, until the PLL checks are updated, if you set the following you should be able to build from trunk...

Code: Select all

#define STM32_PLLM_VALUE                    2
#define STM32_PLLN_VALUE                    16
#define STM32_PLLP_VALUE                    2
#define STM32_PLLQ_VALUE                    4
#define STM32_PLLR_VALUE                    4


--
Bob

User avatar
Giovanni
Site Admin
Posts: 14169
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1020 times
Been thanked: 871 times
Contact:

Re: STM32G071 No PLL

Postby Giovanni » Tue Sep 27, 2022 3:22 pm

Hi,

The problem is caused by specifying STM32_PLLSRC_NOCLOCK as clock source and then specifying the PLL as clock source for some peripheral, for example in my case STM32_ADCSEL_PLLPCLK, after changing it to STM32_ADCSEL_SYSCLK the error disappeared.

If you disable the PLL make sure no not use it as source for any clock or HAL will try to activate it and find that the input clock is invalid.

Giovanni

Tabulous
Posts: 502
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

Re: STM32G071 No PLL

Postby Tabulous » Sun Oct 16, 2022 4:11 pm

got another one, trying to output SYSCLK to MCO pin PA8 to check the SYSCLK is at correct Frequency.

So have set this, along with PA8 to Alternate 0
#define STM32_MCOSEL STM32_MCOSEL_SYSCLK
#define STM32_MCOPRE STM32_MCOPRE_DIV1

Getting these compile errors

BUILD_TYPE is : DEBUG
Compiling hal.c
Compiling hal_st.c
Compiling hal_buffers.c
Compiling hal_queues.c
Compiling hal_flash.c
Compiling hal_mmcsd.c
Compiling hal_adc.c
Compiling hal_gpt.c
Compiling hal_pal.c
Compiling hal_pwm.c
Compiling hal_serial.c
Compiling hal_wdg.c
Compiling nvic.c
Compiling stm32_isr.c
Compiling hal_lld.c
Compiling hal_efl_lld.c
Compiling hal_adc_lld.c
Compiling stm32_dma.c
Compiling stm32_exti.c
In file included from ../chibiOS/os/hal/include/hal.h:243,
from ../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.c:25:
../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.h:1308:37: error: initializer element is not constant
Compiling hal_pal_lld.c
1308 | #define STM32_MCODIVCLK hal_lld_get_clock_point(CLK_SYSCLK)
| ^~~~~~~~~~~~~~~~~~~~~~~
../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.h:1333:37: note: in expansion of macro 'STM32_MCODIVCLK'
1333 | #define STM32_MCOCLK STM32_MCODIVCLK
| ^~~~~~~~~~~~~~~
../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.c:136:23: note: in expansion of macro 'STM32_MCOCLK'
Compiling hal_st_lld.c
136 | [CLK_MCO] = STM32_MCOCLK,
| ^~~~~~~~~~~~
../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.h:1308:37: note: (near initialization for 'clock_points[8]')
1308 | #define STM32_MCODIVCLK hal_lld_get_clock_point(CLK_SYSCLK)
| ^~~~~~~~~~~~~~~~~~~~~~~
../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.h:1333:37: note: in expansion of macro 'STM32_MCODIVCLK'
1333 | #define STM32_MCOCLK STM32_MCODIVCLK
| ^~~~~~~~~~~~~~~
../chibiOS/os/hal/ports/STM32/STM32G0xx/hal_lld.c:136:23: note: in expansion of macro 'STM32_MCOCLK'
136 | [CLK_MCO] = STM32_MCOCLK,
| ^~~~~~~~~~~~
make: *** [../chibiOS/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:189: build/debug/obj/hal_lld.o] Error 1
make: *** Waiting for unfinished jobs....
Compiling hal_gpt_lld.c
"make -j8 all" terminated with exit code 2. Build might be incomplete.

16:11:06 Build Failed. 3 errors, 0 warnings. (took 5s.464ms)

User avatar
Giovanni
Site Admin
Posts: 14169
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1020 times
Been thanked: 871 times
Contact:

Re: STM32G071 No PLL

Postby Giovanni » Sun Oct 16, 2022 4:49 pm

Hi,

The problem was also present on G4.

Fixed as bug #1239 (in trunk).

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 7 guests