I am using the S12XE and LY62W102516 1024K X 16 BIT LOW POWER CMOS SRAM.
When I write to the external SRAM and then read back the data, I do not get correct values.
Example of write and read.
24 24 24 24 24 24 24 24 24 24 // Write
00 20 24 24 24 24 24 24 24 24 // Read
This is the related code.
#define WRITE_BYTE_B(a,d) *((unsigned char *far)(a+0x200000UL))=d
#define READ_BYTE_B(a) *((unsigned char *far)(a+0x200000UL))
uint8_t readStr[16];
for(addr = 0; addr < 10; addr++) {
WRITE_BYTE_B(addr,0x24); // write RAM address
}
for(addr = 0; addr < 10; addr++) {
readStr[addr] = READ_BYTE_B(addr); // read RAM address
}
Ray.