WeActStudio / ArduinoCore-AT32F4

33 stars 12 forks source link

PWM does not work for multiple pins #18

Closed ShaggyDog18 closed 2 years ago

ShaggyDog18 commented 2 years ago

PWM is configured for 25kHz, 50% duty cycle (see the code below). Tested PWM for several pins. PWM works for pins: PB14, PB0, PB1, PB6, PA7, PA8 PWM does not work for: PB2, PB12, PB13, PB15, PA15, PA12 I interested in PA15 because it is already traced at PCB. Did not test other pins. The test code is simple:

#define PWM_PIN  PA15      //works for: PB14, PB0, PB1, PB6, PA7, PA8

void setup() {
  PWM_Init( PWM_PIN, 100, 25000UL );
  PWM_Write( PWM_PIN, 50 );
}

void loop() {
}
WeActStudio commented 2 years ago

PA15 is not support

ShaggyDog18 commented 2 years ago

I have not find in the AT32F4 datasheet any mentioning that some pins do not support PWM. May you share any document or link describing limitations?

ShaggyDog18 commented 2 years ago

regarding PA15: the function IS_PWM_PIN( PA15 ) returns TRUE ???

WeActStudio commented 2 years ago

Sorry, it is a bug.Because the PA15 use the Timer 2 of the IO multiplexed second group, it can not be use

ShaggyDog18 commented 2 years ago

are you going to fix it?