AnsweredAssumed Answered

STM32F0xx ADC Interrupt will not fire

Question asked by mcgilvra.albert on Oct 16, 2015
Using the STM32F072. Have set up the ADC to fire interrupt on end of conversion. It is not firing. I generated code using the latest STM32-CubeMX tool. Attached are resultant adc.c and adc.h. Also attached is full main. Below is pertinent part of main. I set a break-point in ADC1_COMP_IRQHandler() in interrupts.c (also attached) and it never fires. To verify that any interrupts were working I also set a breakpoint at SysTick_Handler() in interrupts.c and it fires fine. Any help would be greatly appreciated.

int main(void)
{
  hal_init();
  sysclock_init();
  gpio_init();

  //adc_init();
  MX_ADC_Init();          //McG
  MX_TIM2_Init();          //mcg
  __GPIOA_CLK_ENABLE();     //mcg This seems to be missing, can't find it anywhere so we'll do it here. stm32f0xx_hal_adc.c say's we have to.
  __GPIOB_CLK_ENABLE();     //mcg Ditto
  HAL_ADC_Start_IT(&hadc);     //mcg start ADC in interrupt mode.

  spi_init();

  vhf_init();
  uhf_init();

  sensors_init();

  rs485_init();
  gps_init();
  ir_efs_init();

  // After delay, shut off WS circuit
  HAL_Delay(100);
  uint8_t wet_wakeup = HAL_GPIO_ReadPin(WATERSENSE);
  HAL_GPIO_WritePin(WATERSENSE_ENABLE, GPIO_PIN_SET);

  if(wet_wakeup)
       rs485_wakeup(); // Wake up lower units

  // Start watchdog
  watchdog_init();

  // Software timers
  uint32_t last_sensors = HAL_GetTick();
  uint32_t last_led = HAL_GetTick();
  uint32_t last_wakeup = HAL_GetTick();
  uint32_t last_engineering = HAL_GetTick();
  uint32_t last_rs485_process = HAL_GetTick();

  while (1)
  {.......


Attachments

Outcomes