Error writing eeprom data - SOLVED
Error writing eeprom data - SOLVED
Hi all,
I've been lurking here for a few weeks now, absorbing as much info as I can ready to jump in and "er9x" my radio.
Last night I bit the bullet and soldered in 6 wires, hooked them up to my Arduino Uno and loaded up the ArduinoISP sketch.
I launched eepe, configured the AVRDude settings, hit the "Read Firmware from TX" button and saved the original firmware to a file.
AVRDude completed successfully so I proceeded to the next step and wrote er9x.hex to the TX. Again, AVRDude said everything was ok and the Radio showed the "Bad EEPROM data, hit a key to format" message so I did that.
Everything seemed to be working just perfectly so far. I have a single model in the radio and I changed some of the settings to match my needs, then I tried the "Read Memory from TX" button in eepe. AVRDude kicks in and reads from the TX but eepe tells me its not a valid eeprom file....
So I created a new eepe settings file, edited a model etc and tried to "Write Memory to TX". AVRDude returns an error after completing the read that the file is different (from memory it was data mismatch 0x4 != 0x41 at offset 0). Restarting the radio gives the Bad EEPROM error again.
I've tried the "Reset fuses to factory default" from eepe and AVRDude reports success setting the fuses but its still no go with the eeprom write.
So far its no biggie, I can edit models etc on the TX but I'm just wondering if I've missed something somewhere in all of the posts I've been searching through. I'm mostly confused because the firmware writes perfectly every time (I've had a few goes to try various splash screens)
Details:
Win7 x64
Arduino Uno with ArduinoISP sketch (the one that comes with arduino v1.0.1) wired up as per the instructions in the sketch
eepe v343
Turnigy 9x with the 6 wires for programming soldered on.
SOLUTION at this post
I've been lurking here for a few weeks now, absorbing as much info as I can ready to jump in and "er9x" my radio.
Last night I bit the bullet and soldered in 6 wires, hooked them up to my Arduino Uno and loaded up the ArduinoISP sketch.
I launched eepe, configured the AVRDude settings, hit the "Read Firmware from TX" button and saved the original firmware to a file.
AVRDude completed successfully so I proceeded to the next step and wrote er9x.hex to the TX. Again, AVRDude said everything was ok and the Radio showed the "Bad EEPROM data, hit a key to format" message so I did that.
Everything seemed to be working just perfectly so far. I have a single model in the radio and I changed some of the settings to match my needs, then I tried the "Read Memory from TX" button in eepe. AVRDude kicks in and reads from the TX but eepe tells me its not a valid eeprom file....
So I created a new eepe settings file, edited a model etc and tried to "Write Memory to TX". AVRDude returns an error after completing the read that the file is different (from memory it was data mismatch 0x4 != 0x41 at offset 0). Restarting the radio gives the Bad EEPROM error again.
I've tried the "Reset fuses to factory default" from eepe and AVRDude reports success setting the fuses but its still no go with the eeprom write.
So far its no biggie, I can edit models etc on the TX but I'm just wondering if I've missed something somewhere in all of the posts I've been searching through. I'm mostly confused because the firmware writes perfectly every time (I've had a few goes to try various splash screens)
Details:
Win7 x64
Arduino Uno with ArduinoISP sketch (the one that comes with arduino v1.0.1) wired up as per the instructions in the sketch
eepe v343
Turnigy 9x with the 6 wires for programming soldered on.
SOLUTION at this post
Last edited by Greebo on Mon Oct 01, 2012 10:16 pm, edited 2 times in total.
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Error writing eeprom data
The first time you flash, the firmware has to 'format' the epprom.
It is a one step process, and once you protect your fuses you will not need tondo it again.
Rob
Sent from my iPhone using Tapatalk
It is a one step process, and once you protect your fuses you will not need tondo it again.
Rob
Sent from my iPhone using Tapatalk
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
Re: Error writing eeprom data
His problem seems different, as reading the radio's eeprom results in an invalid eepe file, and writing a valid eepe file from the PC results in bad eeprom message.
Are you sure you use the latest versions of both eepe and er9x?
Are you sure you use the latest versions of both eepe and er9x?
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Error writing eeprom data
Yes... But we can assume the firmware is writing as he can edit on the tx? And by the description it does not sound like the settings are lost on power cycle?
---
I am here: http://tapatalk.com/map.php?wyoswv
Sent from my iPhone using Tapatalk
---
I am here: http://tapatalk.com/map.php?wyoswv
Sent from my iPhone using Tapatalk
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
Re: Error writing eeprom data
Yes, that's exactly right.Kilrah wrote:His problem seems different, as reading the radio's eeprom results in an invalid eepe file, and writing a valid eepe file from the PC results in bad eeprom message.
Are you sure you use the latest versions of both eepe and er9x?
I can flash the firmware fine and the radio works perfectly following that (after I acknowledge the bad eeprom data message from the flash and allow it to format) but the eeprom reading and writing seems to be a problem.
Seems I neglected to post my er9x version previously... its r762. Help->About of eepe says "revision 343 May 8, 2012"
Thanks for any hints you can provide!
Re: Error writing eeprom data
Yup, but not being able to use eepe to read/edit/write is still a problem!
Re: Error writing eeprom data
+1 or 2Kilrah wrote:His problem seems different, as reading the radio's eeprom results in an invalid eepe file, and writing a valid eepe file from the PC results in bad eeprom message.
Are you sure you use the latest versions of both eepe and er9x?
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Re: Error writing eeprom data
Just did some more testing... (sorry for the slow responses but my posts are still being moderated...)
I tried extracting the eeprom to a file using both eepe and companion9x and compared the two .hex files - they are identical (not surprising I guess, they both use avrdude with the same parameters).
I wrote the eeprom .hex file created in the step above back to the Tx using eepe and this time AVRdude reported success (no mismatch). The radio booted up fine and worked as it had before writing the eeprom file.
I then changed my splash screen in eepe and reflashed the updated firmware .hex file which left me with the bad eeprom data message - as expected. Immediately I wrote the eeprom .hex file created above to the TX and again AVRdude reported success but upon rebooting the radio, I still get the bad eeprom message...
I tried extracting the eeprom to a file using both eepe and companion9x and compared the two .hex files - they are identical (not surprising I guess, they both use avrdude with the same parameters).
I wrote the eeprom .hex file created in the step above back to the Tx using eepe and this time AVRdude reported success (no mismatch). The radio booted up fine and worked as it had before writing the eeprom file.
I then changed my splash screen in eepe and reflashed the updated firmware .hex file which left me with the bad eeprom data message - as expected. Immediately I wrote the eeprom .hex file created above to the TX and again AVRdude reported success but upon rebooting the radio, I still get the bad eeprom message...
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Re: Error writing eeprom data
Did you protect your fuses between writes?
If not.. the default would be to erase the epprom - resulting in a reformat being required
Rob
If not.. the default would be to erase the epprom - resulting in a reformat being required
Rob
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
Re: Error writing eeprom data
No, I deliberately didn't. The issue I'm trying to sort out is that I can't successfully write to the eeprom from eepe.Rob Thomson wrote:Did you protect your fuses between writes?
If not.. the default would be to erase the epprom - resulting in a reformat being required
Rob
I understand completely that writing the firmware trashes the eeprom. I also thought I would be able to write an eepe settings file to the eeprom instead of letting the radio format it - is that not correct?
I can flash the firmware endlessly and it works every time. If I flash the eeprom from an eepe Settings file, I get a bad eeprom error and need to format from the Tx every single time.
As I said in my previous post, it seems I can get an eeprom .hex file using "Read Memory from Tx to file" and then write that same file back to the radio using "Write Memory to Tx from File" and it seems to work. If I try to write that same .hex file back to the radio again after I flashed the firmware it still leaves the Tx with a bad eeprom requiring formatting.
If I create a new eepe settings file (or load one I'd previously created) and then try and write that to the Tx Memory, AVRdude fails every time with a verification error:
avrdude.exe: verification error, first mismatch at byte 0x0000
0x04 != 0x41
avrdude.exe: verification error; content mismatch
It seems that regardless of what I do or try (or what avrdude reports), the eeprom refuses to write from avrdude. It obviously DOES work from an eeprom point of view because any changes I make to the radio stay in the radio between reboots and battery changes until I trash them with avrdude.
Re: Error writing eeprom data
Any other thoughts on where I should go looking next to sort this out?
Is it likely to be my soldering? The cables? Programming with the arduino?
Just to reiterate, flashing the firmware works perfectly but writing the memory does not.
Is it likely to be my soldering? The cables? Programming with the arduino?
Just to reiterate, flashing the firmware works perfectly but writing the memory does not.
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Re: Error writing eeprom data
No idea at this point!
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
Re: Error writing eeprom data
I noticed that writing the flash is (relative to its size), much faster than writing the EEprom. Could it be you have to slow down the speed, when you are writing the EEprom ? ( -B parameter ? if I'm right ?)
Reinhard
Reinhard
Re: Error writing eeprom data
Yeah, I did think of that... I've tried slowing it down to 9600 (instead of the default of 19200) but it made no difference.... I guess I could try 4800 or 2400 too...
What speed do other programmers communicate at?
What speed do other programmers communicate at?
Sv: Error writing eeprom data
How about using companion9x and flashing a version of open9x to the transmitter.
If downloading eeprom data from companion9x then fails you have pretty much ruled out software related problems and configuration problems.
If that fails I would install everything on another computer to be able to rule out problems associated with avrdude and the USB driver.
The next step is to pinpoint where in the hardware chain the problems lie.
First switch USBASP programmer and then the transmitter. But I understand that that might be easier said than done, since you probably do not have spare copies of those...
If downloading eeprom data from companion9x then fails you have pretty much ruled out software related problems and configuration problems.
If that fails I would install everything on another computer to be able to rule out problems associated with avrdude and the USB driver.
The next step is to pinpoint where in the hardware chain the problems lie.
First switch USBASP programmer and then the transmitter. But I understand that that might be easier said than done, since you probably do not have spare copies of those...
Re: Error writing eeprom data
When I get a chance I will try flashing open9x onto it and see if the behaviour is any different.
Can anyone tell me the difference between the eeprom writing process and the firmware writing process with avrdude?
Because the latter works flawlessly on the current PC with the Arduino......
Can anyone tell me the difference between the eeprom writing process and the firmware writing process with avrdude?
Because the latter works flawlessly on the current PC with the Arduino......
-
- 9x Developer
- Posts: 1109
- Joined: Sat Dec 31, 2011 12:11 am
- Country: -
- Location: Massa (MS), Tuscany, Italy
Re: Error writing eeprom data
Latest ArduinoISP is buggy, use an older version.
Have a look here
viewtopic.php?f=10&t=857&hilit=arduino
and here
viewtopic.php?f=10&t=310&p=2964&hilit=arduinoisp#p2964
Have a look here
viewtopic.php?f=10&t=857&hilit=arduino
and here
viewtopic.php?f=10&t=310&p=2964&hilit=arduinoisp#p2964
Re: Error writing eeprom data
Actually, the latest Arduino code is fixedRomolo wrote:Latest ArduinoISP is buggy, use an older version.
They fixed those bugs in 1.0.1, including the need to have external capacitors to prevent resets.
But thanks anyway.
Re: Error writing eeprom data
This morning I tried open9x. Flashed the radio firmware fine, accepted the bad eeprom message and formatted the eeprom then created a new settings file in companion9x and tried to write that the the radio. avrdude gives the same error after finishing the verification phase that I got from eepe:Greebo wrote:When I get a chance I will try flashing open9x onto it and see if the behaviour is any different.
avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0000
0x04 != 0x41
avrdude.exe: verification error; content mismatch
That's after the write process completes. I guess I'll play around with avrdude manually and see if I can coax any more details out of it.
Re: Error writing eeprom data
I tried using the exact same avrdude command that just failed in companion9x and added " -v -v" for verbose output.
This is what I get:
Are there any hints in there?
This is what I get:
Code: Select all
avrdude.exe: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\Apps\companion9x\avrdude.conf"
Using Port : com9
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA64
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 4 20 64 0 no 2048 8 0 9000 9000 0xff 0xff
flash 33 6 128 0 yes 65536 256 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.09s
avrdude.exe: Device signature = 0x1e9602
avrdude.exe: safemode: lfuse reads as E
avrdude.exe: safemode: hfuse reads as 89
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: reading input file "C:/Users/me/AppData/Local/Temp/compat.bin
"
avrdude.exe: writing eeprom (2048 bytes):
Writing | ################################################## | 100% 129.80s
avrdude.exe: 2048 bytes of eeprom written
avrdude.exe: verifying eeprom memory against C:/Users/me/AppData/Local/Temp/compat.bin:
avrdude.exe: load data eeprom data from input file C:/Users/me/AppData/Local/Temp/compat.bin:
avrdude.exe: input file C:/Users/me/AppData/Local/Temp/compat.bin contains 2048 bytes
avrdude.exe: reading on-chip eeprom data:
Reading | ################################################## | 100% 11.50s
avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0000
0x04 != 0x41
avrdude.exe: verification error; content mismatch
avrdude.exe: safemode: lfuse reads as E
avrdude.exe: safemode: hfuse reads as 89
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: safemode: Fuses OK
avrdude.exe done. Thank you.
Re: Error writing eeprom data
Ok, so I've done some more testing:
First up, I reset the Arduino to use 2400 baud for the comms and changed my avrdude paramaters to match
1. Flash the radio with er9x (r762)
2. Acknowledge the bad eeprom message and format the eeprom
3. Use avrdude to manually read the eeprom to a file (er9x_default.hex:i)
4. Flash the radio with er9x again and change the splash screen
5. Ignore the bad eeprom message (ie. don't touch the radio) and use avrdude manually to write the file from 3. back to the radio
- This works and the radio boots up without a bad eeprom message
6. Using Companion9x, flash my settings to the radio.
- Same failure as before. avrdude throws error in the verification step and the radio boots up with the bad eeprom message
7. Ignore the bad eeprom message and repeat step 5
- Radio boots up without bad eeprom message and I have default settings (as if I'd just formatted the eeprom)
8. Change some settings in the radio - pilot name, stick mode, model name, battery warning...
9. Use avrdude to manually read the eeprom to a file (er9x_setting.hex:i)
10. Flash the radio again this time not selecting to update the splash screen (so using the one in the .hex file)
11. Ignore the bad eeprom message (ie. don't touch the radio) and use avrdude manually to write the file from 9. back to the radio
- Radio boots up with bad eeprom message.
12. Acknowledge the bad eeprom message and format the eeprom
13. Use avrdude manually to write the file from 9. back to the radio again.
- Radio boots up with bad eeprom message.
14. Flash radio again as in step 4. (changed splash screen - same image selected as in step 4.)
15. Use avrdude manually to write the file from 9. back to the radio again.
- Radio boots up with bad eeprom message.
15. Use avrdude manually to write the file from 3. back to the radio again.
- Radio boots up with bad eeprom message...... AAARRRGH
15. is exactly the same as 5. and 7. and in none of the above cases did avrdude return a verification error.
5. and 7. worked, 15. did not.
This is seriously doing my head in
First up, I reset the Arduino to use 2400 baud for the comms and changed my avrdude paramaters to match
1. Flash the radio with er9x (r762)
2. Acknowledge the bad eeprom message and format the eeprom
3. Use avrdude to manually read the eeprom to a file (er9x_default.hex:i)
4. Flash the radio with er9x again and change the splash screen
5. Ignore the bad eeprom message (ie. don't touch the radio) and use avrdude manually to write the file from 3. back to the radio
- This works and the radio boots up without a bad eeprom message
6. Using Companion9x, flash my settings to the radio.
- Same failure as before. avrdude throws error in the verification step and the radio boots up with the bad eeprom message
7. Ignore the bad eeprom message and repeat step 5
- Radio boots up without bad eeprom message and I have default settings (as if I'd just formatted the eeprom)
8. Change some settings in the radio - pilot name, stick mode, model name, battery warning...
9. Use avrdude to manually read the eeprom to a file (er9x_setting.hex:i)
10. Flash the radio again this time not selecting to update the splash screen (so using the one in the .hex file)
11. Ignore the bad eeprom message (ie. don't touch the radio) and use avrdude manually to write the file from 9. back to the radio
- Radio boots up with bad eeprom message.
12. Acknowledge the bad eeprom message and format the eeprom
13. Use avrdude manually to write the file from 9. back to the radio again.
- Radio boots up with bad eeprom message.
14. Flash radio again as in step 4. (changed splash screen - same image selected as in step 4.)
15. Use avrdude manually to write the file from 9. back to the radio again.
- Radio boots up with bad eeprom message.
15. Use avrdude manually to write the file from 3. back to the radio again.
- Radio boots up with bad eeprom message...... AAARRRGH
15. is exactly the same as 5. and 7. and in none of the above cases did avrdude return a verification error.
5. and 7. worked, 15. did not.
This is seriously doing my head in
Re: Error writing eeprom data
Buy an usbasp
- Rob Thomson
- Site Admin
- Posts: 4543
- Joined: Tue Dec 27, 2011 11:34 am
- Country: United Kingdom
- Location: Albury, Guildford
- Contact:
Error writing eeprom data
Lol. Probably the simplest fix! And cheap too
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
Re: Error writing eeprom data
Who can help me?
-
- 9x Developer
- Posts: 1109
- Joined: Sat Dec 31, 2011 12:11 am
- Country: -
- Location: Massa (MS), Tuscany, Italy
Re: Error writing eeprom data
May you please try with an older release of arduino isp ? (like 0022)
Re: Error writing eeprom data
I have just tried both 022 and 023 and both versions give me the same verification error as I'm getting with 1.01.Romolo wrote:May you please try with an older release of arduino isp ? (like 0022)
As I said earlier, the bugs people have previously seen in using Arduino 1.0 and the ArduinoISP sketch were fixed in the recently released 1.01. The bugs themselves related to errors that would prevent me being able to successfully write the firmware too, and that is not the case.
I think I'll have to try removing my previously soldered wires and redo all of that, see if that makes any difference.
Re: Error writing eeprom data
You probably need to tell us what you need help withdru1das wrote:Who can help me?
- MikeB
- 9x Developer
- Posts: 18002
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Error writing eeprom data
If you can flash the firmware OK, then the connections are OK.
After acknowledging the bad EEPROM and formatting it, can you edit the radio and model settings with them stored OK in the EEPROM? (Change a setting, wait a few seconds, switch off, then switch back on, check the changed settings). This will check the EEPROM for correct operation.
If this is OK, read the EEPROM to a file.
Try writing the EEPROM, then read the EEPROM to another file.
Post the first read file, the file you tried to write and the last read file. Then we can compare them to try to help.
Mike.
After acknowledging the bad EEPROM and formatting it, can you edit the radio and model settings with them stored OK in the EEPROM? (Change a setting, wait a few seconds, switch off, then switch back on, check the changed settings). This will check the EEPROM for correct operation.
If this is OK, read the EEPROM to a file.
Try writing the EEPROM, then read the EEPROM to another file.
Post the first read file, the file you tried to write and the last read file. Then we can compare them to try to help.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Error writing eeprom data
Yes, the eeprom is operating correctly, changed settings stay saved.MikeB wrote:If you can flash the firmware OK, then the connections are OK.
After acknowledging the bad EEPROM and formatting it, can you edit the radio and model settings with them stored OK in the EEPROM? (Change a setting, wait a few seconds, switch off, then switch back on, check the changed settings). This will check the EEPROM for correct operation.
The files I saved are on my other computer, I'll attach them here tomorrow morning when I'm at that computer...If this is OK, read the EEPROM to a file.
Try writing the EEPROM, then read the EEPROM to another file.
Post the first read file, the file you tried to write and the last read file. Then we can compare them to try to help.
Mike.
Thanks for the offer!
Sv: Error writing eeprom data
As others have mentioned earlier you are not using the most common programmer. You might consider ordering another programmer since your problems are very hard to attribute to your software setup. A USBASP is only around 5$ on Ebay and that is the programmer that most people seem to use. If you are lucky the problem lies with the programmer. If you are less lucky the USBASP can still be used to program e.g. the very popular KKcopter multicopter boards.