What is maximum frequency of PWM (w/ 50% duty cycle)? #4737
Replies: 1 comment
-
Posted at 2019-01-28 by @gfwilliams I think PWM can go at about 1/2 the speed of the peripheral clock. Some PWM outputs are on PCLK1 (1/2 speed) and some are on PCLK2 (1/4 speed) so depending which timer is used for the PWM output you can go twice as fast. You can see which is which listed here: https://github.com/espruino/Espruino/blob/master/targets/stm32/jshardware.c#L434-L510 You could take a look at http://www.espruino.com/STM32+Peripherals and see about peeking/poking the Pico's timer peripheral (specifically the prescaler, autoreload register and counter) and see if you can get it to go faster? Posted at 2019-01-29 by @allObjects See the application related to this PWM conversation: Espruino controlling and visualizing and 'audiolizing' an LC resonance experiment in HAM Radio class Posted at 2019-01-29 by @allObjects Btw, A8 - which I used - got obviously blown by some feedback back into the pin... so I switched to B7. I could not (yet) read out of the code which pin uses which timer. The poking around in the timers' guts has to wait a bit. For the timed immediate need I have tuned the coil with capacitor to fall into the range of 32..262KHz. For the higher range I have organized a 'classical' bench RC signal generator covering up to 2MHz. Posted at 2019-01-29 by @gfwilliams
Try I believe it's the first timer that's listed for the pin that gets used - unfortunately there is no way to explicitly set which one gets used for now. Even so, I guess going up to 262kHz is quite good. I was considering trying to do some circuit stuff with a Pixl.js actually - I thought it'd be quite good to be able to use it as an oscilloscope for some low speed analog stuff. Posted at 2019-01-29 by @allObjects ...kind of embarrassed... don't know what measuring mistake I did in the first place... because with a do over I get easy to 2MHz and even up to 8MHz... latter just not gradually but with jumps... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-27 by @allObjects
Was looking for maximum PWM frequency any Espruino board can produce. Looking for up to 1.6..2.0MHz. So far I could produce about 262144Hz (2**18) with PICO. Could not find any reference.
Any experience with upper limit?
Any alternative to PWM is welcome... I just need a something that I can code control to sweep from about 0.5 MHz to about 2 MHz... best w/ 50% duty cycle.
Beta Was this translation helpful? Give feedback.
All reactions