my pcb is using bf531 ,when i emulate it , found that the EBIU_SDSTAT's vlalue is 0x0009 after reset(should be 0x0008),and my sdram can't work correctly,why? i think it's chip's problem..
When do you see this 0x0009 value in the SDSTAT register? Is it after connecting the target in emulator mode? or after loading a project?
what SDRAM part you are using? Did you initialise the SDRAM controller properly before trying to access it? Can you post the schematic of SDRAM interface?
after i connected, or i loaded a program,or reset the board through emulator, the EBIU_SDSTAT's value is all 0x0009, and i initiated the sdc as follows:,my oscillator's freq is 11.0592M.
SSYNC; P0.L = EBIU_SDGCTL & 0xFFFF; P0.H = (EBIU_SDGCTL >> 16) & 0xFFFF; //SDRAM Memory Global Control Register R0.L = 0x8849; R0.H = 0xe108; //R0.L = 0x2189; //R0.H = 0xE09A; [P0] = R0; SSYNC;
// ------------------------------------ [--SP] = R2; CLI R2; //disable interrupt [--SP] = R2; P0.L = PLL_CTL & 0xFFFF; P0.H = (PLL_CTL >> 16) & 0xFFFF; // PLL_CTL Register R0 = 0x1400(Z); //cclk=10*clk W[P0] = R0; SSYNC; P0.L = PLL_DIV & 0xFFFF; P0.H = (PLL_DIV >> 16) & 0xFFFF; // PLL_DIV Register R0 = 0x0002(Z); //sclk=cclk/2 //R0 = 0x0005(Z); //sclk=cclk/5 W[P0] = R0; SSYNC; IDLE; //enter idle mode,wait wakeup signal R2 = [SP++] ; STI R2; //enable interrupt R2 = [SP++] ; /*******SDRAM Setup************/
Setup_SDRAM: P0.L = EBIU_SDRRC & 0xFFFF; P0.H = (EBIU_SDRRC >> 16) & 0xFFFF; //SDRAM Refresh Rate Control Register //R0 = 0x0154(Z); //sclk=cclk/5 R0 = 0x035B(Z); //2012 test sclk=cclk/2 //R0 = 0x0a10(Z); W[P0] = R0; SSYNC;
P0.L = EBIU_SDBCTL & 0xFFFF; P0.H = (EBIU_SDBCTL >> 16) & 0xFFFF; //SDRAM Memory Bank Control Register R0 = 0x0011(Z); [P0] = R0; SSYNC;
P0.L = EBIU_SDGCTL & 0xFFFF; P0.H = (EBIU_SDGCTL >> 16) & 0xFFFF; //SDRAM Memory Global Control Register R0.L = 0x10CD; R0.H = 0xe091; //R0.L = 0x2189; //R0.H = 0xE09A; [P0] = R0; SSYNC; [P0] = R0; SSYNC;
Just to clarify my original post, the 0x0009 is still expected as the value you will see in the status register as long as you are working via the emulator. Again, the emulator initializes everything by default to make debugging easier. From the screen captures you've provided, the second one looks like it is working correctly, as your 16-bit write to the 0x00120012 location is accurately reflecting the lower 16 bits from the R0 register (0x1234).
Per Prashant's reply, the SDRAM interface is initialized for you by default when you connect to the board via an emulator session. By the time you read the contents of the EBIU_SDSTAT register, the SDRAM power-up sequence has already occurred and the SDRAM controller will be in the IDLE state. As such, the SDCI bit 0 will be set, resulting in the value of 0x0009 instead of the expected 0x0008.
If you could provide the answers to the rest of Prashant's questions, we'll be better-suited to help you debug the issue.
the question is as pictures
Could you please tell the SDRAM part you are using? And also post schematic of SDRAM interface?
Please also confirm that calculated values of SDRAM registers are correct for set SCLK setting for your SDRAM part. You can use xls sheet for that purpose:
//oscillator's freq is 11.0592M
P0.L = EBIU_SDGCTL & 0xFFFF;
P0.H = (EBIU_SDGCTL >> 16) & 0xFFFF; //SDRAM Memory Global Control Register
R0.L = 0x8849;
R0.H = 0xe108;
//R0.L = 0x2189;
//R0.H = 0xE09A;
Sorry for the delay in response. The schematic looks fine and SDRAM register settings is also correct.
Just have one confusion over putting SDRAM part in self-refresh mode before configuring PLL and SDRAM. Is there any code/data residing in SDRAM at the time (which is loaded by emulator during build time)? If yes, what is your custom board support file...can you please post it? Also, can you please post your complete project?
It's strange that writing one value into SDRAM also modifies contents in the other locations.
the question is resolved,the course is soldering ,some line is not connected.
Retrieving data ...