2022-06-19 02:43 AM
In order to get PWM output to PB5, I configurated the Channel2 of TIM3 to be "PWM Generattion CH2" and the PB5 pin to "TIM3_CH2". Then, the code generated and imported into STM32CubeIDE, the pointer stopped at "void HardFault_Handler(void)" function in "stm32fxxx_it.c" file. I found there are several tips reported the similar problem, but however, none of the sulutions such as comment "__HAL_AFIO_REMAP_TIM3_PARTIAL()" function and write the "AFIO_MAPR" register directly works for me. There are no differences between using ST-LINK JTAG and SWD -- both of which raises the same error.
I'm using STM32Cube FW_F1 V.18.4 with ST-Link/V2.
2022-06-19 05:50 AM
Then look at what the Hard Fault is actually reporting as the location of the fault.
Perhaps an issue with the IRQ Handler, or a structure, instance or call-back that's not completely initialized.
2022-06-19 06:22 PM
It seems that the "IBUSERR" bit of CFSR register is 1 while others are all 0.