Hi ALL!
I have question that i could not find the answer over the google.
The question is as in topic: How to handle single pulse length with Chibios?
From time to time there is a need to handle a single pulse length (there is such function in arduino) or as in attachment handling pulses with different length (where 0- short HIGH, 1- long HIGH but LOW have same length).
Thanks in advance!
Piotr Klimczak
How to handle single pulse length with Chibios
Moderators: RoccoMarco, lbednarz, tfAteba
-
[email protected]
- Posts: 33
- Joined: Sat Aug 25, 2012 9:53 pm
- Been thanked: 1 time
How to handle single pulse length with Chibios
- Attachments
-
- screenshot.png (68.57 KiB) Viewed 1892 times
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: How to handle single pulse length with Chibios
Hi,
You can do this using a PWM driver: in the PWM channel callback you can change the output period (pwmChangePeriodI()) and the duty cycle (pwmEnableChannelI()), the change then occurs at the start of the next cycle.
Of course the problem is the PWM frequency, if it is too high you will saturate your CPU with interrupts.
An alternate solution is to use the MOSI signal of an SPI, prepare a buffer with your pattern then transmit is over SPI using DMA.
Measuring such a signal can be done using the ICU driver.
Giovanni
You can do this using a PWM driver: in the PWM channel callback you can change the output period (pwmChangePeriodI()) and the duty cycle (pwmEnableChannelI()), the change then occurs at the start of the next cycle.
Of course the problem is the PWM frequency, if it is too high you will saturate your CPU with interrupts.
An alternate solution is to use the MOSI signal of an SPI, prepare a buffer with your pattern then transmit is over SPI using DMA.
Measuring such a signal can be done using the ICU driver.
Giovanni