Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. RS485 & ENC28J60 gateway

RS485 & ENC28J60 gateway

Scheduled Pinned Locked Moved Hardware
4 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dzjrD Offline
    dzjrD Offline
    dzjr
    wrote on last edited by
    #1

    Hello MySensor friends;

    I have made a RS-485 tot ethernet gateway with a ENC28J60 Ethernet adapter, and it is working good.

    Only when i load it to the Arduino i got a warning that 97% of the dynamic memory is used.
    Is it a problem for a good working gateway?

    All the not direct needed parts i comment out, including the debug.

    The message: It is in dutch....

    De schets gebruikt 27498 bytes (85%)  programma-opslagruimte. Maximum is 32256 bytes.
    Globale variabelen gebruiken 1998 bytes (97%) van het dynamisch geheugen. Resteren 50 bytes voor lokale variabelen. Maximum is 2048 bytes.
    Weinig geheugen beschikbaar, er kunnen zich stabiliteitsproblemen voordoen
    
    

    The sketch:

    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    // Enable RS485 transport layer
    #define MY_RS485
    
    // Define this to enables DE-pin management on defined pin
    #define MY_RS485_DE_PIN 2
    
    // Set RS485 baud rate to use
    #define MY_RS485_BAUD_RATE 9600
    
    // Enable this if RS485 is connected to a hardware serial port
    //#define MY_RS485_HWSERIAL Serial1
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    // Enable gateway ethernet module type
    //#define MY_GATEWAY_W5100
    #define MY_GATEWAY_ENC28J60
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,0,14
    
    // If using static ip you can define Gateway and Subnet address as well
    #define MY_IP_GATEWAY_ADDRESS 192,168,0,1
    #define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    
    // The port to keep open on node server mode / or port to contact in client mode
    #define MY_PORT 5003
    
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x59
    
    
    //#define MY_NODE_ID 01
    //#include <Ethernet.h>
    #include <SPI.h>
    #include <UIPEthernet.h>
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
      //sendSketchInfo("RS 485 Gateway", "1.0");
    	// Present locally attached sensors here
    }
    
    void loop()
    {
    	// Send locally attached sensors data here
    }
    
    1 Reply Last reply
    0
    • T Offline
      T Offline
      TheoL
      Contest Winner
      wrote on last edited by
      #2

      I'm not sure, but I think it depends on whether or not the code is using large local variables. At some point it's no longer possible to claim a space on the heap, because the free heap space is to fragmented

      I have one Arduino that has a sketch with the same warning, but it's been running for a long time. No problems so far. But I've declared most of the variables global.

      This is AdaFruits article on the topic:
      https://cdn-learn.adafruit.com/downloads/pdf/memories-of-an-arduino.pdf

      dzjrD 1 Reply Last reply
      1
      • T TheoL

        I'm not sure, but I think it depends on whether or not the code is using large local variables. At some point it's no longer possible to claim a space on the heap, because the free heap space is to fragmented

        I have one Arduino that has a sketch with the same warning, but it's been running for a long time. No problems so far. But I've declared most of the variables global.

        This is AdaFruits article on the topic:
        https://cdn-learn.adafruit.com/downloads/pdf/memories-of-an-arduino.pdf

        dzjrD Offline
        dzjrD Offline
        dzjr
        wrote on last edited by
        #3

        @theol

        thank you for your response and the link to the interesting document!

        The gateway has only run a few hours with 3 node's, so do not know if it goes well after days.

        As far as I could see, I turned off all unnecessary lines in the sketch.
        However, I notice the W5100 library is a lot less used, but I only have that for a UNO ....

        1 Reply Last reply
        0
        • dzjrD Offline
          dzjrD Offline
          dzjr
          wrote on last edited by
          #4

          I have now been running the gateway for more than half a year, and unfortunately the gateway runs regularly (about once every 2 weeks), so I am going to replace the gateway for a W5100 ethernet adapter.
          I used it in a second gateway, and this gateway is stable, I haven't had any crashes in about 4 months.

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          20

          Online

          12.0k

          Users

          11.2k

          Topics

          113.4k

          Posts


          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular