Title: Write Read Eeprom Mirror Post by: benni4000 on August 17, 2022, 10:58:35 PM Hey Guys,
i am working on a MapSwitch Routine with saving choosed map in eeprom. Map Selectin is working but i stuck at the save part to the EEPROM. What works: 1.) When the code is saving to Eeprom and i read eeprom to check for changes i can't see any chances but the data must be saved somewhere, because even when i remove complete Power from ECU and check LastMap again the LastMap is saved/buffered correcly, even when i turn off and turn on Ignition again. So where the data is tempoarily saved? The Problem: 2.) Now my real problem is when Ignition is turned of for > 10s, so thats the ECU finished the After Run Cycle then data will be lost. Does someone has an Idea to resolve? My own Idea: I think that's data is saved first in "Flash Eeprom" -> I've read something about that in FR. After Ignition off > 10s the Eeprom Mirror fails CRC and that the entire reason why data is lost. Could that be right? Regards Benni Title: Re: Write Read Eeprom Mirror Post by: prj on August 18, 2022, 02:11:13 AM Assuming you are talking about ME7 here.
There's subroutines that write a word or byte to an eeprom page and offset. The pages are based on a config, as is the EEPROM mirror layout. If you use the correct subroutines to write, then there is no problem. If you just write to a ram cell, then IIRC ME7 is not like the later ECU's and if the checksum doesn't match it's not stored. Also obviously make sure nothing else is using that place in the EEPROM. Title: Re: Write Read Eeprom Mirror Post by: nihalot on August 18, 2022, 04:02:24 AM in my experience, you can update ME7 EEP mirror in RAM and it will correct cks on ignition off and store to EEP.
Title: Re: Write Read Eeprom Mirror Post by: benni4000 on August 18, 2022, 04:02:33 AM Yes i am talking about ME7.
Do i understand that there are subroutines which i can use to write Single Byte to Place in eeprom? But is it possible to only changing a RAMcell + Update both RAMcell of the Crc? Later i will check routines for writing codings. Gesendet von meinem SM-G990B mit Tapatalk Title: Re: Write Read Eeprom Mirror Post by: nihalot on August 18, 2022, 04:06:36 AM It's easier to find EEP mirror and then just update any 1 free cell.
CRC is taken care of by the shutdown routines Title: Re: Re: Write Read Eeprom Mirror Post by: benni4000 on August 18, 2022, 04:07:30 AM in my experience, you can update ME7 EEP mirror in RAM and it will correct cks on ignition off and store to EEP. Do you have an example?Then it should also work for me. I am also sure that i am on the correct adresse because first i read address via me7logger to Check if it matches with Byte of eeprom readout and it does. Then i Used next adress which was "zero" and write only this ram cell. It works for short ignition off and on but not when the after run Routine Finished. Gesendet von meinem SM-G990B mit Tapatalk Title: Re: Write Read Eeprom Mirror Post by: nihalot on August 18, 2022, 04:09:41 AM sorry, I worked on this long ago, don't have the sources handy.
But a lot of multimap files posted on this forum use the NVRAM method to save map slot, those should help you. Title: Re: Re: Write Read Eeprom Mirror Post by: terminator on August 18, 2022, 06:55:52 AM It works for short ignition off and on but not when the after run Routine Finished. It works because the ECU was not powered off. It takes some seconds. You have to calculate CRC and insert it into the mirror. Title: Re: Write Read Eeprom Mirror Post by: prj on August 18, 2022, 03:05:05 PM in my experience, you can update ME7 EEP mirror in RAM and it will correct cks on ignition off and store to EEP. I always did it with the OEM routines, and only used the mirror for reading.There's a lot of configuration going on there, it's possible that not everything can be written to and the routine was a foolproof way, which is why I used it. But it's I think 8 years ago now, I don't remember. Title: Re: Write Read Eeprom Mirror Post by: benni4000 on August 18, 2022, 03:23:25 PM Hi,
Some Infos about now: This line is 0x60 from the EEPROM and the red bytes (0x6C) i wanna write 00 00 81 0D 2F 0E 00 00 86 03 01 00 00 00 A5 FE This function is called when a new Maps has been selected. I've copied and edited it from other Mirror accesses but this routine seems to be working because its updating my byte i wanna write and checksum (0x6E and 0x6F) in RAM Mirror correctly like ME7Logger shows me. (If Map-Value goes Higher the CRC goes down) Code: sub_8B468C: My Var in Ram is 0x383D5C (len = 2) CRC in Ram is 0x383D5E (len =2) Does anyone has an Idea? Title: Re: Write Read Eeprom Mirror Post by: benni4000 on August 18, 2022, 06:13:17 PM I've forgot something.
Will eeprom also be saved or ecu getting in after run when ecu is connected on bench? Just poeered,Ignition and CC Switch? Cause when i select map and then use vcds for New coding it will be saved then. I just have to find where its getting saved or Set a Specified Flag for ding that. Have a nice Day! Title: Re: Write Read Eeprom Mirror Post by: prj on August 24, 2022, 06:31:30 PM If you turn off Kl 30 and ignition at once then there will never be afterrun and mirror won't be saved.
Title: Re: Write Read Eeprom Mirror Post by: woj on August 25, 2022, 05:52:07 AM What I did in my E85 code (the eeprom saved value was the last know ethanol content and fuel level to detect a fuel-up):
1. Made a hook-up to the init raster to read the old value from the eeprom *image*. I chose an arbitrary nullsub procedure there, replaced it with mine, and checked by testing that the eeprom image is already valid / ready at that point. 2. Made a hoop-up to the shutdown raster where I save my values directly to eeprom using the OEM functions for that (the ones that prj mentioned). Here I could not find a nullsub, so I hooked up to the procedure that saves the OBD readiness information with its own eeprom write calls. Looking at the code I concluded (perhaps wrongly) that the eeprom image is not saved on shutdown (otherwise why would the factory routines write to the eeprom directly?). Or not all of it is saved. What is done (also concluded by common sense and what I was seeing rather than having a hard proof) is that the eeprom is checked-summed on shutdown. Hence it is important to hook up before that is done. What you should definitely not do is to write to eeprom periodically in any of the regular rasters, due to eeprom wear-out possibility. Title: Re: Write Read Eeprom Mirror Post by: prj on August 25, 2022, 06:24:27 AM I mean there are two routines for reading - word and byte and two routines for writing - word and byte.
Almost all of the code uses those and they do sums as well. I don't see why not use them. They do not write to EEPROM directly, they write to the mirror. I haven't reversed the entire config, but I think it depends on page. Some pages check the sums when saving some don't. Title: Re: Write Read Eeprom Mirror Post by: woj on August 25, 2022, 07:25:42 AM I mean there are two routines for reading - word and byte and two routines for writing - word and byte. Almost all of the code uses those and they do sums as well. I don't see why not use them. They do not write to EEPROM directly, they write to the mirror. I haven't reversed the entire config, but I think it depends on page. Some pages check the sums when saving some don't. That's what I meant too. I reversed it a long time ago so forgot most of it, what I seem to remember is that it queues up an actual eeprom write that happens periodically, and I guess then updates the mirror while at it. Or updates the mirror and marks the row as changed and needing writing, or something like this. In any case, this is what should be used. Title: Re: Write Read Eeprom Mirror Post by: benni4000 on August 26, 2022, 12:10:09 PM I've tried same Code on car.
It seems to be saved. I have to Check if it just saving when engine was turned on once. I will report when i've tested enought. But could it be possible that eeprom just gets saved when engine was started? Gesendet von meinem SM-G990B mit Tapatalk Title: Re: Re: Write Read Eeprom Mirror Post by: benni4000 on August 26, 2022, 12:11:03 PM If you turn off Kl 30 and ignition at once then there will never be afterrun and mirror won't be saved. No i justed turned off igntion. Kl. 30 was connected everytime.Gesendet von meinem SM-G990B mit Tapatalk Title: Re: Write Read Eeprom Mirror Post by: benni4000 on September 04, 2022, 08:50:26 AM Hi Guys,
now i finally can say that the ONLY problem was that the ECU was on bench. Now i've tested it on Car and it saving everytime i change map. Title: Re: Write Read Eeprom Mirror Post by: fknbrkn on September 04, 2022, 10:07:13 AM A small offtop here
Why do you even need to save selected map in eep? Title: Re: Write Read Eeprom Mirror Post by: benni4000 on September 08, 2022, 03:37:33 PM Cause i want to start with the last used map ;) nothing else
Gesendet von meinem SM-G990B mit Tapatalk Title: Re: Write Read Eeprom Mirror Post by: fknbrkn on September 08, 2022, 07:42:58 PM Ecu ram powered all the time so you dont need to store something in eep until battery disconnected
|