cancel
Showing results for 
Search instead for 
Did you mean: 

On a STM32L0 platform - any reason why enabling HAL_NVIC_EnableIRQ(ADC1_COMP_IRQn) would stop / disable EXTI4_15_IRQn ??

David Smith
Associate II
Posted on June 03, 2018 at 16:07

static void EXTILine0_1_Config(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

/* Enable GPIOC clock */

__HAL_RCC_GPIOA_CLK_ENABLE();

/* Configure PA0 pin as input floating */

GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;

GPIO_InitStructure.Pull = GPIO_NOPULL;

GPIO_InitStructure.Pin = GPIO_PIN_4; // DAS - To configure MORE than 1 pin - Just 'or' them together...

GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH ;

HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);

/* Enable and set EXTI4_15 Interrupt to the lowest priority */

HAL_NVIC_SetPriority(EXTI4_15_IRQn, 3, 0);

HAL_NVIC_EnableIRQ(EXTI4_15_IRQn);

}

void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)

{

GPIO_InitTypeDef GPIO_InitStruct;

//♯♯-1- Enable peripherals and GPIO Clocks ♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯

// Enable GPIO clock ****************************************

__HAL_RCC_GPIOA_CLK_ENABLE();

// __HAL_RCC_GPIOB_CLK_ENABLE();

// ADC1 Periph clock enable

__HAL_RCC_ADC1_CLK_ENABLE();

//♯♯- 2- Configure peripheral GPIO ♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯

// ADC3 Channel8 GPIO pin configuration

GPIO_InitStruct.Pin = GPIO_PIN_0; // GPIO_PIN_0

GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;

GPIO_InitStruct.Pull = GPIO_NOPULL;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); //GPIO

//♯♯-3- Configure the NVIC ♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯

// NVIC configuration for ADC EOC interrupt

HAL_NVIC_SetPriority(ADC1_COMP_IRQn, 0, 0);

// HAL_NVIC_EnableIRQ(ADC1_COMP_IRQn);  // <<--- All works until this line is uncommented and executed

}

#stm32-stm32l0-irq-interrupt-adc-exti
3 REPLIES 3
Posted on June 03, 2018 at 18:53

>>any reason why?

That the IRQHandler doesn't clear the underlying source, or the source causes saturation.

Have the ADC1_COMP_IRQHandler toggle a GPIO on entry, and scope.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 03, 2018 at 21:26

Hmmm..... Toggling the GPIO on entry and scope seems like an odd solution.      My worry would be they are unrelated - GPIO = Button press (which when i toggle physically...doesnt trigger an IRQ anymore.)

Can you elaborate a little bit more?

Posted on June 04, 2018 at 07:06

// HAL_NVIC_EnableIRQ(ADC1_COMP_IRQn); // <<--- All works until this line is uncommented and executed

what code is running on this interrupt ?

you will have t show us...

Turvey.Clive.002

‌ has suggested that you know what you are doing, when you see the pin toggle on the scope from the interrupt.

it is a cunning plan.