[chbot] PWM challenge

Robin Gilks gb7ipd at gmail.com
Mon Feb 12 01:26:59 GMT 2024


A lot will depend on the SOC or microcontroller you are using.
I'm playing with an stm32f303re (Nucleo board)  at present and I see that
Timer 2 is a 32 bit timer and can be clocked at 144MHz (i.e. system clock *
2).
Another approach I've used for generating interesting PWM shapes is to use
an SPI MOSI output being given data under DMA from memory. The above mirco
can do SPI at 18Mb/s. Set the DMA  for circular operation and change the
RAM data on the fly
Yet another method if you are straying into the analog domain with a PSU is
to use a DAC - same micro, 2 12 bit DAC outputs, can be driven by DMA and a
maximum rate of 1MS/s for single bit output change (I've been using one at
1.6MS/s and it seems fine!!). Linearity and offset might be an issue with
the DAC with errors of up to 4 and 12 LSBs respectively with 12 bit codes.

On Sun, Feb 11, 2024 at 8:49 PM Mark Atherton <markaren1 at xtra.co.nz> wrote:

> The resolution of a digital based PWM is always(?) going to be limited
> by the associated highest available clock. You may be able to use
> additional switched delays to increase resolution. AFAIK similar work
> has been done in a similar vein by various extremely high resolution
> FPGA based time-to-digital converter designs.
>
> However in the analogue domain using a ramp generator, a voltage source
> and a comparator almost limitless resolution is available. Accuracy
> however will (likely) be limited by thermal drift etc.
>
> What are you hoping to achieve, prey tell ??
>
> -M
>
>
> On 2/11/2024 7:37 PM, Charles Manning wrote:
> > Hi All
> >
> > I have an idea I'd like to bounce around to see what others think.
> >
> > I want to get a high precision PWM going to drive a buck switch mode at
> > a high enough frequency.
> > Using a single PWM channel limits the precision I can get.
> >
> > So I was thinking: maybe there is a way I can combine two PWMs to
> > generate a single high precision signal.
> >
> > For example, maybe one PWM can run at a slower frequency and provide the
> > "most significant bits "and another can run at a faster frequency and
> > provide the least significant bits" and combine them with a flip flop or
> > such.
> >
> > Has anyone tried similar trickery in the past or have any other cunning
> > tricks?
> >
> > Thanks
> >
> > Charles
> >
> >
> > _______________________________________________
> > Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> > https://lists.ourshack.com/mailman/listinfo/chchrobotics
> > Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> > Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> > When replying, please edit your Subject line to reflect new subjects.
>
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20240212/39f68261/attachment.html>


More information about the Chchrobotics mailing list