budulinek / arduino-modbus-rtu-tcp-gateway

Arduino-based Modbus RTU to Modbus TCP/UDP gateway with web interface. Allows you to connect Modbus RTU slaves (such as sensors, energy meters, HVAC devices) to Modbus TCP/UDP masters (such as home automation systems). You can adjust settings through web interface.
GNU General Public License v3.0
165 stars 48 forks source link

exceeds available space in board in arduino nano #17

Closed lilisugeng closed 2 years ago

lilisugeng commented 2 years ago

Dear Budulinek I'm failed to build this project with arduino nano and its W5500 ethernet shield (RobotDyn). When I try to verify the program there is a message saying exceeds available space in board. But I thing you sucsess with the same hardware. Please let me know if I did wrong.

Thanks

KjellVerb commented 2 years ago

Probably due to some library updates... You can comment out the parts that generate a random MAC address and assign a static one, you'll be at 99%.

budulinek commented 2 years ago

Probably due to some library updates... You can comment out the parts that generate a random MAC address and assign a static one, you'll be at 99%.

Most probably (did not check yet). On Nano, there were just few bytes left. A library update may add few bytes, causing the issue you mention.

As suggested, try to comment out some code you do not need (random MAC, or some code in the webserver).

KjellVerb commented 2 years ago

Yeah I started testing with the gateway on a nano yesterday (thanks for sharing your work btw!) and had the same issue, I can confirm that fixed Mac gets you below the threshold.

I'm now trying to get fixed RS485 settings with DHCP enabled because that fits my usecase better. Will fork if it works.

budulinek commented 2 years ago

DHCP enabled on Nano? As far as I remember, DHCP enabled (dynamic IP) takes a lot of memory... Would require some drastic cuts to the code.

KjellVerb commented 2 years ago

I'm OK with removing the entire webserver (drastic cuts indeed), I only need a static config with DHCP so that I can assign the IP address from my IOT router.

FYI: removing the webserver and enabling DHCP gets me to 74%, re-enabling random MAC address to 75%

budulinek commented 2 years ago

Wow, some library got really hungry :-( A library update (probably StreamLib) eating additional 200 bytes of precious flash....

I did my best to reduce the footprint of the program, I am at the end of my abilities.....

budulinek commented 2 years ago

OK, I have removed ethernet data counter feature on the status page. If you need ethernet data counter, #define ENABLE_EXTRA_DIAG. Now the program fits on Arduino Nano (tested 4.6.2022, Arduino IDE 1.8.19).