cancel
Showing results for 
Search instead for 
Did you mean: 

B-G431B-ESC1 HardFault with MCW generated code

skip_shane
Associate II

I generated some code with the default "Electronic speed control on B-G431B-ESC1 kit" project in Motor Control WorkBench.  Then when I flash the default code I get a HardFault when calling `__HAL_FLASH_PREFETCH_BUFFER_ENABLE()` in  `HAL_Init()`:

int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

...

HAL_StatusTypeDef HAL_Init(void)...

#if (PREFETCH_ENABLE != 0U)
  __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
#endif /* PREFETCH_ENABLE */

MC Workbench v6.2

CubeMX version 6.9.2

CubeIDE version 1.14.0

 

1 ACCEPTED SOLUTION

Accepted Solutions
GMA
ST Employee

Hello,

I was able to pass the HAL_init step on "ElectronicSpeedControl_ESC-G4" example with MC Workbench v6.2, CubeMX version 6.9.2, CubeIDE version 1.14.0, (Firmware Package Version STM32 FW V1.5.1) and Drive Type LL or HAL.

Could you please check that via IDE you have access to FLASH registers as below?

GMA_0-1702476811235.png

 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

View solution in original post

3 REPLIES 3
GMA
ST Employee

Hello,

I was able to pass the HAL_init step on "ElectronicSpeedControl_ESC-G4" example with MC Workbench v6.2, CubeMX version 6.9.2, CubeIDE version 1.14.0, (Firmware Package Version STM32 FW V1.5.1) and Drive Type LL or HAL.

Could you please check that via IDE you have access to FLASH registers as below?

GMA_0-1702476811235.png

 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

I tried regenerating the project and was able to pass this init step without hardfault.  The only other thing I did was update STLink.  Not sure why the problem went away but thank you.

GMA
ST Employee

Hello,

Thank you for your feedback!

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA