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.

CLA dataram2 memory problem

Hello all I am using CCS 5.3.0 for my project of TMS320F28069PZA controller. I am using CLA in this application.

When I increment a variable “fft.freq_accum_2” (memory location 0x866C) and put a breakpoint after that but the variable “fft.freq_accum” (memory location 0x866A) gets incremented instead of “fft.freq_accum_2” (memory location 0x866C) and “fft.freq_accum_2” (memory location 0x866C) remains zero.

Both the variable are defined in CLA1dataram2 in same structure both are defined in following manner

Float32 freq_accum ;

Float32 freq_accum_2;

---------------------------------------------------------------------------

When I added another variable in declaration

Float32 freq_accum ;

int32 cmpr_max;

float32 freq_accum_2;

and try to increment the variable “fft.freq_accum_2” the value of “fft.cmpr_max” is altered.

So I concluded that there is something problematic with the memory operation. Whenever I try to access the variable, the value of adjacent declared register is altered.

I verified the data in memory browser also.

Could you help me figure out the problem?

  • Hi,

    Could you post the structure declaration. Its possible that one of the earlier member of the structures is throwing off the other element offsets. Also, can you post the disassembly of the if block where you are incrementing freq_accum_2

  • This is the generated dis assembly of the three lines.

    384 if (fft.freq_accum) 

    000092be: 78400000 MMOVIZ MR0, #0x0

    000092c0: 73D08652 MMOV32 MR1, @0x8652, UNCF

    000092c2: 7F200004 MCMP32 MR0, MR1

    000092c4: 7FA00000 MNOP

    000092c6: 7FA00000 MNOP

    000092c8: 7FA00000 MNOP

    000092ca: 79810020 MBCNDD 0x20, EQ

    000092cc: 7FA00000 MNOP

    000092ce: 7FA00000 MNOP

    000092d0: 7FA00000 MNOP

    386 fft.freq_accum++;

    000092d2: 7AC000F4 MMOV32 MR0, MR1, UNCF

    000092d4: 78410000 MMOVIZ MR1, #0x0

    000092d6: 78810001 MMOVXI MR1, #0x1

    000092d8: 7CC00004 MADD32 MR0, MR1, MR0

    000092da: 74C08652 MMOV32 @0x8652, MR0

    387 __mdebugstop();

    000092dc: 7FA00000 MNOP

    000092de: 7FA00000 MNOP

    000092e0: 7FA00000 MNOP

    000092e2: 7F600000 MDEBUGSTOP

    000092e4: 7FA00000 MNOP

    000092e6: 7FA00000 MNOP

    000092e8: 7FA00000 MNOP

    And here is the declaration of the structure

    struct FFT_VARS {

    struct PHASE_BUFFER r;

    struct PHASE_BUFFER y;

    struct PHASE_BUFFER b;

    struct PHASE_BUFFER src;

    struct PHASE_BUFFER vsrc;

    struct PHASE_BUFFER * ph_serial;

    struct PHASE_BUFFER * ph_fftcalc;

    Uint16 stages;

    Uint16 shf[FFT_N+2];

    float32 freq;

    Uint16 freq_cnt, freq_cnt_2, t3pr;

    Uint32 freq_accum, freq_accum_2;

    int32 cmpr_max;

    int32 cmpr_2max;

    float32 cst_pi;

    Uint16 cst_ind_vin;

    float32 cst_2pi_by_N;

    Uint16 bln_calc_started;

    int16 bln_Iout_Zero;

    struct LPF_VARS lpf_vr, lpf_vy, lpf_vb, lpf_src, lpf_rs, lpf_ys, lpf_bs;

    };

    Meanwhile I was also finding for the solutions and I also thought of memory alignment problem so I changed data type of every member to float32 and my problem was resolved. But the question is still unsanswered?  

  • It looks like the compiler is writing to fft.freq_accum @ 0x8652. Check the typedefs for Uint16 and Uint32..make sure that Uint16 is def'd as short (not int) and Uint32 as either int or long.