6LowPAN with the Merkur-Board

In for the rpi6lowpan to be actually usefull it needs to talk to some sensors. The Merkur Board is open hardware:

Merkur-Board

It has digital outputs as well as digital, analog and PWM outputs and supports attaching Arduino Grove Modules which should make experiments simple. In order to test things I use the Plant Oberservation Kit set.

One uses USB-Serial converter to flash the device. Details on how to connect it are here. Once the converter is attached to the board it's LED starts to blink (in my case 4 times short, one time long).

Once flushed the board can be run on battery power.

Compiling works like

apt-get install avr-libc binutils-avr gcc-avr gdb-avr simulavr avrdude doxygen
git clone https://github.com/osdomotics/osd-contiki
cd ./osd-contiki/examples/osd/arduino-plantobserving
./run.sh

The build software can then be flushed to the device. Note that it uses /dev/ttyUSB0 by default. This needs to be adjusted. When trying the flash the merkur-board with the usual USB-serial converter I see:

$ sudo apt-get install avrdude
$ cd osd-contiki/examples/osd/arduino-plantobserving
$ ./flash.sh /dev/ttyUSB4
INFO: compiling with CoAP-13
avrdude -pm128rfa1 -c arduino -P/dev/ttyUSB4 -b57600 -e -U \
flash:w:arduino-example.osd-merkur.hex:a -U \
eeprom:w:arduino-example.osd-merkur.eep:a
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x72
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x6c
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xc0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x72
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x6c
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xc0
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x72
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x6c
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x72
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x6c

avrdude done.  Thank you.

Makefile:88: recipe for target 'flash' failed
make: *** [flash] Error 1

even if I ground the reset pin (Pin 3). However if I use a FTDI basic breakout flashing works as expected:

....

The flashed firmware uses channel 26 and pan_id 0xabcd by default. This can be seen on the serial output (you can use the same serial converter as for flashing). To read the serial console I've so far used the serial console window from the arduino ide since screen doesn't support the 38400 baud used by the merkur-board ().

While I'm seeing packages looking for a RIPL router send by the merkur-board when using a Raspberry Pi as described in here, I can't ping the board on it's link local address yet.

So let's for now use a second merkur board as edge-router.

$ sudo ./tunslip6 -s /dev/ttyUSB4 -B 38400 2001:DB8:c001:f00d::1/64
$ ping6 -c 1 2001:db8:c001:f00d:221:2eff:ff00:347c
PING 2001:db8:c001:f00d:221:2eff:ff00:347c(2001:db8:c001:f00d:221:2eff:ff00:347c) from 2001:db8:c001:f00d::1 tun0: 56 data bytes
64 bytes from 2001:db8:c001:f00d:221:2eff:ff00:347c: icmp_seq=1 ttl=63 time=201 ms
--- 2001:db8:c001:f00d:221:2eff:ff00:347c ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 201.620/201.620/201.620/0.000 ms
$ ./coap-client -m get coap://[2001:db8:c001:f00d:221:2eff:ff00:347c]/.well-known/core
v:1 t:CON c:GET i:8ecd {} [ ]
</.well-known/core>;ct=40,</moisture/v>;title="Moisture voltage"v:1 t:CON c:GET i:8ece {} [ ]
;rt=UCUM:"V";ct="0 5"

We can now query the moisture sensor using libcoap:

$ ./coap-client -m get coap://[2001:db8:c001:f00d:221:2eff:ff00:347c]/moisture/v

Some Linux, Contiki interop progress

Looking into the above problem in some more detail it shows that using rpi6lowpan setup in monitor mode we see all the packages sent from the merkur boards on Linux but not vice verca. If we disable sleep mode in contiki we can receive frames from Linux when pinging the merkur-board from the Raspberry Pi:

Received NS from fe80::80cd:9a1:845b:4d6a to ff02::1:ff00:3304 with target addressfe80::221:2e��f:ff0N��
Sending NA to fe80::80cd:9a1:845b:4d6a from fe80::221:2eff:ff00:3304 with target address fe80::221:2eff:ff00:3304
sicslowpan output: sending packet len 80
before compression (40): 6000000000283aff
...

...but the Linux node doesn't see the replies. More to come when we have a second pi that can act as monitor.