The sram is 2M X 16-bits. Module Address lines A1 - A15 are connected to A0 - A14 of the sram, with the balance of the
sram address lines (A16 - A20) connected to I/O pins on the Module. I address the sram as blocks of 64k X 16. The sram BHE
& BHL signaled are connect to BE1 & BE0 on the Module.
The Flexbus configuration registers are set as:
Code: Select all
sim2.cs[4].cscr = 0x41DA0; // SRAM1 decoding = 7 wait states, 16 bit bus, data left justified, no burst.
sim2.cs[4].csar = SRAM1_BASE; // SRAM1 base address = 0xC0000000
sim2.cs[4].csmr = 0x003F0001; // SRAM1 size = 0x3F+1 x 64k = 64x65536 = 4194304 (4Mb), 0001h -> cs "Valid"
My simple memory test is:
Code: Select all
void MemTest()
{
BYTE pattern[4], result[4];
DWORD adr;
memset( pattern, 0x55, sizeof(pattern) );
adr = SRAM1_BASE; // 0xC0000000
do {
memset( result, 0, sizeof(result);
// Write to sram
memcpy( adr, pattern, sizeof(pattern) );
iprintf("W: %x %x %x %x\r\n", pattern[0], pattern[1], pattern[2], pattern[3] ); // printout: 55 55 55 55
// Read from sram
memcpy( result, adr, sizeof(result) );
iprintf("R: %x %x %x %x\r\n", result[0], result[1], result[2], result[3] ); // printout: 55 55 0 0
OSTimeDly(1);
}
while( true );
}
BE0 & BE1 both go low, but they are both high for a read. Also there is only one write and one read per loop, where I think there
should be two. It acts like the Flexbus is configured for 32-bit transfers. But I've gone over the CSCR setting and it seems
correct. Did I screw up the configuration somewhere?
I'm using v2.8.1 of the tools.