[riot-devel] PWM Driver

Ilias Seitanidis iliasseitanidis at gmail.com
Fri Apr 7 15:29:50 CEST 2017


Hi again :)

I am trying to produce two different frequencies on two different pins.
When I am trying [1] as it is but only changing the FREQU and STEPS, I get
the correct results.(first trial to get 19khz and second trial to get 50khz)
However, when I duplicate the method pwm_init(pwm_t dev, pwm_mode_t mode,
uint32_t freq, uint16_t res),
in order to initialize the two pins with different freq and period at the
same time, I got double the freq and half the period.
I think that the problem is that for both pins I am using the TCC devices
in [2]. I created a duplicate of the pwm_config[] in [2] by only changing
the TCC to TC (for the second instance ) but it didn't work. Any
suggestions?
 Thank you in advance!

Best regards,
Ilias
[1] https://github.com/RIOT-OS/RIOT/blob/master/tests/periph_pwm/main.c
[2]
https://github.com/RIOT-OS/RIOT/blob/master/boards/samr21-xpro/include/periph_conf.h

P.S. When I tried to create at the same time the two different frequencies
in the main[1] I erased the for loops and I staticaly
used the PWM_DEV(0),PWM_DEV(1) and on the pwm_set(PWM_DEV(Y), X, state),
where X is the pin I need, and Y the device number 0 or 1.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20170407/878e6f5f/attachment.html>


More information about the devel mailing list