cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 and computational demands

warrior4just
Associate
Posted on April 25, 2014 at 17:13

Hello everyone

I had this question in the back of my mind for some time now, i have a vague answer, but that is not what engineers are about -precision , right !?  🙂

The question pertains to any MCU or DSP, how do you determine if an MCU can handle computations in a given application/project.   For example:

Suppose i have the STM32 (M4)  board, and i want to control two BLCD motor with 2 feedback position control. How do you determine if this will be more than what the STM32 (M4) can chew or it can totally handle it. Assume , there is no Flash code limit and FreeRTOS is used.

If you could explain to me, how an embedded engineer decides what suitable platform for certain application in terms of M-FLOPS, MSPS, and RAM.

Thank you very much

#multi-tasking #mflops #stm32
5 REPLIES 5
Posted on April 25, 2014 at 19:10

Step#1 figure out what math you're doing, and how frequently you need to do it

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on April 25, 2014 at 20:07

Depends very much on your specific project requirements.

However, motor control often requires medium complex calculation in very short times, say, a PID control algorithm in a cycle-by-cycle loop of a few microseconds. This is not the specialty of Cortex-M devices.

Be clear about your requirements, and evaluate possible candidates - which means MCUs/boards including toolchain.

IMHO real DSPs like TI's Piccolo series are much better suited for this purpose. Perhaps because they were designed for it...

warrior4just
Associate
Posted on April 25, 2014 at 23:06

Thank you for your response

You said figure out first the math and how frequently you need to do it..., you are right, but just to put things in perspective, could you provide an illustrative example from your experience, some control problem, say simple temperature control, first order transfer function (time constant for temperature control)....how would you compute the timing requirements and the computational demand.

Thanks a lot

Posted on April 26, 2014 at 03:36

You seem a bit green at this, I would suggest you do some coding on a micro-controller, or two, and measure the cycles you need to do assorted tasks.

If I had to take a stab at your previous question I would say you'd probably be able to do something simple on a 2 MHz 8-bit micro at a rate of about 1 KHz, the same things on a 168 MHz STM32F4, you'd probably be able get to 250 KHz with ease.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on April 26, 2014 at 18:37

... you'd probably be able to do something simple on a 2 MHz 8-bit micro at a rate of about 1 KHz, the same things on a 168 MHz STM32F4, you'd probably be able get to 250 KHz with ease.

 

That rate should come from your application requirements.

If you have a rate of 250kHz, you need to pick up the measurement values (probably ADC + DMA), filter it, and calculate and output the next set value (probably PWM) in less than 4us. Include interrupt latencies, other interrupt service routines, remaining computing requirements and reserves for future improvements/requirements to the picture. If you end up with significantly less than 100% core usage, your project seems at least feasible.

Contradicting requirements for fast servicing interrupts can still break it.

Several silicon vendors have ASSP's (standard MCU cores with application specific peripherals), which do most of this stuff in hardware. This might be an alterative for you. Usually, they offer them only to commercial customers.