flash memory(external)

need to know how to write data into external flash memory(offchip).using MCU MC9S12A128B and the external flash memory chip is M29F040B.Is there any special code to be sent to the external flash memory.Using a cpld chip number being CY37128P84 125 JC which is used for the selecting the external flash chip.Also using metrowerks code warrior and BDM Multilink.

Thanks for any help, Ranjita

Reply to
risha
Loading thread data ...

Yes, you do need special writing sequences.

Please get 29F040 data sheet (Google for it) and read the instructions from it.

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio
000008090400050503010209 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit

risha schrieb:

Hi Ranjita

The two attached files were once published on the website of STMicroelectronics

formatting link
and contain library routines for the M29F040B Flash Memory.

Reply to
David Schmider

David Schmider schrieb:

... even more recent:

formatting link

Reply to
David Schmider

They are also "Copyright (c) 1999 STMicroelectronics". Does the license allow reproduction and publication? Or are you breaking the law?

Reply to
Dave

risha schrieb:

Hi Ranjita

Here you will find the information you are looking for:

formatting link
(There's even some C Code included)

Reply to
David Schmider

Dave schrieb:

I'm sorry. Posting just the link might be more appropriate.

Reply to
David Schmider

ST produces device manual

formatting link
and Application Notes with source code example (
formatting link
on how to use that memory device.

About ST SW Drivers, you can do whatever you want with that code as long as you keep the ST disclaimer in your code.

Reply to
Luca

thanks everybody for the help but i have gone through the documents before i posted this mail but it did not write in the flash memory.So i had doubt when i was doin the right thing but it seems like i was right.So the memory location shows just ff so it does not take in the data i wonder why?

could there be such that the external flash chip has gone bad if so how to check it?the document specifies that

Check for correct flash type Step 2: Check the offset range is valid Step 3: Check that the block(s) to be programmed are not protected Step 4: While there is more to be programmed Step 5: Check for changes from ?0' to ?1' Step 6: Program the next byte

one more thing flash was erased so condition has been met.so now what is that i could be not doing the right way?

thanks for any help, ranjita

Reply to
risha

In my group the first thing we do, it is to check the cfi capability of the flash.

Try putting on the bus the "Auto select" command and verify the flash response is what you expect. You can try this also by putting the command directly in a debugger (if you have one).

At least there is a first check whether it is a bus/interface problem or a broken flash.

Reply to
Luca

thanks for the help i was just trying something and it rather appears very strange as i dont see any thing wrong in the code no errors or any indication as to where i am going wrong there is junk value stored in the varaible which just does not seem to go away what could be the problem?

***************** void FlashReadM(volatile unsigned long *fl_ad,unsigned long abb) { unsigned long ulvald; abb=2; ulvald=0; //fl_ad=(volatile unsigned long *)0x8020; ulvald= *(fl_ad); //return ucVal; }

in the above prg the value of abb is shown as 2 but the value of ulvald does not show 0 it shows a junk value in the debugger memeory window i initialized the value of the ulvald thinking that could initilize the varaiable and then not have this junk value but the junk val just stays put.

any suggestions help extended will be very helpful regards,

Reply to
risha

IANALL, but ulvald is never used, and it is not volatile, and therefore the compiler likely performs an optimisation never setting its value.

--
Michael N. Moran           (h) 770 516 7918
5009 Old Field Ct.         (c) 678 521 5460
Kennesaw, GA, USA 30144    http://mnmoran.org

"So often times it happens, that we live our lives in chains
  and we never even know we have the key."
The Eagles, "Already Gone"

The Beatles were wrong: 1 & 1 & 1 is 1
Reply to
Michael N. Moran
"

first i wanted to check that the value is in the debugger memory window should display correctly which is not happening first the varaible ucvald should be initialized to 0 which shows a junk value on execution of the stmt then the value at the particular location which is passed as a parameter should read the value at the location [(0x8020)which is actually 0x03 in my case]so the value in the memory window should have displayed 0x03 which shows junk value again.

only when this works should i return the value ie ulvald from this function to the main program ofcourse changing the void return type of the function.So i need first the value displayed in the variable should be correct.Then can i proceed.

any suggestions on this, regards risha

Reply to
risha

If you want to prevent the compiler from eliminating useless expressions, then you will need to declare the variables as "volatile". Try this:

void FlashReadM(volatile unsigned long *fl_ad,unsigned long abb) { volatile unsigned long ulvald; // note volatile qualifier abb=2; // This will be eliminated since abb is a local copy. ulvald=0; // Now that uvald is volatile, this will show. ulvald= *(fl_ad); }

--
Michael N. Moran           (h) 770 516 7918
5009 Old Field Ct.         (c) 678 521 5460
Kennesaw, GA, USA 30144    http://mnmoran.org

"So often times it happens, that we live our lives in chains
  and we never even know we have the key."
The Eagles, "Already Gone"

The Beatles were wrong: 1 & 1 & 1 is 1
Reply to
Michael N. Moran

thank you for your time and help. It is really great, now the ulvald value does get initialized to 0 initially but the next line i.e. ulvald=*(fl_ad);does not show the correct value 03, it shows junk value. It should have copied the value at fl_ad into the variable ulvald right? The value 03 value is not displayed at this location.

NOTE: 0x8020 address is passed as a parameter(fl_ad) to the function FlashReadM and contains the value as 03(at this location 0x8020)

regards,

Reply to
risha

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.