Guten Tag zusammen!
Ich arbeite mit dem STM32F107VC, uVision von Keil
Ich möchte mit dem Timer2 arbeiten, habe ihn als downcounter
eingestellt. Bei underflow möchte ich einen Interrupt auslösen.
Das Problem ist, dass bei jedem Zählschritt ein Event, also ein
Interrupt ausgelöst wird! Habe aber das 2 Bit von CR2 gesetzt:
Bit 2 URS: Update request source: 1: Only counter overflow/underflow
generates an update interrupt or DMA request if enabled.
1 | // Timer2
|
2 |
|
3 | TIM2 -> CR1 = 0x0000001C;//
|
4 | TIM2 -> CR2 = 0x00000000;//CONTROLLREG2; // Reset Controllregister 2
|
5 | TIM2 -> PSC = 0x00000000;//PRESCALE; // Prescaler
|
6 | TIM2 -> ARR = 0x0000FFFF;//AUTORELOAD; // Auto-Reload Register
|
7 | TIM2 -> CCMR1 = 0x00000000;//COMPAREMODREG1; // Compare Mode Register 1 Outputcompare Mode
|
8 | TIM2 -> CCMR2 = 0x00000000;//COMPAREMODREG2; // Compare Mode Register 2 Output Compare 1 Mode; Output Compare 2 Mode
|
9 | TIM2 -> CCER = 0x00000000;//COMPAREENABLEREG; // Compare Enable Register; Compare 1 Output Enable; Compare 2 Output Enable
|
10 | TIM2 -> SMCR = 0x00000000;//SLAVEMODECONTROLLREG; // Slave Mode Controll Register
|
11 | TIM2 -> CCR1 = 0x00000000;//COMPAREREG1; // Compare Register 1
|
12 | TIM2 -> CCR2 = 0x00000000;//COMPAREREG2; // Compare Register 2
|
13 | TIM2 -> SR = 0x00000000;//STATUSREG; // Status Register: Interrupt Flagbits
|
14 | TIM2 -> DIER = 0x00000001;//INTERRUPTENABLEREG; // Interrupt Enable Register: Interrupt Compare 1 und Compare 2 enable
|
15 | TIM2 -> EGR = 0x00000000;//EVENTGENERATREG; // Event Generator Register: Update generation; Compare 1 Generation / Compare 2 Generation
|
16 | TIM2 -> BDTR = 0x00000000;//BRAKDEATTIMEREG; // Lock off, break inputs disable
|
Was habe ich übersehen oder weis jemand, was falsch ist??
Vielen dank und Gruss!