2018-06-03 07:07 AM
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-exti2018-06-03 09:53 AM
>>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.
2018-06-03 02:26 PM
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?
2018-06-04 12:06 AM
// 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.