Open pbolduc opened 5 years ago
Yes, I was only focusing on using the external eeprom when I made the initial samd support, so emulated eeprom was never made.
We should support the emulated part, but as the emulated eeprom is done in flash, which has a reduced re-write count (compared to real eeprom), we should still keep the external eeprom as an option for gateways etc (which stores routing tables, and other "frequently updated" content in eeprom).
Right now coding time on mysensors is almost at zero, due to other projects that has higher WAF score :) but I'll be happy to do code reviews..
Moved from #1066.
I am using a Moteino M0. A Moteino M0 uses a ATSAMD21G18 processor. When I try to run a simple serial gateway, I found during initialization when MySensors tries to write the parent node id to eeprom, the process hanges. I put debug statements before and after each line to isolate the place it hung. According to the SAM D21 datasheet, the eeprom is emulated. Here is the line where it hangs,
https://github.com/mysensors/MySensors/blob/3ae4fb657f82ec7c10a22a8dd8c334f9d8f1f4b4/core/MySensorsCore.cpp#L165
A note from Moteino M0 guide, https://lowpowerlab.com/guide/moteino/moteinom0/
I also found this arduino issue related to the eeprom on SAMD.
I think the current SAMD configuration was developed around the Sensebender-Gateway. Based on the BOM, the Sensebender-Gateway has an extra "32Kb (4096x8) Serial EEPROM with Unique Serial Number"
In my local copy of MySensors, I #ifdef wrapped the calls to hwRead/hwWrite and the gateway runs as expected. In the MyHwSAMD.h, there is currently no way to opt out of the external EEPROM,
https://github.com/mysensors/MySensors/blob/3ae4fb657f82ec7c10a22a8dd8c334f9d8f1f4b4/hal/architecture/SAMD/MyHwSAMD.h#L48-L50
In my case, I can think of the following options for persisting the configuration,
I would like some help coming up with a proposed solution that can be merged into the main MySensors. The very first thing that comes to mind is adding a new defines to define what kind of storage to use (eeprom, external eeprom, i2c / spi flash, none).