Flash Emulation on SofTec DEMO9S08LC60 development board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash Emulation on SofTec DEMO9S08LC60 development board

Jump to solution
2,281 Views
Pyretta
Contributor I

I will start out by saying that I am extremely frustrated in trying to decipher the application notes for the flash emulation. I understand none of it as it seems to be written for someone that already should know how to do it. Typically, I would take over the C programming for a computer that had this stuff already written by a developer. So I have to say I am over my head. 

 

Already figuring out some of the stuff with the keyboard interrupts and real time clock, I am trying to figure out how to write and store variables to the flash. Does someone have some C examples of how to initialize the flash and some read/write examples? I am currently using the Softec demo board for some testing. 

 

Any help would be greatly appreciated.

Message Edited by Pyretta on 2010-01-12 12:47 PM
Message Edited by Pyretta on 2010-01-12 12:55 PM
Labels (1)
Tags (1)
0 Kudos
1 Solution
923 Views
J2MEJediMaster
Specialist I

I understand your frustration. The Freescale site is not the most easy thing to search. However, understand where I am coming from. The question on how to program Flash/EEPROM keeps coming up constantly over the years. From the huge amount of search results that you saw, we keep trying to answer them. Sometimes the response is to point to another forum thread, where the problem has been discussed--and solved--before. That is the tack I took here. I have also taken some of the more gnarly flash questions (such as how to add a serial number to the flash image) and made FAQs out of them (FAQ-28651), in an attempt to have answers on hand for such real-world issues. I have been doing this--by strange coincidence--for the past five years or so to help people find a flash programming solution quickly, and get their project going.

 

Is there FAQ or forum post that has C code to program an emulated EEPROM using the dual flash array in a S08 part? No. Is there enough information available to cobble something together for your part? Probably, and I will admit the information is scattered all over the place. Or, maybe one of the flash programming experts (which I am not) will weigh in with a solution.

 

Having said all of that, let me try to run some of that information down for you. Here are some fourm threads:

 

Serial EEPROM operation
Look for the link to S08_Flash.c -- whoops, it's a C wrapper around assembly, but it works.

http://forums.freescale.com/freescale/board/message?board.id=CW816COMM&message.id=5727&query.id=1003...

Re: Flash programming using uProg1flash and uErasePages / 9S08QG8
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&thread.id=13469

Flash programming EEPROM emulation
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=4147&query.id=10191...

EEPROM emulation on QY4 in C
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=6744&query.id=10191...

Eeprom emulation on QG8 fails
Look for the link to QG8_Flash_6.zip, which uses C. Use the main.c file, and not all of the duplicate copies of main.c in that archive.

http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=8718&query.id=10227...

Download AN2295SW.zip -- Has bootloader code (which means write-to-flash routines) for almost every HCS08/RS08 part out there. Mostly in C, although is uses some macros that have assembly in them.

 

---Tom

 

 

 

 

Message Edited by J2MEJediMaster on 2010-01-13 10:43 AM

View solution in original post

0 Kudos
9 Replies
923 Views
Pyretta
Contributor I
Thanks for your response Tom. We just got the LC60_eeprom.zip file from the support folks and we will try to piece some of that in to make it work. Hopefully this will be enough information now to jump this hurdle!
0 Kudos
923 Views
Pyretta
Contributor I

I was also able to get the application note software zip file AN3404sw.zip which was extremely helpful. I have just a few questions that kind of confuse me when looking at the code compared to what they are saying.

 

The documentation says that we simply cannot write a value to 0x1870 and then rewrite a different value to the 0x1870 address without first erasing the page of flash that contains the 0x1870 range (512 bytes). I  would assume that if we had all 512 locations written to that we would want to save that we would have to store the whole page in RAM and then re-write everything except for the address that has to change?

 

Section 3.3 on application note AN3404 states that "0x1870 - 0x286f address range is used for data storage, divided into eight blocks of 512 bytes. Each block is separated into small blocks of eight bytes because it is the quantity of characters received from SCI."

 

Looking at the code, I do not see where it is limiting to 0x268f and I thought that we could go to 0x7FFF. I do see the following code in the software main.c

// Unsecured status flash
const unsigned char flash_security  @0xFFBF = 0xFE; 
const unsigned char NVPROT_Data @0xFFBD = 0x7E; 
const unsigned char EEPAdrs @0x1870;
const unsigned char EEPAdrsEnd @0x1890;  <----- This confuses me

 

I am not too sure why it has EEPAdrsEnd set to 0x1890. The code says that if it reaches 0x1891 that it should erase the page using function NVM_Erase_Page and start over with 0x1870. When it erased the page, will it erase 0x1870 through 0x1D82 or does it just erase from 0x1870 through 0x1890? My initial thought is that they just used 0x1890 to show how it works and I would like to just get a little clarification.

 

These are the only few questions that I have at this time as I am still tinkering with this code to familiarize myself and hopefully enter into a more comfortable application programming environment!

 

 

0 Kudos
923 Views
Pyretta
Contributor I

This is the exact reason I told my co-worker I did not want to post a question to the forums because ultimately, the forum model has stopped working years ago. I stopped going to forums 5 years ago because people refuse to help newbies and constantly say use the search tool. This is not my first week on the internet, I have used the search tool for 2 days before I decided to create a post. There is 1 post on the forum that talks about AN3404 and mine would be the second one. For the life of me, I do not understand why I cannot just get a simple answer on how to program, in C, an emulated EEPROM in the dual flash array. For 4 days I have been searching for an answer and I have found nothing that will help me.

 

I assure you, I am not just being lazy and not searching. If I could have found the answer to my question and avoided all of my agrevation I would have.

0 Kudos
924 Views
J2MEJediMaster
Specialist I

I understand your frustration. The Freescale site is not the most easy thing to search. However, understand where I am coming from. The question on how to program Flash/EEPROM keeps coming up constantly over the years. From the huge amount of search results that you saw, we keep trying to answer them. Sometimes the response is to point to another forum thread, where the problem has been discussed--and solved--before. That is the tack I took here. I have also taken some of the more gnarly flash questions (such as how to add a serial number to the flash image) and made FAQs out of them (FAQ-28651), in an attempt to have answers on hand for such real-world issues. I have been doing this--by strange coincidence--for the past five years or so to help people find a flash programming solution quickly, and get their project going.

 

Is there FAQ or forum post that has C code to program an emulated EEPROM using the dual flash array in a S08 part? No. Is there enough information available to cobble something together for your part? Probably, and I will admit the information is scattered all over the place. Or, maybe one of the flash programming experts (which I am not) will weigh in with a solution.

 

Having said all of that, let me try to run some of that information down for you. Here are some fourm threads:

 

Serial EEPROM operation
Look for the link to S08_Flash.c -- whoops, it's a C wrapper around assembly, but it works.

http://forums.freescale.com/freescale/board/message?board.id=CW816COMM&message.id=5727&query.id=1003...

Re: Flash programming using uProg1flash and uErasePages / 9S08QG8
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&thread.id=13469

Flash programming EEPROM emulation
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=4147&query.id=10191...

EEPROM emulation on QY4 in C
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=6744&query.id=10191...

Eeprom emulation on QG8 fails
Look for the link to QG8_Flash_6.zip, which uses C. Use the main.c file, and not all of the duplicate copies of main.c in that archive.

http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=8718&query.id=10227...

Download AN2295SW.zip -- Has bootloader code (which means write-to-flash routines) for almost every HCS08/RS08 part out there. Mostly in C, although is uses some macros that have assembly in them.

 

---Tom

 

 

 

 

Message Edited by J2MEJediMaster on 2010-01-13 10:43 AM
0 Kudos
923 Views
Pyretta
Contributor I
I have read 5 pages deeps all of the search results for flash programming and I see people talking about loading programs into flash, loading a program into flash and leaving the eeprom as is, and whatnot, I do not see any results on how to specifically use EEPROM emulation for the double flash array for the address range 0x1870 - 0x286F like in application note AN3404.
0 Kudos
923 Views
J2MEJediMaster
Specialist I

There are app notes on the topic, and the question gets asked many times in the forums. Use the search box at the lower left of this web page and usr it to search on "flash programming" or similar phrases.

 

---Tom

 

0 Kudos
923 Views
Pyretta
Contributor I

Hi Tom, I have searched and found nothing that did not lead into the "Read the app note" about the topic. I have read it, several times and it is like Mandarin Chinese to me. Before coming here, I searched on Google since most of the responses here seem to just point people to application notes. If they were more clear with some examples using the demo9s08lc60, I think many issues would be solved before they were even asked. Something simple as

 

<Initialize flash to emulate an EEPROM> with this block of code.

<To write to this emulated EEPROM> use this function

<To read this emulated EEPROM> use this function

 

It is easy to look back when you are a master of something and say how easy and simple the application note is but when you have no idea what they are talking about, it is extremely difficult to understand.

 

 

0 Kudos
923 Views
Pyretta
Contributor I
And searching for eeprom flash mc9s08lc60 brings up 1 result, my question.
0 Kudos
923 Views
J2MEJediMaster
Specialist I

Try searching on 'flash programming'.

 

---Tom

0 Kudos