cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with HAL_ADC_Start_IT(&hadc1)

nipri33
Associate II
Posted on September 15, 2016 at 23:01

The original post was too long to process during our migration. Please click on the attachment to read the original post.
7 REPLIES 7
nipri33
Associate II
Posted on September 16, 2016 at 16:55

UPDATE: If I don't call HAL_NVIC_EnableIRQ(ADC1_IRQn) the code will run so I am probably not handling the first interrupt request properly (?)

nipri33
Associate II
Posted on September 16, 2016 at 20:45

Another update: When I single-step into HAL-NVIC_EnableIRQ() and HAL_ADC_StartIT() until my program breaks, wind up in the default handler / infinite loop inside of startup_stm32f302x8.s Not sure why I'm getting an ''unexpected'' interrupt...

Walid FTITI_O
Senior II
Posted on September 16, 2016 at 20:55

Hi ipri.nicholas.002,

I recommend to get help from the ADC examples in the STM32CubeF3. Compare the code there with your code to gigure out what is missed there.

-Hannibal-

nipri33
Associate II
Posted on September 16, 2016 at 21:08

My code looks to be consistent with the examples I've looked at (so far)

nipri33
Associate II
Posted on September 16, 2016 at 22:44

BTW, the following lines should be ignored. I should have commented out __HAL_ADC_ENABLE_IT() before posting. These lines were from somethin I found online that didn't make a difference anyway.

//  __HAL_ADC_ENABLE(&hadc1);

//  while (__HAL_ADC_GET_FLAG(&hadc1, ADC_FLAG_RDY) == RESET);

     __HAL_ADC_ENABLE_IT(&hadc1, ADC_IT_EOC);

nipri33
Associate II
Posted on September 19, 2016 at 16:12

So far, the code examples I have found in cube, or online are of little to no help although I am following them faithfully while also following UM1786 Since I am on a short development schedule, I will probably move onto using a different processor

nipri33
Associate II
Posted on September 20, 2016 at 17:34

FWIW: The solution was to rename ADC_IRQHandler() to ADC1_IRQHandler(). The majority of online examples I've seen use the former. Also, the STM32CubeMX tool code generator for the ADC does not seem to allow for the enabling and handling of interrupts.