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.

TMS320F28335: variable cannot be assigned a value

Part Number: TMS320F28335


Dear team:

My client used #pragma DATA_SECTION to define several arrays for FFT to specific locations, but could not assign values to the arrays afterwards. The code is as follows:

#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
#include "math.h"
#include "float.h"
#include "FPU.h" //dsp 浮点运算库
typedef struct rfft;
#define PI 3.1415926 //定义圆周率
#define Fs 1000 //定义采样频率 Hz
#define F1 100 //信号频率 Hz
#define F2 20
#define Sample_points 1024 //采样点数
#define RFFT_STAGES 10 //RFFT运算阶数
#define RFFT_SIZE 1024
float32 a[1024];
float32 signal1[1024];
float32 signal2[1024];
float32 signal3[1024];
#pragma DATA_SECTION(RFFTin1Buff,"RFFTdata1"); 
float32 RFFTin1Buff[1024]; 

#pragma DATA_SECTION(RFFToutBuff,"RFFTdata2");
float32 RFFToutBuff[1024];

#pragma DATA_SECTION(RFFTmagBuff,"RFFTdata3");
float32 RFFTmagBuff[513]; 

#pragma DATA_SECTION(RFFTF32Coef,"RFFTdata4");
float32 RFFTF32Coef[1024]; 

RFFT_F32_STRUCT rfft;

void main(void)
{
Uint16 i;
float t;
for(i=0;i<1024;i++)
{
t = i*1.0/Fs;
signal1[i] = sin(2*PI*F1*t);
signal2[i] = sin(2*PI*F2*t);
signal3[i]= signal1[i]+signal2[i];
}
InitSysCtrl(); //没有硬件支撑时,予以注销
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM

// 清空输入缓存
for(i=0; i < 1024; i++)
{
RFFTin1Buff[i] = 0.0f;
}

// 测试样例波形

for(i=0; i < 1024; i++)
{
RFFTin1Buff[i]=signal1[i]; // 实部输入信号
a[i]=signal1[i];
}

rfft.FFTSize = 1024; // FFT变换的长度,FFTSize=2^stage
rfft.FFTStages = 10; // 傅里叶变换的阶数
rfft.InBuf = &RFFTin1Buff[0]; // 输入数组
rfft.OutBuf = &RFFToutBuff[0]; // 输出数组
rfft.CosSinBuf = &RFFTF32Coef[0]; // 转化因子数组
rfft.MagBuf = &RFFTmagBuff[0]; //

RFFT_f32_sincostable(&rfft); // 计算傅里叶变换的转化因子 Calculate twiddle factor

RFFT_f32(&rfft); //实数傅里叶变换

RFFT_f32_mag(&rfft); //计算幅值 Calculate magnitude

for(;;);

}

In the above program, the RFFTin1Buff array is assigned a value through the code in the figure below:

But it can be observed in the expression window that the array is still 0:

The modification of the cmd file is as follows:

Is there any omission in the code writing?

Best regards

  • Green,

    I've assigned your post to one of our team members, please expect a reply by tomm, 2/22 as we are out of the office for the President's Day holiday in the US today the 21st.

    Best,

    Matthew

  • Green,

                    Is this a new design or design that has been working for a while? If it is a new design, there is a possibility of a H/W issue in the XINTF design. Have customer do a simple write and read of the memory connected to XINTF. Below is a code snippet:

    volatile unsigned int *memval;
    
    *(Uint16 *)0x108000 = 0x1234 ;		// Write 0x1234 at 0x108000
    
    memval = (unsigned int *)0x108000; 	// Read from 0x108000
    

    Check if you are able to read back 0x1234 from 0x108000. If not, there is an issue in the design of the XINTF circuit.