I'm using an ATMega8515ATmega8515 microcontroller for a one-off hobby project. This chip has an external memory interface which can directly address 64 kilobytes of external SRAM.
ATMega8515ATmega8515 datasheet.
For my project I need more than 64KB64 KB, so I'm supplementing this address space by manually bank-switching between 4four banks of 64KB64 KB each. This bank-switching is achieved by using two normal GPIO pins as additional address lines. This gives me a grand total of 256KB256 KB of external SRAM.
So far so good. I've wired up the first 128KB128 KB onto the main board and I'm planning to have the second 128KB128 KB on a plug-in expansion PCB, that I can add later on.
I'd like my project to be able to automatically detect how much SRAM is available, so I've written a function that excersisesexercises the SRAM by writing a pattern of data to each bank in turn and then reads it back again and displays it over a UART which I can read using MinicomMinicom under Linux.
Bank 0
and Bank 1
both work as expected, and I'm reading out the same data that I stored there.
But I am seeing some weird results when attempting to access the non-existentnonexistent Bank 2
and Bank 3
. Since those chips are not present in the circuit yet, I was expecting to read back random garbage from those addresses since there would not be noany SRAM chip to drive the data bus.
Perfect results from Banks 0 andand 1...
The data read back from the non-existent addresses is not glitchy or noisy in any way, it's. It's rock-solid and repeatable.
How come the data lines appear to "remember" their voltage state from immediately before they were tri-stated by the 74HC573? The ATMega8515ATmega8515 will be reading the data a few nanoseconds after the data bus is tri-stated - could this state be retained through some stray capacitance in the wiring?
All this said, I don't think there is actually anything malfunctioning here - Ihere—I am attempting to access chips that are not there - whichthere—which is obviously "undefined behaviour".
Further infoinformation: