Is it possible to reduce SRAM usage of Arduino Nano ethernet MySensors gateway (based on ECN28J60) ?



  • I need only few binary sensors/switches (relays) controllable from HomeAssistant, so I hoped to add their simple logic to
    https://github.com/mysensors/MySensorsArduinoExamples/blob/master/examples/GatewayENC28J60/GatewayENC28J60.ino
    But building above already takes: Sketch uses 29276 bytes (...) Global variables use 1757 bytes

    I tried to reduce SRAM usage, but disabling MY_DEBUG, MY_RADIO_RF24, MY_INCLUSION_* , MY_DEFAULT_* reduces sizes to
    Sketch uses 22980 bytes (...) Global variables use 1626 bytes (79%)
    only 😞

    Is there any way one can go down with SRAM usage further?


  • Mod

    @matkor yes. Use the W5100 module instead (if you need ethernet)

    If you don’t need ethernet, use usb or wifi since those options also use less ram.



  • @mfalkvidd

    Use the W5100 module instead (if you need ethernet)

    Good idea, thanks! Same code, but only W5100 based:
    Sketch uses 17190 bytes (...) Global variables use 853 bytes (41%)

    Using W5500 ( Ethernet2.h ) gives even better:
    Sketch uses 14712 bytes (...) Global variables use 809 bytes (39%)

    If you don’t need ethernet, use usb or wifi since those options also use less ram.

    I need some kind of 25m wire so options are ethernet, RS-485 or PJON


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 2
  • 10
  • 2
  • 198

51
Online

11.4k
Users

11.1k
Topics

112.6k
Posts