cancel
Showing results for 
Search instead for 
Did you mean: 

Timer interrupts

grzeniux
Associate II

Hi
I have a problem with the right priority setting, although I am not sure.
The genelranie timer worked for me and refreshed the LCD screen every 375ms, but when I added interrupts for the ADC (needs to handle a potentiometer) then suddenly the TIM6 stopped working. Debugging the code I noticed that after going through this instruction:
HAL_TIM_Base_Start_IT(&htim6);
terminates the program, it just doesn't continue. This can be seen in the posted screenshots.
Do you have any ideas? I also tried using DMA and unfortunately the effect was the same :(

1_debug.png

 

2_conf.png

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

It's stuck in the ADC handler, so either the ADC is triggering too often (most likely) or there is some flag not being cleared by the handler (less likely).

Reduce your ADC trigger frequency to, say, max 10 kHz.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

5 REPLIES 5
TDK
Guru

Hit pause, see where execution is at. Probably you are swamped with interrupt requests, or your interrupt handler is stalling. Could be due to ADC being triggered repeatedly.

If you feel a post has answered your question, please click "Accept as Solution".
grzeniux
Associate II

It stopped here. But it doesn't tell me anything. How do I fix it?3.jpg

 

 

 

EDIT:

The earlier screen was after small modifications
Below is consistent with the information contained in the start of the thread

4.jpg

TDK
Guru

It's stuck in the ADC handler, so either the ADC is triggering too often (most likely) or there is some flag not being cleared by the handler (less likely).

Reduce your ADC trigger frequency to, say, max 10 kHz.

If you feel a post has answered your question, please click "Accept as Solution".

Ok it worked after setting the Timer to 10kHz - the code moved on
BUT
now the ADC doesn't work, did I set everything right?

When doing the ADC I suggested this article: https://controllerstech.com/stm32-adc-single-channel/

 

5.png6.jpg

grzeniux
Associate II

Could someone please check?