uIP stack

115 views
Skip to first unread message

Andrew Elwell

unread,
Apr 23, 2012, 5:21:48 AM4/23/12
to nanode...@googlegroups.com
Hi Folks,

Is anyone out there using the UIP stack on their nanode? I've been
playing with the MQTT port https://github.com/njh/NanodeMQTT but I'm
seeing some wierd setup issues

If I reflash (original nanode5 + ftdi cable, arduino 1.0) with the
mqtt_publish example (IP addresss changed to local IP, added gateway [
uip.set_gateway_addr(192, 168, 1, 1);
]
and setting the broker to be a local machine (
mqtt.set_server_addr(192, 168, 1, 251); ) I see the link up quickly
but the connect often takes an excessive time and seems to hang

tapping the reset button quickly often works and then the thing will
happily publish in loop()


Before I continue digging (tcpdump on broker) has anyone else experienced this?

Andrew

Ben Laurie

unread,
Apr 23, 2012, 6:11:52 AM4/23/12
to nanode...@googlegroups.com
Ah. I had all sorts of problems with intermittent function on the Ethernet chip - the problem is that at power up, all SPI chips are enabled. At least, explicitly disabling them fixes the problem.

Its actually kinda obvious that something is horribly wrong, at least with the code I'm using: it flashes the lights on the Ethernet port during initialisation, and when this problem occurs, the flash does not happen (lights still light up, tho - it seems the default config for the chip has at least carrier detect...).

Stephen Early

unread,
Apr 23, 2012, 1:48:37 PM4/23/12
to nanode...@googlegroups.com
I would recommend having a look using tcpdump.  If you're making connections from the Nanode, as the MQTT example does, you might run into problems because it'll use the same port and sequence number each time you start it up.  tcpdump should let you know if this is what's happening!
 
Steve

Nicholas Humfrey

unread,
Apr 23, 2012, 2:12:25 PM4/23/12
to nanode...@googlegroups.com
Yes, the uIP stack gets very confused after a reset when it starts reusing TCP sequence numbers. Apologies, I got a bit distracted with some other projects, I should go back and sort this out.

Was thinking of storing a boot counter in an EEPROM somewhere, that can then be used as a seed.

Sent from my phone

Andrew Elwell

unread,
Apr 23, 2012, 5:13:50 PM4/23/12
to nanode...@googlegroups.com
> Yes, the uIP stack gets very confused after a reset when it starts reusing
> TCP sequence numbers. Apologies, I got a bit distracted with some other
> projects, I should go back and sort this out.


Bingo! That seems to be the problem -- got a trace and shows the port
nos wrapping and then MQTT stops as it gets the FIN from an earlier
packet.

So, tcpdump available at http://dl.dropbox.com/u/6594808/tcpdump_nanode

that was taken (with tcpdump -f tcpdump_nanode host nanode) at the
same time as a sub run from another host to get # and $SYS/#


[aelwell@pcitgtelwell ~]$ egrep '(nanode|uptime)' nanode_mqtt_tests
starting a subscriber on laptop and getting all, then resetting nanode:
$SYS/broker/uptime 46179 seconds
$SYS/broker/uptime 46190 seconds
$SYS/broker/uptime 46201 seconds
$SYS/broker/uptime 46212 seconds
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
$SYS/broker/uptime 46223 seconds
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
$SYS/broker/uptime 46234 seconds
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
$SYS/broker/uptime 46245 seconds
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
nanode I'm Alive!
$SYS/broker/uptime 46256 seconds
$SYS/broker/uptime 46267 seconds
$SYS/broker/uptime 46278 seconds
... which shows the nanode falling over :-/

Ho Hum. I guess poking in the innards of uip is next then?

Nicholas Humfrey

unread,
Apr 23, 2012, 6:06:32 PM4/23/12
to nanode...@googlegroups.com


I would be very surprised if there was a problem in the core of uIP - it is very mature code and something like that would have been picket up by now. I did some work to sync up NanodeUip with the latest version of uIP. The only bit I haven't done is a complete update of the DHCP and DNS resolver code.

So I think it is more likely to be a problem with the interaction with the Arduino or ENC28J60 code. I have wondering if tweaking the uIP clock rate / code might help.


nick.


Andrew Elwell

unread,
Apr 23, 2012, 6:15:42 PM4/23/12
to nanode...@googlegroups.com
> I would be very surprised if there was a problem in the core of uIP - it is very mature code and something like that would have been picket up by now. I did some work to sync up NanodeUip with the latest version of uIP. The only bit I haven't done is a complete update of the DHCP and DNS resolver code.

OK - The sketch I was using is a rate-unlimited version of the example
-- see https://gist.github.com/2470662

I initially was trying to do the once-per-5-sec to test.mosquitto.org
(hence the commented out IP and addition of gateway) but when that
didn't work I hacked it to go to a local broker

> So I think it is more likely to be a problem with the interaction with the Arduino or ENC28J60 code. I have wondering if tweaking the uIP clock rate / code might help.

Pass - this is beyond my comfort zone :-)

Reply all
Reply to author
Forward
0 new messages