with the new SMAD21 Topboard: no real* EEPROM anymore ?

I got back to my old RTC-topic after quite a long while,
--> https://industruino.com/forum/help-1/question/rtc-for-industruino-ind-i-o-with-at90usb1286-mcu-272
and I finally see, that you did a new Topboard with ATSAMD21G18 MCU and independent RTC with Battery.
That's really nice, I like this MCU (know it already from my arduino zero) !
But there's some small disadvantage now:
compared to the other two topboards, this MCU has no real* EEPROM anymore
*(that can survive both: switching off the MCU and/or flashing the MCU)...

So I expected, that you put some small (serial) EEPROM or FRAM onto this new topboard.

Any other workarounds known ?

Dirk
Dirk
22
| 3 1 2
Asked on 6/25/17, 11:45 AM
0
vote
2689 Views

Hi Dirk,

This is a known limitation of the M0 MCU's.

There is a workaround that functions on the Industruino D21G: use this library for flash storage: https://github.com/cmaglie/FlashStorage

Here is a modified example that shows the re-starts on the Industruino LCD:

 

/*
  Store and retrieve an integer value in Flash memory.
  The value is increased each time the board is restarted.

  This example code is in the public domain.

  Written 30 Apr 2015 by Cristian Maglie
  Modified for Industruino D21G by Tom, June 2017
*/

#include <FlashStorage.h>

// Reserve a portion of flash memory to store an "int" variable
// and call it "my_flash_store".
FlashStorage(my_flash_store, int);

// Note: the area of flash memory reserved for the variable is
// lost every time the sketch is uploaded on the board.
#include <UC1701.h>
static UC1701 lcd;

void setup() {
  SerialUSB.begin(9600);
  //  while (!SerialUSB)  {};
  lcd.begin();


  int number;

  // Read the content of "my_flash_store" and assign it to "number"
  number = my_flash_store.read();

  // Print the current number on the serial monitor
  SerialUSB.println(number);

  lcd.setCursor(1, 1);
  lcd.print("FlashStorage demo");
  lcd.setCursor(1, 3);
  lcd.print("re-starts: ");
  lcd.print(number);
  
  // Save into "my_flash_store" the number increased by 1 for the
  // next run of the sketch
  my_flash_store.write(number + 1);
}

void loop() {
  // Do nothing...
}

 

Tom
Tom
5675
| 1 1 3
Answered on 6/29/17, 8:20 AM
0
vote

thanks Tom, I know this library, but when you (or the customer) updates the firmware (flash the MCU), everything is gone ... >>This is a known limitation of the M0 MCU's. yeah, so since this is known, I would have expected, that you put some small (serial) EEPROM or FRAM onto this new topboard, -> so that one can easy migrate an (EEPROM-using) application from the "old" topboards to the new topboard... ;-)

Dirk
on 6/29/17, 10:26 AM

thanks Tom,

I know this library,
but when you (or the customer) updates the firmware (flash the MCU),
everything is gone ...

>>This is a known limitation of the M0 MCU's.
yeah, so since this is known,
I would have expected, that you put some small (serial) EEPROM or FRAM onto this new topboard,
-> so that one can easy migrate an (EEPROM-using) application from the "old" topboards to the new topboard...

;-)

Dirk
Dirk
22
| 3 1 2
Answered on 6/29/17, 10:25 AM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

37 follower(s)

Stats

Asked: 6/25/17, 11:45 AM
Seen: 2689 times
Last updated: 6/29/17, 10:25 AM