2024-03-06 10:23 PM - last edited on 2024-03-07 03:43 AM by SofLit
Using NUCLEO F756ZG & STM Cube IDE
I am trying to setup & enable interrupt for TIM4
The compiler is not happy with these 4 lines of code
TIM4->ARR=5000;
NVIC_SetVector(TIM4_IRQn, (uint32_t)&TIM4_IRQHandler);
NVIC_SetPriority(TIM4_IRQn,0);
NVIC_EnableIRQ(TIM4_IRQn);
TIM4->DIER|=TIM_DIER_UIE;
TIM4->CR1 |= 0x1;
Error#1
for line
NVIC_SetVector(TIM4_IRQn, (uint32_t)&TIM4_IRQHandler);
//NOTE: TIM4_IRQHandler() is declared
it gives this error
../Core/Src/main.c: In function 'main':
../Core/Src/main.c:100:40: error: 'TIM4_IRQHandler' undeclared (first use in this function); did you mean 'RNG_IRQHandler'?
100 | NVIC_SetVector(TIM4_IRQn, (uint32_t)&TIM4_IRQHandler);
| ^~~~~~~~~~~~~~~
| RNG_IRQHandler
Error#2
For lines
NVIC_EnableIRQ(TIM4_IRQn);
TIM4->DIER|=TIM_DIER_UIE;
the compiler gives..
Error in final launch sequence:
Setup exceptions
Setup exceptions
I was wondering if any one has encounterd these errors
The Timer4 is he only peripheral I have in my program
Any comments/feedback appreciated
Thanx
Jay
2024-03-07 03:40 AM
Hello,
TIM4_IRQHandler() is generally declared in xxx_it.c file.
Could you please attach your project package as we can have a close up look?
2024-03-19 08:55 PM
Hi SofLit,
I retried running the project & the problem seems to have gone away
Not sure what I did but I am not able to reproduce the issue
I think I will close this problem request - may be bring it up If I face the problem again
Thanx for your help
Jay