TI论坛
直播中

刘宇

7年用户 225经验值
私信 关注
[问答]

F28027 DPL 2p2z闭环控制不能增加任意一条变量声明

大家好,我正在用F28027的开发板制作 闭环控制回路。我用 DPL的 2p2z, ADC, Epwm,来进行闭环控制。
一切链接的非常顺利,也可以正常的闭环控制,2p2z非常精确的控制pid。
但是,如果我不能增加任意一条 变量声明,例如 long test;在 [ProjectName]-main.c 文件的 main() 文件头处。
如果加入了一条以上的变量,2p2z的输出变得不可控,也就是说,无论反馈端是什么,out都不变。
不知道这是linker的问题还是别的问题?我尝试更改RAM linker, .ebss 的地址,或者 dataRAM的地址或者长度,结果没有任何变化。
下面是我的linker 文件的内容:
/*==================================================================================*/
/* User specific Linker command file for running from RAM       */
/*==================================================================================*/
/* FILE:   F28027_RAM_ProjectName.CMD                                      */
/*                                                                                  */
/* Description: Linker command file for User custom sections targetted to run   */
/*     from RAM.                                                 */
/*                                                                                  */
/*  Target:    TMS320F28027                                     */
/*                                                                                  */
/* Version:   1.1                                       */
/*                                                                                  */
/*----------------------------------------------------------------------------------*/
/*  Copyright Texas Instruments ? 2007                                       */
/*----------------------------------------------------------------------------------*/
/*  Revision History:                                                               */
/*----------------------------------------------------------------------------------*/
/*  Date   | Description                                                         */
/*----------------------------------------------------------------------------------*/
/*  04/23/09  | Release 1.1                                           */
/*----------------------------------------------------------------------------------*/


/* Define the memory block start/length for the DSP2802x
   PAGE 0 will be used to organize program sections
   PAGE 1 will be used to organize data sections

   Notes:
         Memory blocks on F28022 are uniform (ie same
         physical memory) in both PAGE 0 and PAGE 1.
         That is the same memory region should not be
         defined for both PAGE 0 and PAGE 1.
         Doing so will result in corruption of program
         and/or data.

         The L0 memory blocks is mirrored - that is
         it can be accessed in high memory or low memory.
         For simplicity only one instance is used in this
         linker file.

         Contiguous SARAM memory blocks can be combined
         if required to create a larger memory block.
*/

MEMORY
[
PAGE 0 :
   
BEGIN  : origin = 0x000000, length = 0x000002
BOOT_RSVD : origin = 0x000002, length = 0x00004E
RAMM0  : origin = 0x000050, length = 0x0003B0
progRAM  : origin = 0x008000, length = 0x000800

IQTABLES   : origin = 0x3FE000, length = 0x000B50     /* IQ Math Tables in Boot ROM */
IQTABLES2  : origin = 0x3FEB50, length = 0x00008C     /* IQ Math Tables in Boot ROM */
IQTABLES3  : origin = 0x3FEBDC, length = 0x0000AA  /* IQ Math Tables in Boot ROM */

RESET      : origin = 0x3FFFC0, length = 0x000002
BOOTROM    : origin = 0x3FF27C, length = 0x000D44

         
PAGE 1 :

RAMM1  : origin = 0x000480, length = 0x000400
dataRAM  : origin = 0x008800, length = 0x000800
]


SECTIONS
[

   codestart        : > BEGIN,      PAGE = 0
   ramfuncs         : > progRAM,       PAGE = 0

   .text            : > progRAM,     PAGE = 0

   .cinit           : > RAMM0,      PAGE = 0
   .pinit           : > RAMM0,      PAGE = 0
   .switch          : > RAMM0,      PAGE = 0
   .reset           : > RESET,      PAGE = 0, TYPE = DSECT
   
   .stack           : > RAMM1,      PAGE = 1

   .ebss            : > dataRAM,     PAGE = 1
   .econst          : > RAMM1,     PAGE = 1

   .esysmem         : > RAMM1,      PAGE = 1

   IQmath           : >  progRAM,   PAGE = 0
   IQmathTables     : >  IQTABLES,  PAGE = 0, TYPE = NOLOAD
]


SECTIONS
[
/*************       DPLIB Sections C28x      ************************/
/* ADCDRV_1ch section */
ADCDRV_1ch_Section    : > dataRAM    PAGE = 1

/* ADCDRV_4ch section */
ADCDRV_8ch_Section    : > dataRAM    PAGE = 1

/* CNTL_2P2Z section */
CNTL_2P2Z_Section    : > dataRAM    PAGE = 1
CNTL_2P2Z_InternalData   : > dataRAM    PAGE = 1
CNTL_2P2Z_Coef     : > dataRAM    PAGE = 1

/* CNTL_3P3Z section */
CNTL_3P3Z_Section    : > dataRAM    PAGE = 1
CNTL_3P3Z_InternalData   : > dataRAM    PAGE = 1
CNTL_3P3Z_Coef     : > dataRAM    PAGE = 1


/*DLOG_4CH section */
DLOG_4CH_Section    : > dataRAM    PAGE = 1
DLOG_BUFF      : > dataRAM    PAGE = 1

/*MATH_EMAVG section */
MATH_EMAVG_Section    : > dataRAM    PAGE = 1

/*PFC_ICMD section*/
PFC_ICMD_Section    : > dataRAM    PAGE = 1

/*PFC_INVSQR section*/
PFC_INVSQR_Section    : > dataRAM    PAGE = 1

/* PWMDRV_1ch driver section */
PWMDRV_1ch_Section    : > dataRAM    PAGE = 1

/* PWMDRV_1chHiRes driver section */
PWMDRV_1chHiRes_Section   : > dataRAM    PAGE = 1

/* PWMDRV_PFC2PhiL driver section */
PWMDRV_PFC2PhiL_Section   : > dataRAM    PAGE = 1

  /* PWMDRV_PSFB driver section */
PWMDRV_PSFB_Section    : > dataRAM    PAGE = 1

/* PWMDRV_DualUpDwnCnt driver section */
PWMDRV_DualUpDwnCnt_Section  : > dataRAM    PAGE = 1

/* PWMDRV_ComplPairDB driver section */
PWMDRV_ComplPairDB_Section  : > dataRAM    PAGE = 1

/* ZeroNet_Section  */
ZeroNet_Section     : > dataRAM    PAGE = 1

]


/*
//===========================================================================
// End of file.
//===========================================================================
*/

回帖(7)

刘宇

2018-8-31 15:29:16
我也尝试用F28069的芯片进行尝试,问题非常类似,2p2z变得不可控。
举报

张文婷

2018-8-31 15:48:04
请问下2P2Z的参数是怎么设置的啊
举报

刘宇

2018-8-31 16:04:12
引用: 加欢加欢 发表于 2018-8-31 17:53
请问下2P2Z的参数是怎么设置的啊

// Connect the CNTL_2P2Z block to the variables
CNTL_2P2Z_Fdbk1 = &RltA;       //Q24 [0, 1)
CNTL_2P2Z_Out1  = &Out;        //Q24 [0, 1)
CNTL_2P2Z_Ref1  = &Ref;        //Q24 [0, 1)
CNTL_2P2Z_Coef1 = &CNTL_2P2Z_CoefStruct1.b2;


// Coefficients for the Voltage Loop
// PID coefficients & Clamping (Q26)
Dmax  = _IQ24(0.984375); //Q24
Dmin  = _IQ24(0.0);   //Q24
Pgain = _IQ26(0.001953); //Q26
Igain = _IQ26(0.001250); //Q26
Dgain = _IQ26(0.0);   //Q26
// Coefficient init --- Coeeficient values in Q26
// Use IQ Maths to generate floating point values for the CLA


CNTL_2P2Z_CoefStruct1.b2   = Dgain;                             // B2
CNTL_2P2Z_CoefStruct1.b1   = (Igain-Pgain-Dgain-Dgain);    // B1
CNTL_2P2Z_CoefStruct1.b0   = (Pgain + Igain + Dgain);        // B0
CNTL_2P2Z_CoefStruct1.a2   = 0.0;                               // A2 = 0
CNTL_2P2Z_CoefStruct1.a1   = _IQ26(1.0);                        // A1 = 1
CNTL_2P2Z_CoefStruct1.max  = Dmax;            //Clamp Hi
CNTL_2P2Z_CoefStruct1.min  = Dmin;               //Clamp Min


2p2z的Node链接到了ADC,我用了ADCDRV8ch的,用Epwm1来驱动INT,用2p2z的out来驱动Epwm的Duty口。
举报

刘宇

2018-8-31 16:23:42
引用: jfsuwef 发表于 2018-8-31 18:10
// Connect the CNTL_2P2Z block to the variables
CNTL_2P2Z_Fdbk1 = &RltA;       //Q24 [0, 1)
CNTL_2P2Z_Out1  = &Out;        //Q24 [0, 1)

各位大佬,我搞定了,就是memory的问题,是progRAM的大小和dataRAM的大小问题,这个程序,我的progRAM太小,之前总想着扩大dataRAM,因为觉得dataRAM的数据没有变化。可能是数据不够,刚才才明白,是程序不够用了,所以出来的数据不变。
各位大佬如果有建议,也给指导一下。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分