Pico]OS & NXP DIP Arms

lpc800_dip8In the past, ARM microcontrollers have been available only in packages which are rather unfriendly for hobbyist use. However, NXP is now producing two Cortex-M0 microcontrollers in DIP packages, which are very handy for breadboard use and trough-hole soldering. The chips are LPC1114 in DIP28 package and LPC810 in DIP8 package. LPC1114FN28/102 has 32 kB flash and 8 kB ram, which is actually quite nice and allows running even a small RTOS. LPC810M021FN8 has only 4 kB flash and 1 kB ram, which is not much but still suitable for small bare metal applications. Continue reading “Pico]OS & NXP DIP Arms”

Object-oriented approach to embedded programming (with C++)

In my real, daytime job I have been working with object-oriented languages like Java, C++, C# and python for several years. On the contrary, hobby stuff with microcontrollers has always been pure C or assembly. Although I understand perfectly resource constraints of the embedded world, the limits are not totally as strict as they used to be: modern microcontrollers tend to have more and more memory and processing power. Because I also very firmly believe that object-oriented design really rules when creating complex systems, I decided to do a little expermenting what it would mean in Pico]OS embedded world. Continue reading “Object-oriented approach to embedded programming (with C++)”

Manuals uploaded to github

I recently uploaded doxygen-generated manuals of some pico]OS -related libraries into github pages:

  • pico]OS: Standard documentation with latest updates
  • picoos-micro: Micro-layer documentation (misc stuff + fat)
  • picoos-ow: Maxim/Dallas support for pico]OS
  • picoos-net: IPv4 & IPv6, socket layer and ethernet drivers for pico]OS

Pico]OS IPv6

As it seems that everyone’s sensor nodes have started using IPv6 I wanted mine to have it too. The sensor node in question is the one I built for storage room temperature monitoring some time ago. Current system uses pico]OS and uIP network stack. The uIP stack was taken from Contiki OS, which is described as the operating system for “Internet of Things”. The original uIP stack supports only IPv4, but Contiki has added IPv6 support.

However, it turned out that extracting IPv6 support from Contiki was not as easy as with the original IPv4 version. IPv6 code contained dependencies to Contiki timers (three different ones), clock module, list and memory block management functions. It turned out that most of these functions were usable as-is with pico]OS also, only etimer code needed more changes to use posTimer* functions.

To minimize differences to official Contiki code I decided to mimic the original function names that were related to packet flow. So now picoos-net -library contains tcpip_input, tcpip_output and tcpip_ipv6_output also. Device driver layer integrates to network stack through these functions.

I kept my original idea about aligning IP headers on 32-bit boundaries to allow efficient code on ARM-systems, as it allows also compiling with -Wcast-align to detect alignment errors (which cause odd effects on arm7tdmi cpus).

I did most of debugging with pico]OS unix port, which allowed debugging and testing without need to load code to microcontroller all the time.

Today I loaded the code to my Olimex LPC-E2129 board. At first system looked pretty dead, but it turned out that I had to modify the ethernet driver to accept incoming multicast packets also, otherwise icmp6 doesn’t really work at all. But after that change I was able to ping the board:

PING6(56=40+8+8 bytes) fd7b:ede2:27c7:3c:20c:29ff:fef8:d912 –> fd7b:ede2:27c7:3c:2bd:3bff:fe33:4d5
16 bytes from fd7b:ede2:27c7:3c:2bd:3bff:fe33:4d5, icmp_seq=0 hlim=64 time=8.111 ms
16 bytes from fd7b:ede2:27c7:3c:2bd:3bff:fe33:4d5, icmp_seq=1 hlim=64 time=6.177 ms

Browsing the Web Server also works nice:

Ipv6Web

It seems that Contiki uIP stack keeps evolving a lot currently, there have been a lot of changes during my port which I’ll have to merge into my version in the future. But I think that I’ll wait until next Contiki release before doing that.

Code is now available at GitHub.