AnsweredAssumed Answered

PID with SIMD Intrinsics on CM4 and CM7 with hard FPU

Question asked by sean thakur on Jul 19, 2017
Latest reply on Jul 20, 2017 by Clive One

This is perhaps more a CMSIS question

 

I am trying to build a PID application on STM32F4

CMSIS DSP version: V1.4.5 b

I included the  "libarm_cortexM4lf_math" for GCC, included "arm_math.h".

I enabled compile time flag ARM_MATH_CM4

I will be calling init, reset and process from my application code.

 

However, I was not able to build PID for Q15 type because of inability for find __SMUAD and other SIMD intrinsics

I #if0 ed the 

static __INLINE q15_t arm_pid_q15

I could compile the q31 and f32 methods. However, methods for 32-bit types do not actually use SIMD intrinsics, which makes me doubt if there is any CMSIS DSP value-add for them... Does anybody have an experience with PID on M4 or M7?

 

for e.g. 

static __INLINE q31_t arm_pid_q31(

  arm_pid_instance_q31 * S,

  q31_t in)

  {

    q63_t acc;

    q31_t out;

 

    /* acc = A0 * x[n]  */

    acc = (q63_t) S->A0 * in;

 

    /* acc += A1 * x[n-1] */

    acc += (q63_t) S->A1 * S->state[0];

 

    /* acc += A2 * x[n-2]  */

    acc += (q63_t) S->A2 * S->state[1];

 

    /* convert output to 1.31 format to add y[n-1] */

    out = (q31_t) (acc >> 31u);

 

    /* out += y[n-1] */

    out += S->state[2];

 

    /* Update state */

    S->state[1] = S->state[0];

    S->state[0] = in;

    S->state[2] = out;

 

    /* return to application */

    return (out);

  }

Outcomes