How and where do I write my interrupt function? Working with CubeMX on a Nucleo
Hi,
I'm starting to work with a Nucleo-64 with a STM32F072RBT6.
I'm reading these documents and not really understandign them:
https://www.st.com/resource/en/datasheet/stm32f072c8.pdf
I configured the Timer1 correctly. I start it with these lines of code :
HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_1); //Start the channel in interrupt mode
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4); //Start this channel with no interrupt
I tested with a scope that these few lines work:
while (1)
{
/* USER CODE END WHILE */
HAL_Delay(1000);
TIM1->CCR4 = 1500;
TIM1->CCR1 = 1500;
HAL_Delay(1000);
TIM1->CCR4 = 500;
TIM1->CCR1 = 500;
/* USER CODE BEGIN 3 */
}
My question is how (what syntax ) do I write the code I want to put in the interrupt routine ?
Am I correct to assume that I should write it in this file : stm32f0xx_it.c
(It says so in the file.... so i'm pretty sure about that part.)
In an Atmel chip, I would just write:
ISR(TIMER1_OVF_vect){
//my code in here
{
What is it for an STM?
I read chapter 11.1.2 Initialization and de-initialization functions where these function are described breifly.
HAL_NVIC_SetPriority()
HAL_NVIC_EnableIRQ()
HAL_NVIC_DisableIRQ()
HAL_NVIC_SystemReset()
HAL_SYSTICK_Config()
I also read chapter 11.1.3 for the rest of the NVIC functions
It says (For the complete STM32 Devices IRQ Channels list, please refer to stm32f0xx.h file) I found said file. but I didn't find the list of IRQ Channels.
But whe it says (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f0xxxx.h)) I did not find that file.
I've dealt with IRQs and different IRQ priority in the past. But i don't seem to understand them in the ARM architecture.
Thank you for helping a someone new to STM and ARMs in general.