Code: Select all
timer17.setMode(1, TIMER_OUTPUT_COMPARE_PWM1, PA7_ALT3); // AF1 = TIM17_CH1
timer17.setMode(1, TIMER_OUTPUT_COMPARE_PWM1, PB7_ALT2); // AF1 = TIM17_CH1N /// mashes PA7 = CH1
TIM17->CCR1 = 5;
timer17.setPrescaleFactor(170 - 1); // G431 is 170MHz
timer17.setPreloadEnable(true);
timer17.setOverflow(200); //
TIM17->CCER = 0b1101; /// must be done , to re-establish bit 0 = CC1E
timer17.resume();
/// debug
Serial.println("");
Serial.print("T17 CCER ");
Serial.println(TIM17->CCER, BIN);
Serial.print("GPIOA MODER ");
Serial.println(GPIOA->MODER, BIN);
Serial.print("GPIOB MODER ");
Serial.println(GPIOB->MODER, BIN);
Serial.print("GPIOA AFRL ");
Serial.println(GPIOA->AFR[0], BIN);
no sure is this a normal behaviour , because the alternate function for PA7 is still ok ?