cancel
Showing results for 
Search instead for 
Did you mean: 

ARM PID code in F4 DSP Lib, referring to F1 and F2

ahiggins9
Associate II
Posted on October 30, 2012 at 09:46

Hi,

I see in the DSP section of the Firmware for the F4, at the following location

\STM32F4xx_DSP_StdPeriph_Lib_V1.0.1\Libraries\CMSIS\DSP_Lib\Source\ControllerFunctions

that there is reference to hardware and software based PID, in code supplied by arm, which suggests that software PID is possible on F1, F2, and in DSP hardware on F4.

However, I can't see any examples to help me get started on this. Can you provide demo code or a description of how use this in a PID application, both for software pid (f1,f2) and the PID Hardware (f4) please?

Thanks

#pid
5 REPLIES 5
frankmeyer9
Associate II
Posted on October 30, 2012 at 10:15

For examples, there is obviously none in the

../CMSIS/DSP_Lib/Examples

subfolder, but it should not be a problem to find a generic example using google/<your fafourite search machine>.

 

that there is reference to hardware and software based PID,

 

I guess you are referring to the q15 and q31 integer implementations and the f32 floating point implementation of the DSP routines. Check the lengthy comments in arm_math.h. It describes the macros you need to define for building it for a M0, M3 or M4 target. There is no specific ''hardware'' implementation - just configure your project to use the FPU, and select the proper library if you want to use the precompiled DSP lib.

For a real ''Hardware PID'', you need to build one with discrete components - there is no PID periphery in any ARM Cortex controller I know of. It is all realized in software.

ahiggins9
Associate II
Posted on October 31, 2012 at 12:07

Hey, can anybody recommend an STM32 based example that they have come across on the web, that is very simple and that I can use as a starting point to build a practical project?

Thanks

lisa2
Associate II
Posted on October 31, 2012 at 15:52

Hi,

I am looking for the exact same thing. Although I see lots on PID controllers and how to build your own, I would like to see an example using the PID instance given in the DSP library. There seem to be examples in the DSP library for everything BUT the PID controllers.

I am still searching for an example. No luck so far.

frankmeyer9
Associate II
Posted on October 31, 2012 at 16:14

For a useful example, one needs an output and a related (sensor) input to get a closed-loop control system. Either no one at ST had any idea, or they found it less interesting.

For code examples, they mostly target their evaluation boards.

lisa2
Associate II
Posted on November 20, 2012 at 13:44

Yes, it's true, to demonstrate a working PID controller would be difficult as the controller is meant to work on and control feedback from some system. However, even a table of inputs as a driver with a related table of expected output given a specific input - nothing fancy - would've been good.

I ended up just coding my own.

Cheers,

Lisa