Pages: [1]   Go Down
Author Topic: External Memory Interface library for the Mega. (can someone review my code?)  (Read 1503 times)
0 Members and 1 Guest are viewing this topic.
San Pedro, CA.
Offline Offline
Full Member
***
Karma: 3
Posts: 155
My head HURTS!!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

  I've just finished a library to use the External Memory Interface module on the Mega1280/2560. You can use it to access external memory via parallel address/data bus. The address bus width is from 8-bits upto 16-bits and the data bus width is 8-bits. You'll need a 74AHC573 transparent latch to multiplex the Port A address/data lines. I've tested the library with ti's bq3287EA RTC and an Atmel AT28HC256 EEPROM both connected. I could access the RTC as the lower sector and the EEPROM as the upper sector. The library has four functions; enable(), disable(), read() write(). The library can read/write to any valid data type (including string literals) to any external memory address. The lirary zip file is on google code here: http://code.google.com/p/arduino-exmem-library/downloads/list and attached below. If anyone can review my code or better yet test it out and let me know what they think, I would apreciate it. Enjoy! smiley-wink

Thanks for your time,
DigitalJohnson

* ExMem.zip (5.51 KB - downloaded 11 times.)
Logged

DigitalJohnson

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 133
Posts: 6753
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Um.  Why?  I thought the whole point of the "external memory interface" (as opposed to using random IO ports to access a memory device) is that the memory appears in the AVR address space, and can be accessed via normal C code.  There's a good summary accompanying the Rugged RAM expansion module: http://ruggedcircuits.com/html/megaram.html

And notes in avr-libc on how to set things up so that malloc() and friends will use it:  http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_ext_ram

I guess your code handles the bank boundary "invisibly."  But at great computational cost...
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for the library.  It is very nearly what I need to access some non memory devices only available with multiplexed address/data busses.  http://mektronixtech.com/  My application uses 4 of these chips.  Using malloc in this case would be a disaster.  I need to read from and write to specific addresses.  With partial addressing to control the CS lines of each chip, the code I am left to write is minimal.  Any reason this wouldn't work with teensy2++?  The chip is different, an AT90USB1286, but I think the register defines are the same.  Leonardo might work too. 
Logged

San Pedro, CA.
Offline Offline
Full Member
***
Karma: 3
Posts: 155
My head HURTS!!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@slomobile
I looked at the data sheet for the AT90USB1286 and the register names are the same so it should work.

DJ
Logged

DigitalJohnson

Pages: [1]   Go Up
Jump to: