cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32L4R5 GPIO Interrupt Enable causes issue.(FreeRTOS)

POval.1
Associate II

Hello Everyone,

Hope all are doing well.

I am currently working with a board based on STM32L4R5 in FreeRTOS environment.

I have two UARTS and some GPIO connected.

I have one task monitoring the UART data. Both UART have an associated ISR

These ISR place the received data onto a queue. This queue is accessed from the task to perform some action.

I have programmed one GPIO for Rising edge trigger interrupt.

void testInitGPIOInterrupt( void )
{
	// PC 13
	uint8_t pinNumber;
	uint32_t temp;
 
	pinNumber = 13;
 
	RCC->AHB2ENR |= ( 1 << RCC_AHB2ENR_GPIOCEN_Pos );
 
	RCC->APB2ENR  |= ( 1 << RCC_APB2RSTR_SYSCFGRST_Pos );
	SYSCFG->EXTICR[(pinNumber/4)] &= ~(0xF << ((pinNumber % 4) * 4));
	SYSCFG->EXTICR[(pinNumber/4)] |=  (0x2 << ((pinNumber % 4) * 4));
 
 
	//enable the exti interrupt delivery using IMR Interrupt mask register 1
	EXTI->IMR1 |= ( 1 << pinNumber );
	//  Enable the 'rising edge' trigger
	EXTI->RTSR1 |= ( 1 << pinNumber );
	// Disable the 'falling edge' trigger
	EXTI->FTSR1 &= ~( 1 << pinNumber );
 
 
	GPIOC->MODER &= ~( 0x3 << ( pinNumber*2 ) );
	GPIOC->PUPDR &= ~( 0x3 << ( pinNumber*2 ) );
	GPIOC->PUPDR |= ( 0x0 << ( pinNumber*2 ) );
 
	// Enable IRQ
	NVIC_SetPriority( EXTI15_10_IRQn, 6 );
	NVIC_EnableIRQ ( EXTI15_10_IRQn );
}

But when I enable this interrupt, the application just stops working.

I have tried enabling the GPIO interrupt without FreeRTOS. I was able to detect the interrupts.

The ISR is just:

void EXTI15_10_IRQHandler( void )
 
{
	uint32_t pending = EXTI->PR1;
	if(pending & (1 << 13))
	{
		EXTI->PR1 |= 1 << 13;
	}
}

Can anybody please direct me if I am missing something.

Thank you.

1 REPLY 1

Hello @POval.1​ ,

Can you please share your project for further check ?

Thanks in advance.

BeST Regards,

Walid