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.
Tool/software: Code Composer Studio
Hi,
I tried to define a structure which contained variables, arrays and also structures. But I have problem of assigning values to the arrays and structures in this structure. In contrast, I can successfully assign values to the array which is not included in the structure. My CCS version is 6.2.0, and the Fusion Digital Power Studio is 3.0.20.
This is the structure I defined.
The biquad_param structure is as follows, it also contains arrays.
I also define all the variables as EXTERN variables. The bq_buf_LD_test[3] array is for comparison.
Then, I tried to assign values as follows:
The code can be compiled successfully, and the value of bq_buf_LD_test[3] is correct.
But the values of pll1.bq_buf_LD[3], pll1.bq_param_VE.A[2], and pll1.bq_param_VE.A2_shift_n are wrong,
It is such a simple code and I don't know why the assignments are not correct.
Thank you in advance.
After I moved all the " int64 " variables and arrays to the bottom part of the structure definition, it worked correct. Just copy the structure below. Still want to know why this happens?
typedef struct
{
PLL_STATE state; // Output: PLL state
int16 v_ac_L; // Input: AC_L_SENSE
int16 v_ac_N; // Input: AC_N_SENSE
int16 v_ac; // Input: AC voltage
int16 v_ac_rms; // Output: Estimated AC voltage amplitude divided by sqrt(2)
int32 v_ac_inv; // Output: Reciprocal of estimated AC voltage amplitue
int16 sin_theta; // Output: Sin of estimated phase
int16 cos_theta; // Output: Cos of estimated phase
int16 v_pk_p;
int16 v_pk_n;
Uint32 state_cntr;
struct BIQUAD_PARAM bq_param_VE;
int16 lock_cntr;
int16 lock_detector;
struct BIQUAD_PARAM bq_param_LD;
int64 v_ac_amp; // Output: Estimated AC voltage amplitude
int64 omega; // Output: Estimated angular speed
int64 theta; // Output: Estimated phase
int64 integrator;
int64 bq_buf_VE[3];
int64 bq_buf_LD[3];
}PLL;
Yes, probably the problem is only with the memory debugger. The code should work fine, and so should the JTAG.
I just got an email from the memory debugger expert, and he says he already has this issue flagged. He thanks you for giving him a working and non working case that he can compare.
Hello,
The memory debugger sometimes has issues with / * comments are used. We are looking to resolve these kind of issues. I think the issue may not be related to the order but to the two lines with the the commented theta variables that have "2*" in their comments. Try compiling again with just deleting those two commented lines.
Also would it be possible for you to attach a project with this problem?
Thanks,
Amiel
Thank you for all the information provided. I will try to use XDS100v2 for debugging.
Best Regards
Weijing
Thank you for your suggestion. I tried to remove all the /* and 2*, but still can not work. After I changed the order by moving all the int64 variables to the bottom of the structure definition, it worked correct. The project is attached belowTest_PLL_try.zip
Hello,
The issue here was that Int64 wasn't fully supported by the memory debugger. This variable type has a self alignment rule and needs to start at the beginning of a word boundary in the memory. The memory debugger was not taking this into account for this type. The reason it worked after you moved it was because it coincidentally aligned to the word boundary. A new build will be released soon covering this error and posted to the net. Thank you for providing your project to help debug this issue.
Amiel
Hey Weijing,
Here is the proper build:
software-dl.ti.com/.../TI-Fusion-Digital-Power-Studio-3.0.23.exe
Here is a screen shot:
Amiel