[ell-i-developers] Re: Status report: IP and ARP work on real hardware -- but still WIP

  • From: Pekka Nikander <pekka.nikander@xxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Sat, 15 Mar 2014 12:24:57 +0200

>> After fixing a couple of tiny bugs, also UDP works now and CoAP responds.  
>> However, there is still something wrong with CoAP replies, Copper doesn't 
>> process them.  I haven't pushed the latest changes yet.  Will continue 
>> tomorrow.
> 
> It looks like the remaining problem is missing UDP checksums, otherwise CoAP 
> seems to be working.  Apparently Mac OS X requires UDP checksums on received 
> packets.  Adding good checksum code will take a while; most probably I won't 
> get it done today.

UDP checksums are now off-by-one, and I don't understand why.  IP checksum code 
appears to be ok, based on a couple of test cases.  UDP checksums are based on 
the IP checksum code.  Additionally, the inline assembler optimisation that I 
did does not work, but that can wait for later.

The current code is available in the feature-coap-temp branch.  

I would appreciate help with the UDP checksum off-by-one bug, I just cannot see 
it.

The IP checksum code is here:

https://github.com/Ell-i/Runtime/blob/feature-coap-temp/stm32/libraries/CoAP/ip_checksum.c

The UDP checksum code is here:

https://github.com/Ell-i/Runtime/blob/feature-coap-temp/stm32/libraries/CoAP/udp.c#L70

A little bit of googling finds lots of references to the actual algorithms.

An example how to use CoAP from "userland" is here:

https://github.com/Ell-i/Runtime/blob/feature-coap-temp/stm32/examples/CoAP/hello_world.cpp

In addition to the off-by-one, there appears to be some bug in ENC28J60 
initialisation, so that sometimes when the MCU is initialised the ENC28J60 is 
not, and the MCU appears to get old packets from ENC28J60 packet buffers.

Other than these two bugs, the IP/UDP/CoAP is good enough for initial usage.  
Hence, once we get these bugs fixed, Eero and others can start putting together 
the Runtime with the Arduino IDE, and test it.  For early-adopter bloggers that 
prefer Makefiles, we will be ready to ship the code earlier.

--Pekka


Other related posts: