STM32F103C8 Generating different frequencies and duty in same timer on different channels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-06 9:07 AM - last edited on ‎2024-08-06 12:39 PM by Tesla DeLorean
Hi,
I'm a beginner in embedded systems.
I'm trying out one thing that is I want to generate two different frequencies (100hz & 10hz) with both at 50% duty on TIMER 4 CH1 PWM Generation and TIMER 4 CH2 PWM Generation . Whether it is possible to generate different frequencies in same timer or is there any other method to generate it in STM32F103C8 blue pill kindly help me I'm stuck.
- Labels:
-
STM32CubeIDE
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-06 9:15 AM
@Rajesh3 wrote:STM32F103C8 blue phil
You mean Blue Pill ?
Note that a Blue Pill will (almost) certainly have a fake STM32 on it.
@Rajesh3 wrote:I'm a beginner in embedded systems.
Save yourself a load of grief: get a genuine Nucleo board - which will include a genuine ST-Link.
eg, https://www.st.com/en/evaluation-tools/nucleo-f103rb.html
Cautionary tale on the perils of the Blue Pill (also, fake/clone ST-Links):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-06 9:29 AM - edited ‎2024-08-06 9:29 AM
It is not possible to generate different frequencies on different channels of the same timer.
(If frequencies are 2x apart, and duty cycle is 50%, you can do this, but that's the only exception.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-06 12:41 PM
One could perhaps use toggle mode, on a maximal counter, and then chase the CCx interrupts and CCRx points along that timeline.
Lot of balls to juggle, but could be considered.
One could perhaps use TIM+DMA+GPIO to drive a pattern buffer out some selective pins of a given bank via BSRR
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-07 9:33 AM - edited ‎2024-08-07 9:34 AM
> One could perhaps use toggle mode, on a maximal counter, and then chase the CCx interrupts and CCRx points along that timeline.
In this particular case - 10Hz and 100Hz - i.e. one of the frequencies is an integer multiple of the other and both are slow, so I'd run the 100Hz PWM "naturally", and the 10Hz by using "active on match/inactive on match" and changing CCRx in Update interrupt.
Probably not something that can be clicked in CubeMX; although I don't use Cube/CubeMX.
JW
