cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in clock configuration in CubeMX 6.4.0

KORou.1
Associate II

When trying to use the "List pinout compatible MCUs" feature to move an existing CubeMX project to a different MCU I get incorrect clock calculations in the clock configuration tab.

For example, starting with a project for STM32L451RETx and then using "List pinout compatible MCUs" to switch to an STM32L451RCTx I lose the existing clock configuration and have to redo it manually.

In the original project it looked like this:

0693W00000KcX4MQAV.pngafter switching MCU and reconfiguring I get this:

0693W00000KcX5FQAV.png 

I'm fairly sure that 16 MHz / 1 * 10 / 2 should be 80 MHz and not 40.

The same problem exists in CubeMX 6.1.0. I couldn't test in CubeMX 6.5.0 because the list of pinout compatible MCUs never stops loading in that version.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Community member​ ,

You are totally right, issue reproduced and confirmed from my side.

It seems that the source of the problem is the HSE input frequency. After the import, we are supposed to get the default clock config. But in this case the HSE input frequency kept its value from the previous project (16MHz) and didn't get back to default (8MHz).

It seems that CubeMX is using the default value (8MHz) in the calculation (8 MHz / 1 * 10 / 2 equals 40) but somehow displays the value (16MHz).

The workaround for this issue is simple you just need to put your cursor on the HSE Input frequency and press on enter. By doing this you will see that the SYSCLK automatically changes its value to 80MHz.

I submitted a ticket to the dev team to solve this issue. I will keep you posted :)

Internal ticket number: 126011 (This is an internal tracking number and is not accessible or usable by customers).

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks for your contribution,

Sara.

View solution in original post

6 REPLIES 6
Sara BEN HADJ YAHYA
ST Employee

Hello @Community member​ ,

Thanks for your feedback and I apologize for the late reply,

Actually the List Pinout Compatible MCUs does not concern the clock config, it only concerns the Pinout config. However there is another method that conserves both configuration which is the Import Project method.

Please check STM32CubeMX user manual UM1718 section 4.10, it contains more details about the Import Project Window.

About the list of pinout compatible MCUs in CubeMX v6.5.0, you are right and I confirm the issue. It is now reported to the dev team to be fixed. I will keep you posted with the updates.

Internal ticket number: 125055 (This is an internal tracking number and is not accessible or usable by customers).

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks for your contribution,

Sara.

Hi @Sara BEN HADJ YAHYA​ ,

Thanks for the tip about "Import Project".

I realised that clock configuration wasn't preserved, it was quite easy to re-apply the same configuration to the new MCU.

However, that doesn't explain why the clock arithmetic is wrong for the new MCU. For the new MCU with 16 MHz HSE selected as PLL source mux, PLLM set to /1, *N set to x10, /R set to /2 and PLLCLK set as system clock source I get a system clock of 40 MHz when it should be 80 MHz (16 / 1 * 10 / 2).

Sorry, I should have highlighted the values in the screenshots to make it clearer what the problem is. I've uploaded a new version of the screenshot with the relevant values highlighted.

Hello @Community member​ ,

I saw the values in the snapshot and I confirm that the config is not correct, as you said 16 MHz / 1 * 10 / 2 should be 80 MHz and not 40. When I tried to reproduce it from my side I didn't get the same value as you, instead I got the default clock config and it was correct.

Sara.

Hi @Sara BEN HADJ YAHYA​ 

Yes, I also got the default config after switching MCU. It seemed to be this specific sequence that triggered the problem:

  1. Switch MCU (STM32L451RETx to STM32L451RCTx)
  2. (get default clock configuration)
  3. Attempt to change clock configuration to match the orginal
  4. Get 40 MHz system clock when I expected 80 MHz.

It's possible there's something else in our configuration that's required to trigger this. Let me know if you want any more information.

Hello @Community member​ ,

You are totally right, issue reproduced and confirmed from my side.

It seems that the source of the problem is the HSE input frequency. After the import, we are supposed to get the default clock config. But in this case the HSE input frequency kept its value from the previous project (16MHz) and didn't get back to default (8MHz).

It seems that CubeMX is using the default value (8MHz) in the calculation (8 MHz / 1 * 10 / 2 equals 40) but somehow displays the value (16MHz).

The workaround for this issue is simple you just need to put your cursor on the HSE Input frequency and press on enter. By doing this you will see that the SYSCLK automatically changes its value to 80MHz.

I submitted a ticket to the dev team to solve this issue. I will keep you posted :)

Internal ticket number: 126011 (This is an internal tracking number and is not accessible or usable by customers).

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks for your contribution,

Sara.

Sara BEN HADJ YAHYA
ST Employee

Hello @Community member​ 

The issue regarding the list of pinout compatible MCUs is fixed in STM32CubeMX latest release.

V6.6.0 is now available under this Link.

Thanks for your contribution.

Sara.