ntruchsess / arduino_uip

UIPEthernet: A plugin-replacement of the stock Arduino Ethernet library for ENC28J60 shields and breakout boards. Full support for persistent (streaming) TCP-connections and UDP (Client and Server each), ARP, ICMP, DHCP and DNS. Build around Adam Dunkels uIP Stack. Further developed version can be found on https://github.com/UIPEthernet/UIPEthernet
488 stars 212 forks source link

UdpNtpClient and WebServer - causing reset - UIPEthernet_v1.09_ext - extended API #106

Open stevstrong opened 9 years ago

stevstrong commented 9 years ago

Hi, I don't know whether am doing something prohibited, it definetly should not work, am I doing something wrong or it is just an issue... I am using a web server together with a web client and NTP client on Arduino Pro Mini with Enc28j60, both operating with 3.3V stabilized, capable of 1A. The problem I have is that after the NTP time is read out, accessing the web server form my PC causes the Ardunio to reset. The SW works when the UDP part is not used. In this case I can access the web server from my PC and the Arduino can access another server on my network without a problem, in time division manner. When UDP gets activated, the time is captured and displayed correctly each 10 seconds, no problem. The reset occures as soon as the web server is accessed, or data is received over the web client pipe. After reset, I only get the startup messsages in the serial monitor, nothing else works. HW reset needed. For reference I attach here my code:


https://github.com/stevstrong/HomeServer/blob/master/home_server.ino


Can anyone imagine what am I doing wrong?

Thank you in advance.

stevstrong commented 9 years ago

UPDATE: I made some more research on this issue. Measured the free RAM on main loop level with this function (http://playground.arduino.cc/Code/AvailableMemory), this shows 530 bytes. Furthermore, after reset-restart the ATmega328P still accesses the ENC28j (SPI clock still showing some pulses repeatedly each 100ms) but the serial terminal is dead. When accessing the web server from PC the SPI the SPI clocks will be more frequent for some time, meaning the main loop somehow works, data is being received.

Well, I don't know if it makes sense to do more actions in this direction, I would highly appreciate some expert answer on this issue. Thank you again.