[riot-devel] PWM Driver

Ilias Seitanidis iliasseitanidis at gmail.com
Wed Apr 26 10:42:02 CEST 2017


Hi Peter,
unfortunately no, in [1] I have TCC0 & TCC1 in one I define pin18 and on
the other pin19. What I tried and I would need your help is that both TCC0
 & TCC1 are using the tcc module[2], I want to try to use for one
pin(device) the tc module[3] and for the another the tcc. I tried to
replicate the static const pwm_conf_t pwm_config[] in [1] for tc, but I
received many errors. I think that this could be the solution.
Thank you in advance!

Best regards,
Ilias

[1]
https://github.com/RIOT-OS/RIOT/blob/master/boards/samr21-xpro/include/periph_conf.h#L144
[2]
https://github.com/RIOT-OS/RIOT/blob/master/cpu/sam0_common/include/vendor/samr21/include/component/tcc.h
[3]
https://github.com/RIOT-OS/RIOT/blob/master/cpu/sam0_common/include/vendor/samr21/include/component/tc.h

2017-04-25 17:45 GMT+02:00 Peter Kietzmann <peter.kietzmann at haw-hamburg.de>:

> Hi Ilias,
>
> did you already manage to get your setup working? I would recommend having
> a deeper look into the reference manual. IIRC it is not possible to
> configure the same PWM device with different frequencies, as you already
> indicated. So the question is which hardware PWM device can be configured
> in which way and run independently from others. This must be reflected in
> the peripheral configuration.
>
> Best regards
> Peter
>
>
> On 07.04.2017 15:29, Ilias Seitanidis wrote:
>
>> 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.
>>
>>
>> _______________________________________________
>> devel mailing list
>> devel at riot-os.org
>> https://lists.riot-os.org/mailman/listinfo/devel
>>
>>
> --
> Peter Kietzmann
>
> Hamburg University of Applied Sciences
> Dept. Informatik, Internet Technologies Group
> Berliner Tor 7, 20099 Hamburg, Germany
> Fon: +49-40-42875-8426
> Web: http://www.haw-hamburg.de/inet
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20170426/4ed35a04/attachment.html>


More information about the devel mailing list