Skip to main content
DSaha.3
Associate II
May 30, 2021
Question

I am creating a codes from STM32CubeMx. Every code generated from the CubeMx (6.2.1) is going in hard fault when I open in CubeIde (Ver 1.6.1). I could not understand where is the problem?

  • May 30, 2021
  • 12 replies
  • 2723 views

Request cumunity member to guide on this topic. I am unable to download any single code which is generated from the CubeMx for Cubeide. Each generated code is going in hard fault.

Please tell me the issue and suggest correct way if I am doing any mistake or may someone has already faced this kind of issue.

Regards,

Dnyanesh

This topic has been closed for replies.

12 replies

MM..1
Super User
May 30, 2021

Try send ioc file example

DSaha.3
DSaha.3Author
Associate II
May 30, 2021

This is the only configuration I was trying when it was not working with multiple configuration.

I had pasted here the ioc file snap but its not visible.

What should I share with you?

TJM
Senior II
May 30, 2021

OS and error codes?

DSaha.3
DSaha.3Author
Associate II
May 30, 2021

Windows OS. Where I will get the error code??

Code is directly jumping to Hard fault function.

TDK
May 30, 2021

Examine the SCB registers to determine the cause of the hard fault.

Consider adding details on what board you're using, and what your code does. Hard to debug problems with no detail provided. In general, the CubeMX generated stuff will not cause hard faults.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DSaha.3
DSaha.3Author
Associate II
May 31, 2021

Hello TDK,

I would just provide you the details that its new developed board for my application. Other codes are working which I have generated initially and I working on application code as well. Only whatever code I am generating from CubeMx each code going in hard fault.

I dont know what exactly where is the issue in Cubeide or CubeMx. I have reinstalled CubeMx but still same issue I am facing.

Hgfdg.1
Visitor II
May 31, 2021

I am also working on a similar task and looking for its solution I tried hard to solve it but did not find the reason behind it please help us to solve this issue.

Amel NASRI
ST Technical Moderator
June 2, 2021

Hi @DSaha.3​ ,

Make sure that clock is configured properly. If an external oscillator is configured as clock source, please review your hardware setup.

In such case, you can check using HSI for example as clock source.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
DSaha.3
DSaha.3Author
Associate II
June 2, 2021

Hello Amel,

With external clock the board setup is working on another code which I have created earlier in the cubeIde. Example code with external clock settings also I tested and it is working.

​

Only those codes are generated from the CubeMx which are not working.

​

Regards,

Dnyaneshwar ​

Amel NASRI
ST Technical Moderator
June 3, 2021

Hi @DSaha.3​ ,

Does problem occur with only clock & peripherals initialization? If yes, you can share an ioc file for farther check.

If you add some processing code, review what you added to identify a possible root cause.

One more tip: you can use the Hard Fault Analyzer of STM32CubeProgrammer to help you identify the root cause in your case.

You need to refer to UM2237 STM32CubeProgrammer software description (section 2.13 Hard fault analyzer) for more details on the how to.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.