I am using the Maple to read a quadrature encoder. I followed the instructions in the STM Reference Manual on pages 360-362 and got things working. I can hook up an encoder to channels 1 and 2 of a timer (timer 4 in my case) and the counter is able to count the pulses from the encoder. This works very well, except that I need 4x decoding, and it appears that I can only get 1x (TIM4_SMCR:SMS=001) and 2x (TIM4_SMCR:SMS=011) decoding, meaning that the counter is only clocking on rising edges. However, the Reference Manual implies that it is possible to clock on rising and falling edges (see Figure 134).
Here is my code that I use to set up the timer:
Timer* encoderTimer;
encoderTimer = (Timer*)TIMER4_BASE;
encoderTimer->CCMR1 |= 0x0001; //CC1S=01
encoderTimer->CCMR1 &= ~(0x0002);
encoderTimer->CCMR1 |= 0x0100; //CC2S=01
encoderTimer->CCMR1 &= ~(0x0200);
encoderTimer->CCER &= ~(0x0002); //CC1P=0
encoderTimer->CCER &= ~(0x0020); //CC2P=0
encoderTimer->SMCR |= 0x0003; //SMS=011
encoderTimer->SMCR &= ~(0x0004);
encoderTimer->SMCR &= ~(0x0F00); //no filter
encoderTimer->CR1 |= 0x0001; //CEN=1
encoderTimer->CNT = 0x0000; //reset the counter before we use it