Author Topic: Microcontroller: 16 bit or more timers with 100MHz timer clock  (Read 2765 times)

0 Members and 1 Guest are viewing this topic.

Offline tridacTopic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: gb
Microcontroller: 16 bit or more timers with 100MHz timer clock
« on: October 05, 2023, 12:41:50 am »
Have some ideas around a pwm generator with 24 bits of precision. Could do that with a single 32 bit  timer, or two 16, but need a timer clock of at least 100MHz, to satisfy the pwm period requirement. Cortex M2 or M4 series look like they might be suitable, but which can handle the highest timer clock frequency, withut trawling though a myriad of data sheets ?.  Lowest possible featuritis and cost, as the pwm geerator will be the main function. Comms needed, serial ok, usb, better, or network capability, best, would be a plus.  Cheap eval board via Ebay might be the best way to get started. Things seem to have moved on a lot since the last serious embedded project here, so what is the state of the art now ?...
Test gear restoration, hardware and software projects...
 

Offline ozcar

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: au
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #1 on: October 05, 2023, 02:08:57 am »
I made a sort-of PWM generator using one of these:

https://www.dfrobot.com/product-2338.html

Hardly state of the art now, but two 32-bit timers, several 16-bit timers, and yes, they can run up to 100MHz. USB, but not network by itself.

TBH it had way more flash, ram and who-knows-what for what I was doing, so perhaps not low on the featuritis. Maybe you should give some indication of what cost you have in mind.
 
The following users thanked this post: tridac

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #2 on: October 05, 2023, 03:49:38 am »
In the "lowest cost and features" category: The STM32G031. Timer0 can run up to 128MHz:
https://www.st.com/en/microcontrollers-microprocessors/stm32g031g8.html

For large production this could be risky, but for yourself or small project, the G030 (Unofficially) also has this capability.
All the peripherals from the more expensive G041 are there except AES, also 64KB flash, for 35 cents.
See:
https://www.eevblog.com/forum/microcontrollers/stm32g030-g031/msg5048995/#msg5048995
« Last Edit: October 05, 2023, 02:11:00 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: tridac

Offline krho

  • Regular Contributor
  • *
  • Posts: 223
  • Country: si
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #3 on: October 05, 2023, 05:51:43 am »
Don't know for the MCU, but for the Wired network you could use the SPI chips made by Microchip if 10Mbit is enough. Also If you need the WiFi or both you could look at the espressif offerings. They are really cheap and you have xtensa architecture and on newer ones Risc V. Plenty of RAM and flash available.
 
The following users thanked this post: tridac

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3367
  • Country: nl
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #4 on: October 05, 2023, 10:02:30 am »
STM32F411 can run some of it's timers st 100MHz, and it's available on cheap and breadboard friendly breakout boards as the "Black Pill" (WeAct)).

There are some uC's which have peripherals that are optimized for very high speed PWM. In general the clock speed of the PWM is the same as the max clock speed as the uC, (Teensy 4 (with an LPC) has a clock speed of some 400MHz), but some uC's have a PWM resolution that is higher then it's clock speed suggests. I think the document below describes such a peripheral, with "5-bit fractional pwm" (on top of normal pwm), but I have not looked into details.

https://www.nxp.com/docs/en/application-note/AN4746.pdf

But I don't understand your post about multiple timers. You can't get a higher PWM resolution with that. It is possible to use it to create a higher resolution DC voltage by combining several PWM channels, but that is a separate topic.
« Last Edit: October 05, 2023, 11:17:03 am by Doctorandus_P »
 
The following users thanked this post: tridac

Offline tridacTopic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: gb
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #5 on: October 05, 2023, 12:51:51 pm »
That sort of thing looks like a low risk option to get started and seems to be the basis of quite a few low cost sellers. 2 x 32 bit timers up to 100MHz, which looks ideal, and there are even variants of that series with ethernet. Devil is in the detail, as usual.

Such a plethora of options these days, and far cry from the sort of devices used in the past. Did some initial work with earlier stm32... series, but never had a serious (that is, work) project to run with it. Risc 5 looks interesting, but needs a few more years to achieve volume and cost critical mass. Time to catch up a bit anyway and thanks to everyone for the replies...
Test gear restoration, hardware and software projects...
 

Offline Chalcogenide

  • Regular Contributor
  • *
  • Posts: 156
  • Country: it
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #6 on: October 05, 2023, 01:52:25 pm »
The STM32G474 has an HRTIM peripheral which allows 6 channel PWM with a resolution of 184 ps (170 MHz clock with a resolution of 1/32nd of the clock period), although the timer is only 16 bit, but the peripheral also allows some other trickery which you might want to look at. It also has two regular 32 bit timers and a bunch of 16 bit ones.
 
The following users thanked this post: tridac

Offline tridacTopic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: gb
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #7 on: October 05, 2023, 08:53:46 pm »
With 100MHz clock, the minimum pulse width will be 10nS, so may have to limit that because of rise and fall time of the timer output, which will be significant. Really just need to build something up, to find out what the limits are...
Test gear restoration, hardware and software projects...
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1555
  • Country: au
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #8 on: October 08, 2023, 08:03:19 pm »
Have some ideas around a pwm generator with 24 bits of precision.
… Things seem to have moved on a lot since the last serious embedded project here, so what is the state of the art now ?...
Do you really need 16 timers, or did you mean 16 PWM channels ?
Do those PWM’s need to be 16b, or more ?
A lot of 32 bit MCU are stuck back at 16 b pwm tho some do have 24b (nuvoton) or 32b (nxp)
Many new MCU have PLL  for timers, even 8 b MCU can have 144MHz or 256MHz PWM
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1555
  • Country: au
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #9 on: October 08, 2023, 08:08:48 pm »
With 100MHz clock, the minimum pulse width will be 10nS, so may have to limit that because of rise and fall time of the timer output, which will be significant. Really just need to build something up, to find out what the limits are...
Yes, PWM clocks can be much faster than a gpio pin these days.
The delays and slews are moderately stable, but very extreme limits +/- a few, will have pin limits.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14216
  • Country: de
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #10 on: October 08, 2023, 08:31:55 pm »
For PWM out some timers have the option to a few bits (like 4) via delay settings. This give a resolution like a GHZ range clock for a simple PWM timer.
There can however still be limitiations, e.g. from jitter of the clock, when generated via PLL.
 

Offline tridacTopic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: gb
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #11 on: October 09, 2023, 12:31:09 pm »
One technique used here in the past was to get more accuracy from a baud rate generator. Assuming an interrupt driven timer to generate the clock, if the division ratio comes out to a fractional value, say 125.5. then reload the timer with 124, then 126, on alternate interrupts. That can be modified to achieve other fractional division ratios. There will be a some jitter on the uart clock, but it won't care about that..
Test gear restoration, hardware and software projects...
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #12 on: November 03, 2023, 04:44:24 am »
>> TBH it had way more flash, ram and who-knows-what for what I was doing,

That's an expensive source. F411 are available now for much less. E.g. from Weact Sutdios https://www.aliexpress.us/item/3256801269871873.html
 

Offline tridacTopic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: gb
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #13 on: November 03, 2023, 07:00:41 pm »
Looks like I will be standardising on ST Cortex M series for future projects, m more functionality and speed than needed for most projects.  Cheap boards all over the web and Ebay as well + wide variety of toolchain support, free and otherwise...
Test gear restoration, hardware and software projects...
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #14 on: November 03, 2023, 08:13:35 pm »
Not sure what you want to achieve, but PWM with 24 bits of resolution? Not too convinced it's the best approach whatever the use case is.
 

Offline tridacTopic starter

  • Regular Contributor
  • *
  • Posts: 115
  • Country: gb
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #15 on: November 05, 2023, 10:48:27 pm »
I'm not sure it's even possible, hence building a test rig to investigate. Application  is digatal to analog interface related...
Test gear restoration, hardware and software projects...
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #16 on: November 05, 2023, 11:50:13 pm »
Not sure yet what *exactly* you want to do, but the "usual" way of getting that kind of resolution with lower frequencies is to implement a sigma-delta modulator rather than use plain PWM.
Whether you can implement one at the required frequency for your application on a given MCU, that's something you'll need to figure out. But at least you won't need to be running the modulator at 100 MHz, in all likelihood.

Some MCUs do embed a sigma-delta modulator as a peripheral.

One MCU that would surprinsingly work probably even for PWM'ing at 100 MHz is the modest RP2040.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1555
  • Country: au
Re: Microcontroller: 16 bit or more timers with 100MHz timer clock
« Reply #17 on: November 06, 2023, 03:10:55 am »
Have some ideas around a pwm generator with 24 bits of precision. Could do that with a single 32 bit  timer, or two 16, but need a timer clock of at least 100MHz, to satisfy the pwm period requirement.
....
I'm not sure it's even possible, hence building a test rig to investigate. Application  is digatal to analog interface related...

For DAC usage, yes it is possible to get higher resolutions with dual PWMs.
It's routine to see dual 8 bit PWMs merged with scaled resistors to create a 16b DAC.
You could merge two 12b PWM, with high precision resistors, to get 24b ballpark.
Normally, these are used in a calibrate or closed loop, where small step size matters more than absolute precision and stability.

There are also some MCUs that extend precision by PWM dither.
They use eg 12 bits of PWM and another 4 bits dither LSB over 16 periods, in a hybrid of SDM and PWM.

 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf