STM32G431CBU6 : TIMER17 : setting negative channel mashes positive one

Post Reply
trimarco232
Posts: 14
Joined: Wed Jul 12, 2023 11:09 am
Answers: 1

STM32G431CBU6 : TIMER17 : setting negative channel mashes positive one

Post by trimarco232 »

Hi , here is the code :

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);
I had to set again manually CC1E bit ;
no sure is this a normal behaviour , because the alternate function for PA7 is still ok ?
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32G431CBU6 : TIMER17 : setting negative channel mashes positive one

Post by fpiSTM »

This is a known issue and fixed in the repo. You can find a workaround in the related issue.
https://github.com/stm32duino/Arduino_C ... /pull/2294
Post Reply

Return to “PR's bugs and enhancements”