This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F28379D: Noise problem with EQEP while running open loop V/F

Part Number: LAUNCHXL-F28379D

Tool/software:

I have used the example file of device support> 379dx> possspeed.c. which uses the  header " F28x_Project.h ". Basically combining my code with posssped.
The calculations are for a 2 pole,1500 rpm,1024 PPR motor calculated the Example_possspeed.h file is changed according to this:

#define POSSPEED_DEFAULTS {0x0, 0x0,0x0,0x0,0x0,16384,2,0,0x0,\
                           488,0,1500,0,\
                           0,0,0,\
                           (void (*)(long))POSSPEED_Init,\
                           (void (*)(long))POSSPEED_Calc }
mech rate is at 16384 = (1/(1024*4))*(2^26)
speed scaler comes from the excel sheet provided by TI in the example folder.
Other thing changed in the example is:
void  POSSPEED_Init(void)
{
    EQep1Regs.QUPRD = 100;    // 100 value is explained later
.
.
.
}
QUPRD of about 100Hz with 200Mhz (2,000,000) is default in the example but for this case it was changed to (1,000,000) for 100Mhz for 100 Hz.
But all these changes to QUPRD are giving extremely wrong results so by trial and error the best one was found to be 100 (hence 100 in the previous code even that is a problem).

3 interrupts are used in the main code (epwm9 ,epwm2 and epwm 3)

Epwm 9 is 10Khz loop for sampling and coding V/F.
Epwm 2 and 3 are 5Khz for switching frequency for the 3 phases.

Currently the only thing i am changing is the dc link value from 60 to 100V
the noise of encoder increases exponentially. This OSC output is from Epwm 7 and 8 at 50Khz:
low voltage CCS graph (which seems good no large spikes):

100V CCS graph (large spikes):
 


So i can easily remove the possibility of DAC fault.
The sensors are all off so no ADC problem.
If i use a separate board for testing the ADC there is not ripple only if i control it in this board it has spikes (within 200Hz FFT).
The V/F code seems correct otherwise it would not work under low voltage as well.
I have tried closed loop Current control with RL load which works good so probably this is just an encoder/speed code problem issue.
The fascinating thing is Using V/F in another system and just transferring the encoder value has no problem at any rate.
So already as it can be seen in the main.c file the rate of calling the epwm9_isr function modified but to no luck. 
In my testing it is probably the QUPRD problem or something else like rate etc (which i cannot seem to find because these spikes only exist inside the board measuring it through another board doesn't have ripples at all)
Any suggestions regarding this matter would be highly appreciated.

For ease i have attached all the 3 changed files here

Example_possspeed C file.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//###########################################################################
//
// FILE: Example_posspeed.c
//
// TITLE: Pos/speed measurement using EQEP peripheral
//
// DESCRIPTION:
//
// This file includes the EQEP initialization and position and speed
// calculation functions called by Eqep_posspeed.c. The position and speed
// calculation steps performed by POSSPEED_Calc() at SYSCLKOUT = 200 MHz are
// described below:
//
// 1. This program calculates: **theta_mech**
//
// theta_mech = QPOSCNT/mech_Scaler = QPOSCNT/4000, where 4000 is the number
// of counts in 1 revolution.
// (4000/4 = 1000 line/rev. quadrature encoder)
//
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Example_possspeed h file.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//###########################################################################
//
// FILE: Example_posspeed.h
//
// TITLE: Pos/speed measurement using EQEP peripheral
//
// DESCRIPTION:
//
// Header file containing data type and object definitions and
// initializers.
//
//###########################################################################
//
// $Release Date: $
// $Copyright:
// Copyright (C) 2013-2021 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
main.c.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// V/F for induction (LAST TESTED AT 100V just ok beyound 100 too much ripple in speed)
// Included Files
#include "F28x_Project.h"
#include "Example_posspeed.h"
#include <math.h>
//
// Globals
//
POSSPEED qep_posspeed=POSSPEED_DEFAULTS;
Uint16 Interrupt_Count = 0;
//DEFINE ALL CONSTANTS HERE
#define EPWM1_TIMER_TBPRD 5000 // Period register for epwm 2-8 (5 kHz)
#define EPWM9_TIMER_TBPRD 5000 // Period register for epwm9 - code is written here (10 kHz)
#define DACRATE 1250
#define PI 3.1415926536
#define PI2 6.28318530718
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX