External Memory

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

Hello,
I was wandering about the EMIF. If I enable external memory, would I make a pointo a piece of memory ? like:

var* = 0xC0A0; assign to mem address C0A0
then var = 0x0a; write value 0x0a to address c0a0,

I dont know anyhting about this, I want to use the address databus of the atmel, but everything that I have done just stayed within the limits of the chip. I dont really want to attach external ram, I just want to use the bus. Is there a better way, if I just want to write a value to an address, is there a way to do it like ,

Wait, brain storm in middle of post :

If I use a value like 0xC2A2. would that mean write data A2 to address C2 ? I am not sure how this works. Also, once it is explained to me how to use thte address data bus, once I write something to the memory, does the write enable ,a nd ALE all happen on their own ? basically I want to just write data to specific address, and learn how it works. Thanks for the patence.

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

To write 8 bits of data to a 16 bit address, you would expect to need 24 bits of I/O. The AVR reduces this requirement to 16 by relying on external harware to "latch" the lower 8 bits of the address (which is what the ALE pulse is for), so that it can reuse the same pins next cycle for the data.

So, here's what actually happens in the code above when you assign to the pointer:

Port C is set to 0xC0 (address high 8 bits)
Port A is set to 0xA0 (address low 8 bits)
The ALE pin is pulsed low
Port A is changed to 0x0A (data value)
The WR pin is pulsed high

You can attach anything you like to these pins, as long as it acts how you want it to when these pin changes happen.

Sean.

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

Sean,
Thanks for the help, so I guess as long as you use the ALE, and WR pins at the appropiate times, that is how you get the address to the address place, and the data to the data place , do you have to take precation when tying the lower address bits to the data ? Also, by having 16 bit address, is there 16 bit data Does port C double as the upper bytes ?

-Jason

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

Hi Jason,

Try checking out the STK200 schematic (site listed below). An external memory interface is shown in the upper right hand corner of that schematic (if memory serves me right).

http://www.avr-forum.com/Stk200_...

There are only 8 data bits (D0 - D7). The data bits are "multiplexed" with the lower 8 bits of the address bits (A0 - A7). When ALE is in one state (high or low, sorry can't remember exactly which states do what) then the AVR takes care of putting the address bits on the pins of port A. When ALE is in the opposite state then the AVR changes and puts the data bits out on port A. The 74HC573 (shown in the schematic mentioned above) is used to "capture" or "latch" the lower 8 address bits so that they are present on the memory chip until ALE changes states and the data bits are either read from or written to the memory chip. ALE actually stands for Address Latch Enable.

I hope this helps. I would feel more comfortable if I could sit down with a pencil and paper in person.

Regards,
Steve

I have not actually used external RAM on an AVR but if memory serves me right I think you also have to set a bit in the MCUCR (or some register) to tell the AVR that you are using the external data/address busses.

admin's test signature
 

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

I actually started to understand this after I posted this. It is easier to think abotu it when you arent franticing to write the post. you have 16 bits of addressing space to fill with 8 bit data, for some reason I was thinking that you would be able to put 16 bit data, but it is only 8 bit part :-), I guess you could do 16 bit data, but just use to memory spaces !Tahnks for the help, and yes there is a bit that you need to set to enable EMIF.