In my nucleo L432KC, I have set Timer 1 for PWM generation, Timer 15 as a timer based interrupt and Timer 2 as PWM input mode. Timer 1 and Timer 15 works well until a point. My clock frequency is 2MHz. For example, I wanted a 50 kHz update event, so I set Timer 15 Precaler 0 and period 39. In that case, While(1) loop never executes, i.e, the program hangs.
When I start timer 2 as:
My timer 1 misbehaves. The program in general misbehaves. What could be happening here? It's like Timer 15 interrupt is taking all the control? Is something related with interrupts priorities? The purpose of Timer 15 is to fire an interrupt at 50 kHz. During this interrupt, I'm reading SPI data.
Pseudocode of interrupt routine:
Pull chip select down
Read SPI with HAL_SPI_Receive
Pull chip select up