cancel
Showing results for 
Search instead for 
Did you mean: 

Salutations! I need guidance to choose a micro controller that can communicate with STM32F103VCT6 at the same speed through UART and has 36 PWN pins. Thank You J.

JJ..1
Associate II

1 ACCEPTED SOLUTION

Accepted Solutions

Let's say you have 4 outputs for starters, PB0 needs 80% duty cycle, PB1 50%, PB2 10%, and PB3 100% (always on). So you have to output the following sequence of bits repeated on each pin (of course you can shift the phase too by shifting the bits around)

PB0  1111111100
PB1  1111100000
PB2  1000000000
PB3  1111111111

turn the above table 90 degrees clockwise, you get a list of binary numbers

uint16_t pb_pattern = {
  0b1111,
  0b1011,
  0b1011,
  0b1011,
  0b1011,
  0b1001,
  0b1001,
  0b1001,
  0b1000,
  0b1000
};

This is just a simplified example, you can use full 16 bit values to output on PB0-PB15 simultaneously.

Now you can set up a timer to 10 times the PWM frequency, and a DMA channel that transfers 10 halfwords in circular mode from the buffer above to GPIOB->ODR, on each timer period. If more than 10% precision is needed, use a longer table and adjust the timer period.

It can then be extended to more GPIO banks, using more timer and DMA channels, for 32, 48, etc PWM signals.

It might even be possible to do it on the controlling MCU if there are enough pins and RAM available, maybe replacing it with a 144-pin STM32F103 variant with some more RAM.

If the two MCUs have to be separate, calculate the memory requirements based on the required PWM precision, and chose the cheapest MCU that has enough pins and RAM.

View solution in original post

23 REPLIES 23
berendi
Principal

STM32G474 has 7 regular timers with 4 PWM channels each, one with two PWMs and two timers with one PWM each, a high-resolution timer with 10 PWM outputs, and there is a low power timer with a single PWM output. That's 43.

JJ..1
Associate II

Thank You so much for your help. If only its not much of a trouble could you please guide me how did you selected and found this MCU? I was not able to find it on the STM website with their filter criteria. Thank You

JJ..1
Associate II

Perhaps you can do better with a small CPLD/FPGA?

You can drive all kinds of patterns to the STM32 GPIO via TIM+DMA

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

My job includes selecting and recommending MCUs for new products, so I have to be up to date regarding their capabilities, subscribed and actually reading product announcements, new datasheets etc. I knew that a HR timer has lots of PWM channels (but I had to look up exactly how many), but it's a separate item on their (broken as designed) product selector, both online and offline.

There is some work left for you, I've only looked at the one with the highest pin count.

Do you mean to say that I use the digital outputs with a timer and fast switch it 'ON' and 'OFF' according to the desired PWN signal I require?

Thank you

PWN? You mean PWM or something else?

GPIO's are in bank of 16, you can drive the states via a 32-bit wide pattern buffer to the GPIO->BSRR register.

Providing for fast, and complex signal generation.

3 banks could do 48 servos

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..