2019-03-26 02:28 PM
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.
Solved! Go to Solution.
2019-03-26 04:54 PM
The interrupts will all be listed in the vector table in startup.s
For coverage of NVIC, perhaps try Joseph Yiu's Essential Cortex Mx series.
The interrupt handlers are often live in stm32f0xxx_it.c
In the HAL model your TIM1_IRQHandler() typically calls back into the HAL, and it in turn calls the routine you provided as a callback. This is highly circuitous, and you can chose to do it differently.
2019-03-26 04:54 PM
The interrupts will all be listed in the vector table in startup.s
For coverage of NVIC, perhaps try Joseph Yiu's Essential Cortex Mx series.
The interrupt handlers are often live in stm32f0xxx_it.c
In the HAL model your TIM1_IRQHandler() typically calls back into the HAL, and it in turn calls the routine you provided as a callback. This is highly circuitous, and you can chose to do it differently.
2019-04-04 08:07 AM
Thanks,
I managed to get Cube MX to generate the emtpy interrupt fonction
TIM1_CC_IRQHandler(void)