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.

Problem (?) with const array of int32_t on F28335 chip

I'm relatively new to the C2000 family (this week!) and I'm trying out some basic mixing routines I've already written for another architecture.

So I have a few 320 element const int32_t and const float arrays declared to test out my mixing code in the debug environment (mostly for execution time).

So here's my test data declaration:

#pragma DATA_SECTION("TESTDATALUT");
extern const int32_t TestData[] =
{
23170, 23621, 24062, 24494, 24917, 25330, 25733, 26127, 26510, 26883, 27246, ... }; // 320 elements long

I have in my F28335.cmd file:

TESTDATALUT : LOAD = FLASHB, PAGE = 1, ALIGN(2)

and I also have a sin and cos LUT defined in my mixing class (floats, in a similar fashion to the above).

Looking at the .map file that pops out it looks OK, they're all stored contiguously in FLASHB:

CosineTable31p25
* 1 00330000 00000280
00330000 00000280 BTSMs_CurrentProcessorLUTs.obj (CosineTable31p25)

SineTable31p25
* 1 00330280 00000280
00330280 00000280 BTSMs_CurrentProcessorLUTs.obj (SineTable31p25)

TESTDATALUT
* 1 00330500 00000280
00330500 00000280 BTSMS_TestMixerData.obj (TESTDATALUT)

My test mixing loop:

while(1)
{
 mixer.TC_31p25HzDownMixReset();
 for(uint16_t i = 0; i < sizeTestData; ++i)
 {
  int32_t temp = TestData[i];
  GpioDataRegs.GPBSET.bit.GPIO61 = 1; // Set Data Register (GPIO61)
  mixer.TC_31p25HzDownMix(temp); 
  GpioDataRegs.GPBCLEAR.bit.GPIO61 = 1; // Clear Data Register (GPIO61)
 }
}

This is my mixing routine:

void TC_31p25HzDownMix(const int32_t data)
{
float temp;
m_TC_lAccumulator += data;
temp = ((float)data)*ADCConversion;
m_TC_fAccumulatorI += cosTable31p25Hz[m_TC_MixerIndex]*temp;
m_TC_fAccumulatorQ += sinTable31p25Hz[m_TC_MixerIndex]*temp;
m_TC_fDCAccumulator += temp;

m_TC_DataCount++;

if(m_TC_MixerIndex == (constSizeSinTable31p25Hz-1))
m_TC_MixerIndex = 0;
else
m_TC_MixerIndex++;
}

Now... In debug mode.. if I set a breakpoint and inspect the values of either the TestData array or the sin/cos lookup arrays, they look great - the values show up OK.

However if I look at the temp int32_t declared in the main loop, or the 'data' value passed into the DownMix routine, it's either -2^32 or 0.  I put some printfs at the front of the loop to try and get another take on the data in TestData...

printf("%d\n", TestData[0]);
printf("%d\n", TestData[1]);
printf("%d\n", TestData[2]);
printf("%d\n", TestData[3]);
printf("%d\n", TestData[4]);
while(1);

Just to see what happens, and it printed 5 zeros....

I don't really trust the watch window or printf routines on these chips... But it's hard for my to verify any of my math is working without putting together some serial peripheral code and sending out binary data to inspect on another computer..

Are there any gotchyas that I might be missing here?

Cheers,

  Kyle