Arduino Forum

Products => Arduino Due => Topic started by: robertspark on Mar 19, 2013, 02:19 pm

Title: PROGMEM on Due, working with Flash
Post by: robertspark on Mar 19, 2013, 02:19 pm

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 ( work on the Due, given that the pgmspace.h library ( seems to require #include <avr/io.h>? (

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

Title: Re: PROGMEM on Due, working with Flash
Post by: AdderD on Mar 19, 2013, 04:15 pm
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:,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.