cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-F401RE + x-cube-ble1: Hard Fault

BareMetaler
Associate II

I’m attempting to learn BLE and IoT and have purchased the following boards to get started.

NUCLEO-F401RE    MCU brd

X-NUCLEO-IDB05A2  BLE Expansion brd

Downloaded:

STM32CubeIDE Version: 2.0.0 Build: 26820_20251114_1348 (UTC)

STM32CubeMX Version: 6.16.1

x-cube-ble1   BLE Demo

The main program calls HAL-Init() which goes directly to the HardFault_Handler()

My preliminary conclusion is that Version 20.0.0 is not compatible with the demo program based on help I sought on ChatGPT. It recommends Version 1.19.0. Is this correct?

May need to back up and start from scratch and would appreciate a point in the right direction to avoid going down any unnecessary rabbit holes.

Thank you, BareMetaler

18 REPLIES 18
Issamos
Lead II

Hello @BareMetaler 

I don’t think this issue is related to the IDE version. Are you using a personal project or one of the available examples?

Best Regards.

II

KnarfB
Super User

The HAL source code version is independent of the IDE version. 

HAL_Init does only the most basic initialization and is not specific to a demo.

So your HW+SW setup may have some general issue.

I doubt that changing the IDE version may fix that, but you may try.

The IDE comes with a hard fault analyzer and you may dig into that

or start with a new empty project to verify your HW+SW setup.

hth

KnarfB

gbm
Principal

Oh, that's quite simple as soon as you realize that "to avoid going down any unnecessary rabbit holes" is the same as "to avoid ChatGPT".

Stay away from AI-generated stuff, use the official ST demo code. Also, the proper platform for modern BLE development is STM32WB series.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Andrew Neil
Super User

@BareMetaler wrote:

HAL-Init() which goes directly to the HardFault_Handler()


What do you mean by that?

Have you stepped into HAL_Init() to see exactly where the Hard Fault happens, and what causes it?

 

Debugging Cortex-M (including STM32) Hard Faults.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User

@BareMetaler wrote:

ChatGPT. It recommends Version 1.19.0. Is this correct?


It is out of date - v2.0.0 was released on 18 November:

STM32CubeIDE 2.0.0 released

 

Note that the big difference between v2.0.0 and v1.x.x is that CubeMX is no longer integrated - it is now just a standalone tool:

STM32CubeIDE 2.0.0 workflow tutorial

 

So this means that a lot of tutorials & documentation (both ST's and 3rd parties) are now out-of-date.

In that respect, you might find it easier to use an earlier version of CubeIDE - such as v1.19.0

 

Note that you can have multiple versions of CubeIDE all installed at the same time and working independently - you just need to keep a separate workspace for each.

 

If you want to use AI, ST's own "Sidekick" might be a better bet:

STM32 Sidekick: the AI-powered tool that accelerates your design journey

How to use STM32 Sidekick

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

I'm using the x-cube-ble1 demo program that I downloaded. To test the program, I installed the ST BLE Sensor app on my my iPhone, then subsequently loaded the nRF Connect app, but haven't tried that yet because of how the program is jumping straight to the HAL-Init() > HardFault_Handler().

So you're saying that my NUCLEO-F401RE won't work to do a simple BLE demo?

I am using the ST demo code that I downloaded from the STMicroelectronics site. Where else would I get it?

I downloaded the BLE demo as a way to verify my HW-SW setup. What you do recommend I do?

BareMetaler
Associate II

Let me start over here. I need to know if I can even get there from here, one or zero, yes or no. I just bought these items through Digikey, brand new out of the box.

 

NUCLEO-F401RE    MCU brd

X-NUCLEO-IDB05A2  BLE Expansion brd

Downloaded:

STM32CubeIDE Version: 2.0.0 Build: 26820_20251114_1348 (UTC)

STM32CubeMX Version: 6.16.1

x-cube-ble1   BLE Demo