Retain eeprom on sketch upload with the DUE

bernard

Well-known member
Hi all
Each time i upload a sketch on the DUE the eeprom is erase and i can 't keep the IMU calibration.

I use the Programming USB port (With the Native one the upload is not working each time)

Maybee someone have a solution without using a SDcard reader ??

Thanks.
 
Hi Jurgen.
Very good idea.
I take a look on it.
In Forum i read that Alex use the NativeUsb port but i read on the net that the NativeUsb can't work if Serial is use in the sketch so maybee it's why the NativeUpload don't work each time and not sure the eeprom is preserve with the nativeUSB port ?
In all the test i have done only the programming port work perfectly.

Thanks.
 
Hi Jurgen.
I take a look at the datasheet of the RTC but only 56 Byte of ram :woohoo: so for the IMU it's ok but not for all the mower parameter .
I thing i try to add the IMU calibration value in mower.cpp for the moment and remove the calibration test on startup.
Thanks.
 
Hi Bernard,

:cheer: not the RAM on the DS1307 RTC. The Module have two Chips on Board an DS1307 RTC and an AT24C32 I2C EEPROM.

Regards
Jürgen
 
Hi Jurgen.
Yes i see this yesterday and find sample code to read and write on the AT24C32 but need more test to find the correct I2C adress and adapt for azurit.
If it's work i simply add a Pfod menu to backup the Due eeprom on the AT24C32 and restore ir after the flash of the DUE.
Hope It's possible.
Thanks again .
 
Hi Jurgen.
It's working perfectly
In Pfod i add a Backup and Restore Menu to copy the arduino eeprom address 0 to 900 into the Tiny RTC memory chips.

1 Only the first time you need to load factory setting and save setting to be sure all the data are saved in the Arduino eeprom.
2 Use Backup option to copy the data into the RTC.
3 Upload the new sketch into the Due.
4 Use Restore option to copy the data from the RTC into the Arduino eeprom.

So now after each sketch upload simply use restore to refresh all the user setting and calibration.

I finish to write the code in the last Github but don't know how to send a pull request .
Or if you want i can post the change in the forum.

Again Thanks for the RTC idea.
 
Btw, wouldn't it be easier/cleaner to just modify flashmem.cpp (write/read) to simply use the RTC EEPROM module instead of the Due EEPROM?
 
Hi Alexander.
If i click on Publish i have not the permission.
The branch i add is named Rtc-Backup.
In the bottom of the change list The Commit to RTC-Backup is Grey
If i lick on Pull request in the upper left the Send Pull Request is grey also.
Sure i forget Something.
??
 
Yes why not but
RTC become mandatory ?
The backup is easy to write because it's copy byte to byte.
To write directly into the RTC it's little more complex to manage each type of data.
Thanks.
 
Yes, RTC is mandatory. The due.cpp/.h can be removed (I think it's actually not used anywhere). The code related to Due EEPROM inside flashmem.cpp can be removed as well. The only relevant (elementary) functions are read (addr, byte) and write (addr, byte) - The remaining functions (read array etc.) should use the elementary functions.

I will look into the Pullrequest problem...
 
Sorry i'am going to see your message and yes i forget the summary.
But a permission is mandatory.
Sanstitre_2017-07-23.jpg

Attachment: https://forum.ardumower.de/data/media/kunena/attachments/3545/Sanstitre_2017-07-23.jpg/
 
Zuletzt bearbeitet von einem Moderator:
Oben