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.
Hi,
I tried booting my code from flash by modifying the cmd file (28069_RAM_CLA_C_lnk.cmd).
I have manged to compile my code with no errors, but in my debug code my debugger hangs at Cla1ForceTask4andWait(); Can anyone please say what might be the issue for CLA not to be triggered. attached is a copy of my main.c file and cmd file.
Hi Sal,
I am just back to fix this CLA issue. I have followed you advice and invoked init_cla() function from main(). So far I have managed to have my code access the Cla1Task1 whenever an ADC EOC interrupt occurs . However, I noticed that the data does not get stored at Cmpns2.Ref, and Cmpns2.Fdb. I just see zero values when I keep stepping through the code till I exit the function.
here is how I declared Cmpns2 in a .cla file:
#pragma DATA_SECTION(Cmpns2, "Cla1DataRam1");
CNTL2P2Z_CLA Cmpns2;
I also declared the 2 lines below in main.c file.
#pragma CODE_SECTION(cla1_task1_isr, "ramfuncs");
interrupt void cla1_task1_isr(void);
__interrupt void
Cla1Task1 (void)
{
__mdebugstop();
Cmpns2.Ref=BoostControl_Ref;
Cmpns2.Fdb=(float) AdcResult.ADCRESULT0; //Multiply by 1/(2^12) to convert it to per unit float;
/* Compute the error */
Cmpns2.Errn=Cmpns2.Ref-Cmpns2.Fdb;
/* PreSat = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1 - Ref converted to float from Q24 */
Cmpns2.OutPreSat = Cmpns2_Coef.b2*Cmpns2.Errn2 +Cmpns2_Coef.b1*Cmpns2.Errn1 + Cmpns2_Coef.b0*Cmpns2.Errn + Cmpns2_Coef.a2*Cmpns2.Out2 + Cmpns2_Coef.a1*Cmpns2.Out1;
/* store history of error*/
Cmpns2.Errn2 = Cmpns2.Errn1;
Cmpns2.Errn1 = Cmpns2.Errn;
Cmpns2.Out=Cmpns2.OutPreSat;
/* Saturate the output, use intrinsic for the CLA compiler */
Cmpns2.Out=__mminf32(Cmpns2.Out,Cmpns2_Coef.OutMax);
Cmpns2.Out=__mmaxf32(Cmpns2.Out,Cmpns2_Coef.OutMin);
/* store the history of outputs */
Cmpns2.Out2 = Cmpns2.Out1;
Cmpns2.Out1 = Cmpns2.Out;
}
Please see attached a copy of my .cmd file. I don't know what I still need to do to get my CLA working form the flash. I worked with other processors before and I never run to issues as I did now with the flash. Please help!
I dont mind sharing my code in private communication.
Cheers,
Farid
Hi Sal!
I am assigning Cla1DataRam as below:
Cla1DataRam1 : > RAML2, PAGE = 1
PAGE 1 :
BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAML2 : origin = 0x008C00, length = 0x000400 /* on-chip RAM block L2 */
I also want to let you know that my code run as it should with CLA when I boot from RAM, so I doubt I have issues with data types in CLA. The only issue i am sure of is the setup of this cmd file for boot from the flash. I is just so frustrating I had to spend so much on this so far and yet no progress. I never had issues load code to the flash with other processors.
Please help me move on.
Hi Sal!
The CLA is running but the variables inside the CLA do not change( get updated) at all. for example, I created this variable called temp for debugging in shared_data.c:
#pragma DATA_SECTION(temp1,"CpuToCla1MsgRAM")
float temp1=100;
also at shared.h I made this declaration: extern temp1;
in main.c file, I made temp1=33; and in the CLA I tried to se it to 77; but when I setup through my code in CLA, i find the value for temp1 is equal 33; this value now got updated only in main, but it did not get updated in CLA. If this says something to me, it says that temp1 is not shared between CLA and C28, even though my declaration of the variable as shared is clear above. Just don't know whats happening.