The best memory chip for a SAMD node?

  • I am developing a SAMD node and wonder what would be the best memory chip to fullfill the following requirements:

    • the ability to safe application data like the MySensors configurations and save states
    • OTA update
    • good life time
    • not too expensive

    The internal EEPROM emulation is not a solution. It has only 50.000 write cycles and minimum 4kb erase pages.

    So, what do you think about it? The SAMD is getting more and more around..

    1. My first thought was to put a flash on it like on the moteino. But I would not get MySensors up and running because of the very big erase pages (although I could double the space - flash is cheap - and write an API which enables me to write single bytes with wear leveling in mind). This needs adaptations to MySensors but only in the hardware specific part.

    2. I could get a good small EEPROM and write / adapt the bootloader to load a new rom over the air. The space for the bootloader is not an issue (8kb or may be 16kb). But the bootloader would get more and more complex. It would need configurations, more frequent updates because of changes or bugs and it could even get MySensors specific!? This also needs adaptations to MySensors - but theses are already work in progress ??

    3. I could also use a 2Mbit EEPROM to store the OTA rom and application data. But this one would be much more expensive (like about three times of a flash) and needs adaptations to MySensors too to safe the OTA rom in an EEPROM and not flash. Adapting the bootloader would not be an issue for me - I already did it.

    4. The internal EEPROM for OTA updates is not sufficient due to the max of 16kb - so far for the official emulation / lock. But one could cut the internal flash into halfs and use the upper one for the OTA download. The bootloader, the linker script and even the region lock could take care of this memory border. This might be okay for the 256k variant but not for the smaller ones !?

    So, many options.. and I'm not sure which way to go.. may be I tend to option 2?

  • Mod

    I'd go with option 1 and - no need to write your own file system.

  • Hardware Contributor


    that's very interesting 🙂
    I thought a bit about this as i have some custom samd21e nodes. but these are proto for fun, so i have not solved the question, no ota 😞
    but I thought that 4) could solve it. Even with d21e17 (i'm using those) that is 128k, i don't know what could be the resulting free program mem but i think a lot more than 328 lol. the 256k is nice too sure
    I still needed an eeprom for using with mysensors so I'm using a cheap basic 24lc32 for the datastorage, i didn't wanted emulation.
    Thinking about this, it seems that we could roughly samd+spiflash vs esp32 : nice mcu with flash for ota, spiffs...
    but i like samd too, it's cool, and my serial gw is a samd21e17 dongle, so.. 🙂

    But your idea is really interesting if SAML could be integrated to arduino in future. it starts to appear at interesting price in the tqfp version, and i think could be a very nice alternative to pico 328p. I mean for arduino world, as there are other alternative like cc1310 etc but not arduino.

    Sorry I didn't help you too much 😊 but the link from @mfalkvidd is nice 👍
    I will follow your work 🙂

  • @mfalkvidd I already found a similar library - but cannot find it again. My thoughts were that a full filesystem is really too much overhead for just storing some configuration bytes. But the more I think about it, the more I like the idea. Flash is really cheap and with 8Mbit it would be enought - also for wear leveling. The first 2Mbits are reserved for OTA downloads and the rest is formatted with the filesystem. A application could reuse it for data logging or something like this..

    I already tried to implement it. But spiffs is not a out of the box library and I'm not quite sure how this hardware specific should be integrated to MySensors..

    I also found this for the spark core:

  • @scalz Thanks for your thoughts! The cc1310 is really interesting.. may be for the next project 😉
    I like the SAM family but I sometimes I have doubts if I have chosen the right mcu. This is especially for the 5000$ for a USB id for the bootloader if I am going to sell some of these things.. May be I could circumvent it with an STM? But I like it to write my own bootloader too 🙂
    The SAML is really nice and I'm already experimenting with it 😄
    So, I will go with the flash option and prepare a second prototype. I hope to get my first panel after this round..

  • Hardware Contributor

    what? SAML? oh no, unfair 😄 do you use it with Atmel studio, not with arduino yet? I have a big sensors order to do, so I think I will add one for curiosity.
    Same for me about the mcu moves too fast! and always something different. I'm really curious to try esp32 and its price, it could be my winner if power consumption is nice. And no, please, don't tell me you have the ESP31 beta version 😆

    Keep the good work, I will follow it, sure 😉

  • @scalz No, it is a SAMD so far 😉 Arduino integration for SAML would be a really tough challenge - although it is nearly pin compatible but the registers are not. I go for the low power sub-ghz route - so I have never played with an ESP. The real game changer may be the official meshing for BLE..

  • Hardware Contributor

    ah oki. i agree about saml registers, that's a big job.
    I'm for lowpower sub ghz too mainly because i don't want wifi for everything.
    but i have few things working with esp. and this is really a nice mcu if you don't look at pin count&mux, and power consumption. But spiffs, ota, lot of libs etc works very well. Impressive when you think this is quite recent.

    but look at the LoPy, esp32 based. ble mesh or subghz will be possible. i can't wait to make my own 😉
    I think esp32 will be a game changer, sure more expensive than 8266. but I remember that 8266 didn't start at 2$ and should look at the specs..