AnsweredAssumed Answered

How to fix Undefined reference to `arm_pid_init_q31', error?

Question asked by karlis77 on Dec 30, 2017
Latest reply on Jan 3, 2018 by Andrew Neil

Hi, everyone!

I am trying to implement PID controller from arm_math library. I use this code as kind of example for this Project 03- STM32F4xx PID controller - STM32F4 Discovery  

I am getting error - Undefined reference to `arm_pid_init_q31',

 

There is nothing much regarding PID in my code, I copied only lines regarding PID.

 

#include <arm_math.h>

#define PID_PARAM_KP 10 /* Proporcional */
#define PID_PARAM_KI 10 /* Integral */
#define PID_PARAM_KD 10 /* Derivative */

uint32_t PID_ERROR;

 

 

arm_pid_instance_q31 PID;
PID.Kp = PID_PARAM_KP; /* Proporcional */
PID.Ki = PID_PARAM_KI; /* Integral */
PID.Kd = PID_PARAM_KD; /* Derivative */
arm_pid_init_q31(&PID, 1);

 

while(1)

{

output_voltage_mv = (3300*VOUT * 21) / 4096;
PID_ERROR = Vreg - output_voltage_mv;
duty_cycle = arm_pid_q31(&PID, PID_ERROR);

}

 

Can any help please?

Outcomes