EmbeddedRelated.com
Forums

Atmega 128 and AT25F512A flash memory problems

Started by Tumke September 10, 2009
Heya guys,

I'm trying to get the AT25F512A 512kb flash chip working with an
Atmega128, but unfortunately without any success thus far.

I'm using the AVRlib SPI and SPIFlash .c and .h files to get it going,
however I had to change the SPIByte function in SPIFlash.c into
SpiTransferByte and SpiSendByte where I thought appropriate.

I'm using the interrupt option with #define SPI_USEINT.

I also changed the SECTERASE and CHIPERASE as well as the PAGESIZE defines
to 0x52, 0x62 and 128 respectively.
I added sbi(DDRB, 4); to enable write protect in the SPI.C SPIinit
function.

The function in my MAIN is:
unsigned char tempz[5] ;
spiflashWrite(1535, 5, StrKM);
spiflashRead(1535, 5, tempz);
GLCD_WriteString(tempz);

StrKM is a pointer to a character array containing a 5 character string.

I'm using the Universal KS0108 driver library to output the data to the
LCD screen.

This is part of a larger project. The only time some data showed up on the
screen is when trying the readID function. When using this function I only
get strange characters(all the same), with or without using the write
function.

I am a beginner with the AVR processors and libraries so it could well be
that I forgot to enable or disable a certain bit here.

What am I overlooking here? Many many thanks beforehand for helping me.

	   
					
---------------------------------------		
This message was sent using the comp.arch.embedded web interface on
http://www.EmbeddedRelated.com