Is this an external SRAM stupid idea?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First the problem. I am using an ATmega162 chip that can have either a 32 kB or 512 kB external SRAM chip. I thought I could simply try to access address 0xC500 to see if the chip was 32 kB or 512 kB. It took me a little while to figure out why this kept failing. A15 is not connected on the 32 kB chip so 0xC500 is really 0x4500. So I need to add A15 being low to my chip select logic. I know A15 cannot be used for the 512 kB chip so I will have some zero ohm jumpers that will use ground instead. I was unable to figure out the chip select logic and keep it to a single quad NAND gate chip.

Here is the idea - why don't I move the 32 kB external SRAM to 0x8000 to 0xFFFF. This also recovers the 256 bytes of registers and 1024 bytes of internal SRAM that the ATmega162 uses without having to implement the recovery code in the datasheet. I have an ATtiny26 micro that is being used for I/O processing and also provides A18-A16 for the 512 kB SRAM chip. If I can't talk to the ATtiny26 then the 32 kB SRAM must be installed so now I don't need to add A15 to the chip select logic.

I don't see how to recover the 1280 bytes of RAM when using the 512 kB chip since keeping A15 high will make the chip a 256 kB. It is bummer that I'll be losing 16 * 1280 bytes of RAM though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, 0x8000 to 0xFFFF is the best place for "window" for large external SRAM. But you will need bank switching. Connect SRAM's higher address lines to AVR outputs, and be happy :D

Cats never lie. At least, they do this rarely.