I am trying to test my interface to my off chip SRAM. I have initialize the EMIF registers in a GEL file. I can read and write to the memory using the view option. When I run my application to write know values to the memory it does not write to the memory correctly. Sometimes I have to shut down my CCS and restart the emualtor and my target. I have 1 meg words of SRAM. This is the code I wrote to store the values in memory.
Uns *myptr; int i;
myptr = (Uns *)0x600000;
for (i = 0; i < 1000; i++) { *myptr = (Uns)0x1234; myptr++; *myptr = (Uns)0xbeef; myptr++;}
Is this a correct way to write to the memory?
Thanks
Barry
Hi Barry,
What is the data type 'Uns'.
Just for sanity check try the instruction *(unsigned int*)0x600000 = 0x1234;
Pratap.
Pratap
Uns is defined in the TMS320 DSP/BIOS User's Guide on page 1-12 as unsigned integer value. I can currently single step my program and it will write to memory correctly. It appears to write in mutiple addresses it should not be writing to if I let it run.I initialize the EMIF registers in a gel FILE as follows:
*(short *)SRAM_Async_Wait_Reg_1@IO = 0x0080; *(short *)SRAM_Async_Wait_Reg_2@IO = 0x4030; *(short *)SRAM_Async_CS3_Reg_1@IO = 0x4521; *(short *)SRAM_Async_CS3_Reg_2@IO = 0x0031; *(short *)ESCRREG = 0x0000;
I may still have JTAG interface problems on my target.
Seems like there are some timing issues in your EMIF configurations for SRAM.
Do you have CSL2.10?. If yes check for the function SRAM_INIT() in the file c55xx_csl\build\c5505evm_pg20.gel file. See if the same timing configurations work for you. This gel file is for C5515 so don't use the complete gel file, just take the SRAM configurations. EMIF chip select configurations for SRAM are set for CS4, you need to change it to CS2.
I tried the SRAM configuration out of c55xx_csl\build\c5505evm_pg20.gel file but got the same results. I guess I will keep changing the configuration to see if I can fnd one that works.
Hello,
@Barry Turner - Have you solved your problem? What was the correct solution? Can you please send me settings that worked for you?
@Pratap - You mentioned that: "c5505evm_pg20.gel file. This gel file is for C5515 so don't use the complete gel file, just take the SRAM configurations. EMIF chip select configurations for SRAM are set for CS4, you need to change it to CS2."
But if you look at the beginning of the file there are two defines:
#define SRAM_ASYNC4CTRL0 0x101C
#define SRAM_ASYNC4CTRL1 0x101D
According to C5515 datasheet 0x101C and 0x101D are adresses for Asynchronous CS5 Configuration Register and not Async4.? Is the GEL file wrong or is it something else?
I'm experiencing same problem as Barry. I have SRAM connected to CS4, but when I try to write into it I see in the memory window that the same byte is written into several different locations.
I did get it to work. The following is the code that is used to initialize the SRAM.
void
) { * EMIF_SYSTEM_CONTROL_REGISTER = 0x0000; //location 0x1c33
{
* EMIF_SYSTEM_CONTROL_REGISTER = 0x0000; //location 0x1c33
/* SRAM */
* EMIF_ASYNC_CONFIG_REG_1_CS_3 = 0x2101; // location 0x1014
* EMIF_ASYNC_CONFIG_REG_2_CS_3 = 0x0020; // location 0x1015
/* Clocked Emif */
* EMIF_ASYNC_CONFIG_REG_1_CS_5 = 0x078D; // location 0x101c
// * EMIF_ASYNC_CONFIG_REG_2_CS_5 = 0x80A0; 60 mhz
* EMIF_ASYNC_CONFIG_REG_2_CS_5 = 0x83f0; // location 0x101d
}
Regards