Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Reading from flash fails
PostPosted: Sun May 31, 2009 10:11 am 
Offline

Joined: Sun May 31, 2009 10:03 am
Posts: 1
Hi,

I am programming the flash memory of an AT91SAM7S256 via the SAM-BA protocol.
Then, to verify that the flashing is OK, I start reading the flash-memory immediately after the writing completes.
I'm using the the command R00100000,100# which reads the first flash page.

The first 49 to 52 bytes (it's somewhat random) tend to be zero. Reading the page a second time works.

So how do I write the flash pages?
I wait for the FRDY bit of the EFC Status register to become true. Then I write the 256 bytes to 0x00100000. Then I write the write command to write the first page into the EFC Command register, and then I wait for the FRDY bit again.

Reading the page after that seems to fail horribly. Is there some other thing that I need to do after writing a flash page?
Is there some other flag in some other register that I'd need to wait for?


Top
 Profile  
 
 Post subject: Re: Reading from flash fails
PostPosted: Mon Oct 19, 2009 9:55 am 
Offline

Joined: Tue Jun 20, 2006 3:19 pm
Posts: 9
It seems that I have similar problem. I am now testing AT91SAM7S512 and want to use second bank (EFC1 - the upper 256KB half) as data flash (cyclic buffer for events, partial page writes).

I have found that I read zeros after writing a page and waiting for FRDY bit. BUT:

WHEN I PERFORM A FETCH (READ) OF THE FLASH AFTER LAST WRITE (TO WRITE ONLY LATCH BUFFER) AND BEFORE WRITING TO MODE (NOERASE BIT) AND COMMAND REGISTERS, IT WORKS.

I have also found a code from previous programmer - flash programming in boot used for firmware update on AT91SAM7S256 - that checked first word in memory - read before page write command, wait to have its value (reset vector) after FRDY set and wait another 2ms. It seemed a nonsence at first look, but now I think he encountered the same problem as I do now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: