Beginner programmer...EASY Question...Trying to understand timers and interrupts
Im trying to configure a timer on my STM32F3 discovery board. I want to generate an interrupt at approximately a 128khz rate. My partner claims that the code below would do this but im not understanding how or why??? Can someone explain the significance of each of these lines of code below and how in the world they help achieve the 128khz rate?
Also, my Timer 6 input clock and System Core Clock are at 72Mhz. TIM6->CR1 = 0x0001; TIM6->CR2 = 0x0000; TIM6->DIER = 0x0001; TIM6->PSC = 0x0010; TIM6->ARR = 0x0021; so far all I know is this...TIM6->CR1 = 0x0001; //set the timer counter configuration register 1 to equal 1…
TIM6->CR2 = 0x0000; //set the timer capture configuration register 2 to equal 0…
TIM6->DIER = 0x0001; //set the timer control register to 1…this enables the update interrupt
TIM6->PSC = 0x0010; //setting the prescale register to 16…divides the clock source by 16TIM6->ARR = 0x0021; //Set the timer auto-reload register to 33…