cancel
Showing results for 
Search instead for 
Did you mean: 

cannot use NVIC_SetVector

JustSomeGuy
Senior

I am trying to write interrupts bare-metal style. When I try to set the interrupt vector for LPTIM1 (using B-L071Z-LRWAN1) using this method,

 

NVIC_SetVector(LPTIM1_IRQn, (uint32_t)&LPTIM1_IRQHandler);

 

the compiler gives me this error:

../Core/Src/main.c:87:48: error: 'LPTIM1_IRQHandler' undeclared (first use in this function); did you mean 'TIM6_IRQHandler'?
87 | NVIC_SetVector(LPTIM1_IRQn, (uint32_t)&LPTIM1_IRQHandler);

Which I find bizarre, since I am not using timer 6, and LPTIM1_IQRHandler is listed in startup_stm32l072czyx.s. I tried declaring LPTIM1_IRQHandler as an extern, but with no success. Attached is the startup file.

How do I fix this?

11 REPLIES 11

Where is main.c getting its prototype for the LPTIM1_IRQHandler() ?

The body is in the it.c file, do you have a prototype for it in main.h ?

This is the compiler complaining, not that the Linker can't find the body, weak or otherwise. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks for your response, Tesla. It turns out that not having the prototypes in main.h was the exact problem. It makes sense in hindsight. Appreciate it!