Other Parts Discussed in Thread: CONTROLSUITE
Hi guys,
Recently I've been working on the example of "controlSUITE\device_support\f2806x\v151\F2806x_examples_ccsv5\eqep_pos_speed" for estimation of position and speed. I have a simple DC motor equipped with 2000 ppr encoder. The nominal speed of the motor at 24Volt is 6000Rpm. I tried the example first with simulated Pwm and the result was fine. then I went to connect it to my encoder.
After connection of the encoder (my encoder doesn't have index revolution pulse), and changing the variable "mech_scaler" from 16775 which is for a 1000ppr encoder to (0.9999/(4*2000))*2^26 which is 8387. but the problem is my calculated speed in variable "qep_posspeed.SpeedRpm_fr" is almost half of the current speed of the motor. for example at nominal voltage the speed is like 2800Rpm which should be near 6000, and in low speeds this problem becomes more sensible.
I also took a look at the excel file provided by Ti for the example, but couldn't find any useful data for my problem. so my question is what should I change and how?
//########################################################################### // // FILE: Example_posspeed.h // // TITLE: Pos/speed measurement using EQEP peripheral // // DESCRIPTION: // // Header file containing data type and object definitions and // initializers. // //########################################################################### // $TI Release: F2806x C/C++ Header Files and Peripheral Examples V151 $ // $Release Date: February 2, 2016 $ // $Copyright: Copyright (C) 2011-2016 Texas Instruments Incorporated - // http://www.ti.com/ ALL RIGHTS RESERVED $ //########################################################################### #ifndef __POSSPEED__ #define __POSSPEED__ #include "IQmathLib.h" // Include header for IQmath library /*----------------------------------------------------------------------------- Define the structure of the POSSPEED Object -----------------------------------------------------------------------------*/ typedef struct {int theta_elec; // Output: Motor Electrical angle (Q15) int theta_mech; // Output: Motor Mechanical Angle (Q15) int DirectionQep; // Output: Motor rotation direction (Q0) int QEP_cnt_idx; // Variable: Encoder counter index (Q0) int theta_raw; // Variable: Raw angle from Timer 2 (Q0) int mech_scaler; // Parameter: 0.9999/total count, total count = 4000 (Q26) int pole_pairs; // Parameter: Number of pole pairs (Q0) int cal_angle; // Parameter: Raw angular offset between encoder and phase a (Q0) int index_sync_flag; // Output: Index sync status (Q0) Uint32 SpeedScaler; // Parameter : Scaler converting 1/N cycles to a GLOBAL_Q speed (Q0) - independently with global Q _iq Speed_pr; // Output : speed in per-unit Uint32 BaseRpm; // Parameter : Scaler converting GLOBAL_Q speed to rpm (Q0) speed - independently with global Q int32 SpeedRpm_pr; // Output : speed in r.p.m. (Q0) - independently with global Q _iq oldpos; // Input: Electrical angle (pu) _iq Speed_fr; // Output : speed in per-unit int32 SpeedRpm_fr; // Output : Speed in rpm (Q0) - independently with global Q void (*init)(); // Pointer to the init funcion void (*calc)(); // Pointer to the calc funtion } POSSPEED; /*----------------------------------------------------------------------------- Define a POSSPEED_handle -----------------------------------------------------------------------------*/ typedef POSSPEED *POSSPEED_handle; /*----------------------------------------------------------------------------- Default initializer for the POSSPEED Object. -----------------------------------------------------------------------------*/ #define POSSPEED_DEFAULTS {0x0, 0x0,0x0,0x0,0x0,8387,2,0,0x0,\ 100,0,6000,0,\ 0,0,0,\ (void (*)(long))POSSPEED_Init,\ (void (*)(long))POSSPEED_Calc } /*----------------------------------------------------------------------------- Prototypes for the functions in posspeed.c -----------------------------------------------------------------------------*/ void POSSPEED_Init(void); void POSSPEED_Calc(POSSPEED_handle); #endif /* __POSSPEED__ */