1

I am using the excellent UIPEthernet library to get an Arduino Nano to drive an ENC28J60 Ethernet Shield for a UDP-based application. But I think the poor library has to do a lot of work to make up for the limitations of the ENC28J60, and that makes the library large compared to the W5x00 family devices.

My sketch is starting to run out of the 32K (actually 30720 bytes) program space; I'm at 26K and I've still got functionality to add. Right now, the application is using DHCP to get the IP address, it picks up UDP discovery broadcasts from a controller PC on the LAN and then asynchronously chats to it (and only it) with UDP msgs. My uip-conf.h, condensed, looks like:

#define UIP_CONF_MAX_CONNECTIONS   0
#define UIP_CONF_MAX_LISTENPORTS   0
#define UIP_CONF_BUFFER_SIZE      98
#define UIP_CONF_TCP_MSS          64
#define UIP_CONF_RECEIVE_WINDOW  256
#define UIP_CONF_LOGGING           0
#define UIP_CONF_UDP               1
#define UIP_CONF_UDP_CONNS         2
#define UIP_CONF_UDP_CHECKSUMS     1
#define UIP_CONF_BROADCAST         1
#define UIP_CONF_STATISTICS        0

So I'm looking at ways to shave some KBs. There is much made of the fact that you can disable the library's UDP subsystem to save ~5KB (which is sort of how much I'm looking for, maybe less, though more is always nice!). And I was rather hoping I could disable TCP, but I can't see an easy way.

Are there any configurations or tricks I can play with UIPEthernet to save code space, given I'm not using TCP?

(I do have other options: switch to a W5x00 board, get a CPU with bigger memory, etc - but I want to explore this option before I revise the hardware spec).

  • you could use the EtherCard library – Juraj Dec 13 '19 at 6:56
  • @Juraj I was wondering that - but it's quite a lot of rewriting and testing. Also, the EtherCard docs say it has no ARP cache, so it can't talk to LAN non-gateway hosts; this app is all about doing that! – SusanW Dec 13 '19 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.