yoneken / rosserial_stm32

This is a part of [rosserial](https://github.com/ros-drivers/rosserial) repository to communicate with ROS system through a USART for STM32 embedded system.
BSD 2-Clause "Simplified" License
218 stars 72 forks source link

HardFault_Handler #34

Closed davutcanakbas closed 2 years ago

davutcanakbas commented 3 years ago

While doing all the necessary steps and debugging through Stm32F407, it enters the HardFault_Handler interrupt and the program does not run. When I examine the stage after which it entered, it enters after the following line of "STM32Hardware.h" file.

 inline uint32_t getRdmaInd (void) {return (rbuflen - __HAL_DMA_GET_COUNTER (huart-> hdmarx)) & (rbuflen - 1); }

Any advice please.

19matt commented 3 years ago

I had a similar problem. I determined that I wasn't initializing my huart properly. Mainly, I detemined that the __HAL_DMA_GET_COUNTER(huart-> hdmarx) part of this line is what was causing my error. If you're not using the example project or using a different board, I'd suggest using the .ioc file from one of the examples to make sure you give the correct parameters to your board's specific UART port. If you determine you're initilizing it properly, then the error might be not associating the huart pointer to the "STM32Hardware.h" file.