avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] external memory on atmega128l


From: Jan Beutel
Subject: [avr-gcc-list] external memory on atmega128l
Date: 06 Dec 2002 11:47:10 +0100

hello,

we are using avr-gcc (GCC) 3.3 20020905 with atmega128l and amic
lp62s2048x-70llt external memory.

we are experiencing problems with the external memory access. these
problems seem to increase when options such as -fno-inline-funcions
-Wall and -O6 are used. 

if someone who has been using external meory successfully could give us
some hints we would be very glad.




jb



here's an example without waitstates...


#include <avr/io.h>
#include <avr/iom128.h>

#define BUF_ADDR 0x1100
#define BUF_SIZE 0xFFFF - BUF_ADDR

int main( void )
{
  s32 i;
  volatile u8 *xbuffer;

  //disable interrupts
  cli();

  sbi (MCUCR, SRE);      //enable xsram at the very beginning
                         //   to be able to place .bss and .data there
  cbi (XMCRB, XMBK);     //bus-keeper     

  cbi(XMCRA, SRW11);
  cbi(MCUCR, SRW10);

  sbi(DDRF, 7);
  cbi(PORTF, 7);

  xbuffer = (u8 *) BUF_ADDR;
   
   while (1){
     
    for (i=0; i<BUF_SIZE; i++){
      xbuffer[i]=0xFF;
      if (xbuffer[i]!=0xFF){
        sbi(PORTF, 7);
        cbi(PORTF, 7);
      }
      xbuffer[i]=0x00;
      if (xbuffer[i]!=0x00){
        sbi(PORTF, 7);
        cbi(PORTF, 7);
      }
    }
  }

 return 0; 
}
  
  


-- 
Jan Beutel                                 address@hidden
Computer Engineering and Networks Laboratory, ETZ G63
ETH Zurich                              +41 1 632 70 32 Phone
Gloriastrasse 35                          +41 1 632 10 35 Fax
CH 8092 Zurich/Switzerland  http://www.tik.ee.ethz.ch/~beutel

avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]