Hi,
This is my simple code, witch sample by sample transfer audio from I2S module to SDRAM.
#pragma DATA_SECTION (RcBuf1,".sdrambuf1")
DATA RcBuf1[16384];
#pragma DATA_SECTION (RcBuf2,".sdrambuf2")
DATA RcBuf2[16384];
#pragma DATA_SECTION (RcBuf3,".sdrambuf3")
DATA RcBuf3[16384];
#pragma DATA_SECTION (RcBuf4,".sdrambuf4")
.....
void main( void )
{
Inti = 0;
Int16 sample=0;
Uint16 *address_right;
Uint16 *address_left;
.......
// Record Audio function
address_right = (Uint16*)0x28000; // Initialize pointer to first buffer right
address_left = (Uint16*)0x50000; // Initialize pointer to first buffer left
for (i=0;i<5;i++)
{
for ( sample = 0; sample < 16384; sample++,address_right++,address_left++)
{
*address_right = I2S2_W0_MSW_R;
*address_left = I2S2_W1_MSW_R;
while((Rcv & I2S2_IR) == 0); // Wait for receive interrupt to be pending
}
address_right += 0x4000; //Address increment
address_left += 0x4000; //Address increment
}
}
// Play Audio Function
address_right = (Uint16*)0x28001; // Initialize pointer to first buffer right
address_left = (Uint16*)0x50001; // Initialize pointer to first buffer left
for (i=0;i<5;i++)
{
for ( sample = 0; sample < 16384 ; sample++,address_right++,address_left++)
{
I2S2_W0_MSW_W = *address_right;
I2S2_W1_MSW_W = *address_left;
while((Xmit & I2S2_IR) == 0); // Wait for interrupt
}
address_right += 0x4000; //Address increment
address_left += 0x4000; //Address increment
}
...
In general program works fine. Data store and playback sounds nice.
But when I at any time stop program execution and look to memory I see strange situation.
Screenshot of memory window is attached.
All even samples are constant.
Why it's so?
Thanks!
Max