Routing table saving vs EEPROM write cycle limitations



  • Hi All,

    I'm new to this forum and I love the solutions demonstrated here both on HW and SW level.
    I just started to read/understand the MySensors API and I might have an interesteing finding on the topic.

    As I see, the routing table is periodically saved to the EEPROM based on the following code snippets:

    MyConfig.h

    /**
    * @def MY_ROUTING_TABLE_SAVE_INTERVAL_MS
    * @brief Interval to dump content of routing table to eeprom
    */
    #ifndef MY_ROUTING_TABLE_SAVE_INTERVAL_MS
    #define MY_ROUTING_TABLE_SAVE_INTERVAL_MS    (10*60*1000ul)
    #endif
    

    MyTransport.cpp

    ...
            #if defined(MY_RAM_ROUTING_TABLE_ENABLED)
                    if (hwMillis() - _lastRoutingTableSave > MY_ROUTING_TABLE_SAVE_INTERVAL_MS) {
                            _lastRoutingTableSave = hwMillis();
                            transportSaveRoutingTable();
                    }
            #endif
    ...
    void transportSaveRoutingTable(void) {
            #if defined(MY_RAM_ROUTING_TABLE_ENABLED)
                    hwWriteConfigBlock((void*)&_transportRoutingTable.route, (void*)EEPROM_ROUTES_ADDRESS, SIZE_ROUTES);
                    TRANSPORT_DEBUG(PSTR("TSF:SRT:OK\n"));  //  save routing table
            #endif
    }
    

    So, is this means that the enforced routing table backup to the EEPROM (even if it is not updated) will kill the EEPROM around 1.9 years (10 min saving period means 144 savings per day, thus the 100k EEPROM write life cycle will be reached in 694 days)?

    If I'm right then is it worth to update the API and increase the default saving time in the MyConfig.h (to save a lot of users whom do not know these function in depth and just use the default code) or add some additional code which allows the EEPROM update only when the routing table is updated?

    Or I just miss something and it is handler properly.

    Regards,
    Andrew


  • Mod

    @andrew said:

    Or I just miss something and it is handler properly.

    The hwWriteConfigBlock() function only writes bytes that actually changed to eeprom.
    This means that as long as the routing table is static, no eeprom writes will be performed.



  • Oh, I see. That make sense.
    Thank you for the reply!


Log in to reply
 

Suggested Topics

  • 1
  • 3
  • 10
  • 5
  • 1
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts