How to work w external parallel SRAM ? ATmega64 or so.

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

How to work w external parallel SRAM in CVAVR ? ATmega64 or so.

Any example please .

Regards !

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

That's a rather vauge question. Can you give more details on what you are looking for?

I have used the external memory interface on a mega162 to connect a 2kx8 sram, and a 2kx8eeprom. Worked flawlessly.

Here is a snippet of what I did. It is not the complete code, but it is a start.

Jim

Attachment(s): 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

When you 'turn on' the external memory interface, the rd wr and ale pins start working, and porta and portc become the address bus... the datasheet shows using an 8 bit latch on portc.. this latches the hi byte of the addr on the 1st cycle, then on the next cycle, data comes out on porta and lo byte off addr hops out on portc, so you sort of need to buy a board with the external memory latch and ram already there unless you are good with a pclayout program. But turning on the memory is just poke a couple magic numbers into the external memory control register. Then the memory suddenly appears at ram address 0x1100 to 0x7fff. You access it through pointers initialized to the address you want to read or write.

Imagecraft compiler user

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

Well said Bob.

Let's see what the OP comes back with.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

You should be able to find many schematics and discussions of attaching external SRAM to an appropriate AVR such as the Mega64. The datasheet has information on address mapping. Have you looked for app notes?

The CodeVision manual/Help has a section on Setting the External SRAM.

What particular questions do you have? What have you done so far?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Thanks to ALL !

theusch wrote:
The CodeVision manual/Help has a section on Setting the External SRAM.

What particular questions do you have? What have you done so far?

SRAM is coneccted as in stk501

http://www.atmel.com/dyn/product...

I need some C code example of bsic read write for char or int var's and init XRAM source code.

CodeVision manual/Help has no that one. Google too !

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

Well either your C compiler can simply be configured to locate its heap/.data/.bss/stack into the external RAM space (though watch for performance hit with wait states) or in the most simplistic sense, Say your AVR has the ext-mem mapped to 0x4000 then:

unsigned char * ptr = (unsigned char *)0x4000;

*ptr = 'a';
if (*ptr == (unsigned char)'a') {

uses a pointer set to an absolute location to access that memory. You can extend this further with something like:

typedef struct {
  int n;
  char c;
  long l;
  unsigned char array[20];
  int n_array[10];
} myvars_t;

myvars_t * ptr = (myvars_t *) 0x4000;

ptr->l = 123456789;
ptr->c = 'x';
ptr->n = 31000;
memcpy(&ptr->array, buffer, 10);
if (ptr->n_array[5] == 32) {

which would dump a whole bunch of variables at location 0x4000 onwards.

Cliff

Last Edited: Sat. Mar 8, 2008 - 03:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks !