PROGMEM on Due, working with Flash

Hello,

Firstly I apologise if this is covered elsewhere in the Due forum, I have tried to search but found nothing specific to the Due and the use of PROGMEM with the Due and working with flash.

Does PROGMEM Arduino Playground - PROGMEM work on the Due, given that the pgmspace.h library avr-libc: <avr/pgmspace.h>: Program Space Utilities seems to require #include <avr/io.h>?

http://www.oreilly.de/catalog/arduinockbkger/Arduino_Kochbuch_englKap_17.pdf

Is there another way to store values directly into and work with flash memory on the Due?

What I'm looking to do is to:

  1. start the Due with an initial setpoint.
  2. update / send a revised setpoint from another device using CAN BUS, serial etc.
  3. update the initial setpoint in the due, so that should I remove the power from the due, under restart, or power up it uses the revised setpoint stored in flash memory that replaced the original setpoint value.

Thanks for your thoughts in advance

Rob

You can't use PROGMEM on the Due. There is also zero EEPROM on the Due so you can't use that either. You could write values into program memory space. Unfortunately there isn't a lot of existing code for you to use. Here is a link to some work which has done been on the subject:

http://arduino.cc/forum/index.php/topic,149445.0.html

But, you won't find it too terribly complete. Also, it's not a really great idea to try to write into program memory very often. Flash tends to not be good for too many write cycles (perhaps 10k - 100k). So, if you write the setpoint every minute then things will last 7-70 days. You can prolong things with less frequent writes. It sounds like maybe you only intend to write to flash every time the unit is turned on. That would probably be OK.

If you need to write frequently then you should get an I2C connected EEPROM chip and put it on a shield.