Part Number: TCI6636K2H
Tool/software: TI C/C++ Compiler
I am testing QDMA, I found it works sometimes but not always. Then I found the address of some registers were not correct. See the code below (Initialisation was copied from examples in MCSDK and not attached here. )
Case it didn't work: when the loop1 variable is defined inside the for loop, then the address of TPCC_IPR will be changed to something else. if I move loop1 to above the for loop, then it works.
I couldn't understand the reason, and feel very unsafe with bunch of code I have developed since I never know this is not OK.
BTY: optimisation was disabled.
1) Code
int32_t loop;
//int loop1; //
for (loop=0; loop<8; loop++)
{
int loop1; // Doesn't work, DMA register address has been changed.
System_printf("1st TPCC_IPR- %x\n", &(tDmaHanles_hEdmaModule->regs->TPCC_IPR));
for (loop1=0; loop1<6; loop1++)
{
gafBuf_DDR3[loop1] = (loop1+1)*1.0f;
}
System_printf("2nd TPCC_IPR- %x\n", &(tDmaHanles_hEdmaModule->regs->TPCC_IPR));
do
{
CSL_edma3GetHwStatus(tDmaHanles_hEdmaModule,CSL_EDMA3_QUERY_INTRPEND,®ionIntr);
} while (!(regionIntr.intr & tccPing));
System_printf("gafBuf_L2: %f, %f\n", gafBuf_L2[0], gafBuf_L2[1]);
/* Clear pending interrupt */
CSL_edma3HwControl(tDmaHanles_hEdmaModule,CSL_EDMA3_CMD_INTRPEND_CLEAR, ®ionIntr);
if (loop < 8-1)
{
CSL_edma3ParamWriteWord(hParamPing,7,1);
}
gafBuf_L2[0] = 0.0f;
gafBuf_L2[1] = 0.0f;
}
2)Output
1st TPCC_IPR- 2741068
2nd TPCC_IPR- 106e