Skip to content
  • 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
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

RS485 & ENC28J60 gateway

Scheduled Pinned Locked Moved Hardware
4 Posts 2 Posters 761 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
    • TheoLT Offline
      TheoLT 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
      • TheoLT 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
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          15

          Online

          11.7k

          Users

          11.2k

          Topics

          113.0k

          Posts


          Copyright 2019 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
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular