cancel
Showing results for 
Search instead for 
Did you mean: 

STMCubeMX 's bug

zstev
Associate II

1 The code was generated by STMCube and the MCU is stm32f030k6t6

2 I use 8M HSI RC as clock source .

3 If I set SYSCLK to 8M (use HSI RC directly), the code can work on the board correctly

4 if I set SYSCLK to 48M (use PLLMUL). the code didn't work at all .

5 I just toggle a LED based on the generated code .

6 why did we can't use PLLMUL with STMCube?

1 ACCEPTED SOLUTION

Accepted Solutions

Try a different - smaller - output frequency from the PLL, for example 8MHz (PLL set to x2).

Try not to switch to PLL as system clock, but output it onto the MCO pin (if available on your design).

JW

View solution in original post

5 REPLIES 5

> if I set SYSCLK to 48M (use PLLMUL). the code didn't work at all .

> I just toggle a LED based on the generated code .

What exactly is "code didn't work at all"? Isn't just the LED blinking too fast to be seen by eye? Do you use a debugger, and if yes, can you single-step the code, or place a breakpoint into the main loop?

Is this a "known good" board like Disco or Nucleo, or is it your own board?

JW

zstev
Associate II

Hi ,waclawek, thanks for helping!

1 it's my own board and we are sure the hardware is OK.

2 "code didn't work at all" is the software cann't run on the board if I set the system clock to 48M with internal HSI.

3 I used ST-LINK V2 (SW-MODE) debug the code single-step , and if it run to here "if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)"

the debugger post a message "Cannot access target. Shutting down debug session" . the attacted file is the message dialogue for your reference.

steve

zstev
Associate II

Sorry ,forgot the attacted file , post it again.

Try a different - smaller - output frequency from the PLL, for example 8MHz (PLL set to x2).

Try not to switch to PLL as system clock, but output it onto the MCO pin (if available on your design).

JW

zstev
Associate II

JW ,thanks for helping

I have solved this problem. I forgot to wire VDDA to 3.3V , so the PLL wasn't powered by power supply . that is why the software cann't run once I turn on PLL in the function "HAL_RCC_OscConfig(&RCC_OscInitStruct)�?。

thank you .