cancel
Showing results for 
Search instead for 
Did you mean: 

Getting HardFault in the STemWin HelloWorld example when adding ADC

MMoha.3
Associate III

I wanted to add some more features to the STemWin example that is present in HelloWorld folder in the stm32F429 discovery board directory of the repository on my discovery board.

I wanted to add the following features.

An external trigger pin,

A tripple interleaved ADC working via DMA,

A dac

But as soon as I run the function for the external trigger pin initialization in the main function the LCD stops working and the debugger shows that it's stuck in the HardFault handler.

This also happens when I add the HAL_ADCEx_MultiModeStart_DMA function in the main.

I have tried the same program without the LCD and there's no problem with the trigger or ADC codes.

Here's the trigger GPIO initialization code:

void GPIO_INIT_EXTI (void) {
	GPIO_InitTypeDef GPIO_InitStruct = {0};
	//__HAL_RCC_GPIOE_CLK_ENABLE ();
	/*Configure GPIO pin : EX_TRG_Pin */
	GPIO_InitStruct.Pin = EX_TRG_Pin;
	GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
	GPIO_InitStruct.Pull = GPIO_NOPULL;
	HAL_GPIO_Init(EX_TRG_GPIO_Port, &GPIO_InitStruct);
//	HAL_NVIC_SetPriority(EXTI0_IRQn, 1, 0);
//	HAL_NVIC_EnableIRQ(EXTI0_IRQn);
	HAL_NVIC_SetPriority(EXTI9_5_IRQn , 1, 0);
	HAL_NVIC_EnableIRQ(EXTI9_5_IRQn );
}

The commented lines were not commented in the beginning, I suspected they might be the problem and I commented them but nothing changed. I also changed the priority of the interrupt event.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Is the handler for EXTI9_5_IRQn actually implemented? It could just be aliased to HardFault_Handler.

Instrument the hard fault handler and see why it's being called.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

Is the handler for EXTI9_5_IRQn actually implemented? It could just be aliased to HardFault_Handler.

Instrument the hard fault handler and see why it's being called.

If you feel a post has answered your question, please click "Accept as Solution".
MMoha.3
Associate III

OMG you saved my life

thank you!