2
votes

I'm trying to use the PWM of the ATSAMC21E18A. Although, no matter the parameters I set with the function "pwm_set_parameters"; the duty cycle stays at 99%.

I even try to build an easier project, which I created by https://start.atmel.com/. I only added the PWM driver and I have written a simple main:

int main(void)
    {
    /* Initializes MCU, drivers and middleware */
        atmel_start_init();

        pwm_set_parameters(&PWM_0, 1000, 500);

        pwm_enable(&PWM_0);

        /* Replace with your application code */
        while (1) {
        }
    }

But the result is the same: the output signal has a duty cycle of 99%. I have made many hardware tests and it doesn't seem to be the problem. Did I forget to initialize something?

1

1 Answers

1
votes

It must be the configuration of the gpio function ( void PWM_0_PORT_init(void) in driver_init.c if u're using Atmel Start). You may use WOx instead of WO0.

Here more information: https://www.avrfreaks.net/forum/pwm-tcx-module-not-working-samd21-using-asfv4

Good luck, byeee