Go Down

Topic: PROGMEM on Due, working with Flash (Read 4663 times) previous topic - next topic



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 http://playground.arduino.cc/Main/PROGMEM work on the Due, given that the pgmspace.h library http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html 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



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:


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.

Go Up