Working on a Differentially Steered robot, nothing new (except to me). I found some code on the web that sets up Timer2 in mode3 (Encoder mode) using PA0 & PA1. I have the contents of the TIM2->CNT register being displayed to an I2C LCD. All is good. Looking at the Datasheet (for the STM32F411RE), PA0 & PA1 can be used by either TIM2 or TIM5. TIM5 can ONLY use PA0 & PA1, whereas TIM2 can use an alternate set of pins/inputs. Looking at the Reference Manual, http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/DM00119316.pdf, it looks like the only thing I need to do is change the value of the RCC_APB1ENR (peripheral clock enable register) from a value of 0x00000001 to 0x00000008 to start using TIM5. But when I make the change, it appears like the I2C stuff quits working as nothings appears on the screen. Could someone point me in the right direction?

lcd.cls(); lcd.locate(0,0); // Move cursor to start of the first display line lcd.printf("Pulse cnt: "); lcd.locate(0,1); // Move cursor to start of the second display line lcd.printf("Dist Traveled:"); lcd.locate(0,2); // Move cursor to start of the third display line lcd.printf("Inches: "); lcd.locate(0,3); // Move cursor to start of the third display line lcd.printf("Feet: ");

while (true) { pCount = TIM2->CNT ; // Get current position from Encoder x = (pCount/4); // Get real count number lcd.locate(11,0); // Move cursor to start of the first display line lcd.printf("%i", pCount); lcd.locate(8,2); // Move cursor to start of the third display line lcd.printf("%5.2f", (x *(1/PPI))); lcd.locate(6,3); // Move cursor to start of the third display line lcd.printf("%4.2f", (x *(1/PPF))); wait(1.0); } }

When trying to use TIM5, this get changed to: pCount = TIM5->CNT ; // Get current position from Encoder

This is using the mbed online compiler, as I have yet to get the Keil MDK ARM compiler to work yet, though I think all I need to do is load the Legacy drivers. WIll do this when I get home.