Skip to main content
zstev
Associate II
September 4, 2018
Solved

STMCubeMX 's bug

  • September 4, 2018
  • 5 replies
  • 2062 views

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?

This topic has been closed for replies.
Best answer by waclawek.jan

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

5 replies

waclawek.jan
Super User
September 4, 2018

> 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
zstevAuthor
Associate II
September 5, 2018

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
zstevAuthor
Associate II
September 5, 2018

Sorry ,forgot the attacted file , post it again.

waclawek.jan
Super User
September 6, 2018

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
zstevAuthor
Associate II
September 8, 2018

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 .