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.

Sinusoidal PWM in Delfino-TMS320F28379D

Other Parts Discussed in Thread: CONTROLSUITE

I am using TMS320F28379D delfino development tool. However, I have been trying to generate Sine PWM but the ouput is not sine PWM (output is normal square PWM) and in the expression window, I put the sine_table variable. But all sine_table [512] values are zero. What to do? I have been given this type of warning: creating output section "IQmathTables" without a SECTIONS specification..............



Here is my code:

#include "F28x_Project.h"
#include "IQmathLib.h"
extern void InitSysCtrl(void);
extern void InitPieVectTable(void);
extern void InitPieCtrl(void);
interrupt void ePWM1A_compare_isr(void);
#pragma DATA_SECTION(sine_table,"IQmathTables");
_iq30 sine_table[512];
void main(void)
{
InitSysCtrl();
InitPieCtrl(); // basic setup of PIE table
InitPieVectTable(); // copy default ISR’s into PIE
EALLOW;
PieVectTable.EPWM1_INT = &ePWM1A_compare_isr;
WdRegs.WDCR.all = 0x00AF;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // ePWM1A
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; // enable pull-up
EDIS;
EPwm1Regs.TBCTL.all = 0; // default values
EPwm1Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1;
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // HSPCLKDIV = 1
EPwm1Regs.TBCTL.bit.CTRMODE = 2; // up-down mode
EPwm1Regs.AQCTLA.all = 0x0006; // ZRO=set; PRD=clear
EPwm1Regs.TBPRD = 2250; // 500 kHz PWM frequency
// TBPRD = fcpu / (2* fpwm * CLKDIV * HSPCLKDIV)
// TBPRB = 90 MHz / (2 * 500 kHz * 1 * 1)
EPwm1Regs.CMPA.bit.CMPA = 1125; // initial duty 50 %
EPwm1Regs.AQCTLA.all = 0x0060;
// CMPA up = set; CMPA down = clear
EPwm1Regs.ETSEL.all = 0;
EPwm1Regs.ETSEL.bit.INTEN = 1; // enable ePWM1 int
EPwm1Regs.ETSEL.bit.INTSEL = 5; // CMPA down match
EPwm1Regs.ETPS.bit.INTPRD = 1; // 1st event
PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // ePWM1
IER |= 4; // enable INT3
EINT; // global int enable
while(1)
{
EALLOW;
WdRegs.WDKEY.all = 0x55; // service key #1
WdRegs.WDKEY.all = 0xAA; // service key #2
EDIS;
}
}
interrupt void ePWM1A_compare_isr(void)
{
static unsigned int index = 0;
EPwm1Regs.CMPA.bit.CMPA = EPwm1Regs.TBPRD -
_IQsat(_IQ30mpy((sine_table[index]+_IQ30(0.9999))/2,
EPwm1Regs.TBPRD),EPwm1Regs.TBPRD,0);
if (index++ >511) index = 0;
EPwm1Regs.ETCLR.bit.INT = 1; // clear ePWM1 interrupt flag
PieCtrlRegs.PIEACK.all = 4; // ACK for PIE group 3 int
}

  • Sourov,

    The warning 'Creating output section "IQmathTables" without a SECTIONS specification' indicates that a section hasn’t been allocated for IQmathTables in the linker command file. You can see which linker command file is being used in your project by following these steps:
    1) Right-click the project name in the CCS Project Explorer window & select properties
    2) Select “File Search Path” under “C2000 Linker”
    3) Files listed in this window that have a .cmd extension are the linker command files used by your project

    You can find a list of provided linker command files at controlSUITE\device_support\F2837xD\v190\F2837xD_common\cmd

    Since you’re working with the IQmath library, I recommend using the file 2837xD_RAM_IQMATH_lnk_cpu1.cmd that can be found in the above directory.

    Elizabeth
  • Hi Elizabeth,

    Thank you for your reply. I tried according to your direction. But now I am getting this type of warning: "../2837xD_RAM_IQMATH_lnk_cpu1.cmd", line 51: warning #10097: memory range not found: RAMLS1 on page 0

  • Sourov,

    That warning is showing up because somewhere in your project, there is a data section linked to the RAMLS1 section. RAMLS1 is a section that may have been defined in the linker command file that the project was previously using, but the project is now using 2837xD_RAM_IQMATH_lnk_cpu1.cmd, which doesn't define this section.

    I recommend that you find which data sections you link in your project and check that they are defined in the 2837xD_RAM_IQMATH_lnk_cpu1.cmd and then remove or modify any data sections in your project not found in the .cmd file.

    Elizabeth
  • Would you please help me to modify the data sections. I tried but failed.
  • Sourov,

    Depending on your project needs, you may have multiple data sections linked in your project. Please ensure that your project is only linking sections defined in the linker command file: 2837xD_RAM_IQMATH_lnk_cpu1.cmd. You are free to use your own linker command file, but this was my suggestion as you are using the IQmath library.

    Please refer to this page for more information on linking and linker command files:
    processors.wiki.ti.com/.../C28x_Compiler_-_Understanding_Linking

    Elizabeth