[chbot] PWM challenge

David Burkitt daveyboy17nz at gmail.com
Mon Feb 12 05:28:21 GMT 2024


We used a PIC33H micro a few years ago that had a high resolution PWM that
ran off it's own PLL from the system clock.
Can't remember the actual part number, sorry.
Regards
Dave

On Mon, 12 Feb 2024 at 16:22, Charles Manning <cdhmanning at gmail.com> wrote:

> Thanks all
>
> I think the idea I had of trying to "overlap" two PWMs for better
> precision would only work if I was using a predivider to divide one dwon to
> a lower frequency. That won't work for my application as I want to drive
> with at least 30 to 40kHz (preferably more). I think the only way I can
> achieve a higher precision would be by going for a higher clock speed (ie.
> a PWM driven from at least 120MHz).
>
> The other option might be to do some sort of dithering, but that will add
> lower frequency ripple.
>
> I've been looking at various interesting micros recently. In STM32, there
> are the newer U5 series which run up to 160MHz which should give more
> resolution than I need as well as a few other features that look
> interesting for motor control etc (eg. proper security to stop people
> tampering).
>
> At the other end, there are a bunch of RISC V micros coming out of China.
> 144MHz or faster, less than $1.
>
> THanks
>
> Regards
>
> Charles
>
>
> On Mon, Feb 12, 2024 at 2:28 PM Robin Gilks <gb7ipd at gmail.com> wrote:
>
>> 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.
>>
>> _______________________________________________
>> 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/ffa9f413/attachment-0001.html>


More information about the Chchrobotics mailing list