cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB Direct Hardfault Handler on new project generated in Cube IDE

christian-enderle
Associate

Hello,

I've just bought the STM32WB Nucleo Kit to develop an application. I've programmed with MCUs in the past mainly Arduino but also with the ATMega 168 directly. To learn how to use the STM32 I started watching this playlist from YouTube which is directly from STM (https://www.youtube.com/playlist?list=PLnMKNibPkDnGtuIl5v0CvC81Am7SKpj02). When I watched the HAL test program which toggles the led I wanted to test it myself. I know in the videos he uses the STM32F4 but he said it would work with other STM32s too but you maybe had to change some things. So I downloaded the STM32Cube IDE on Ubuntu (and later on Windows to eliminate any os regarding faults). There I created a new project for the nucleo board. I set the pin with the blue led (PB5) to GPIO Output or in another project I used the defaults from the nucleo board (wher it was set as gpio output). After that I generated the code and added to the while loop the code he added but with my pin:

HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5);
HAL_Delay(500);

When I debugged my code (I couldn't figure out how to just flash from within the ide) nothing happened except that the COM LED blinks red-green. When I paused it said the MCU was in the Hardfault Handler. In my troubleshooting i tested a new generated code (from CubeMX) without any modifications but still the same happened. The last thing I did was to import a example project from the repository (Repository\STM32Cube_FW_WB_V1.1.0\Projects\P-NUCLEO-WB55.Nucleo\Examples\GPIO\GPIO_IOToggle). Debugging (in other words flashing to the MCU) this worked. But when I copied the code and pasted the code into a new generated project (and changed some things because they werent defined there) it didn't work. I don't know what to do now to solve this problem. I could always copy an example and change the code there but this is not a very good workaround. If anyone could help me I would be grateful.

Thanks

Also I don't write often in forums so if I for example gave too much background information or could give more details just let me know.

4 REPLIES 4
BoardSurfer
Associate II

I have the same problem, and I'm also new to the STM32WB nucleo kit. I have some experience with CubeIDE using an STM32F0-discovery kit. everything works fine there.

With this board so far, I've just created a default STM32 project by selecting the nucleo-68 board and initializing it with the defaults (Which by the way aren't great, as there are many peripheral conflicts). I'll keep trying different things and keep an eye on this thread.

Thanks!

BoardSurfer
Associate II
BoardSurfer
Associate II

Update: you can find the answer in the link above

Thank you it worked now.