One of my dev boards is an LPC2378-STK.  It’s a fun board but, the JTAG programming interface for it is dreadfully slow.  I messed around a bit and learned that programming the flash memory with the iap interface was the way to go.  It was taking around 18 secs to write a sector with the isp interface, while almost instant when using iap.  In order to make use of the iap programming interface a secondary bootloader needs to be present in flash.

SD Secondary Bootloader

There’s a number of choices for implementing a secondary bootloader on the LPC2378-STK, ethernet, usb, and SD/MMC are available.  I chose the SD/MMC route.  The board also includes an LCD, and joystick.  I made use of these and added functionality to select from a list, the program that I want to load into flash.  The list is displayed on the boards LCD and represents the programs stored on the SD card.


USB Mass Storage

To populate the SD card with the programs, I set up the USB to act as a mass storage device.  The board shows up automatically under Linux and Windows.  I used the LPC_USB project to get started and coupled the result with Chans FAT for file system functions.  I found good examples for the SD/MMC interface from Martin Thomas.  For some reason I was using Windows at the time…  anyway, the JTAG I was using didn’t like the board getting reset.  I solved the problem with a bat file and a gdb script that assist with transferring the image to the SD card and resetting the JTAG.  They are included in the source package.  If your host is Linux, I’ll assume you can write your own script.  Note, everything works *much* better on Linux, even inside a VM.



The object code must be linked with respect to its location in flash.  Additionally the exception vectors need to be loaded into high memory in the startup script.  The ReadMe file in the source package includes a linker script for use with the GNU toolchain and startup assembly for building a project that can be launched with the bootloader.




Back in December ZipIts were selling for $9.99 on amazon.  It seemed like way too good a deal to be true, but I couldn’t resist the urge to get one, they have so many features that interest me.  I figured it was worth the risk.  I received the ZipIt, installed Linux, and tested out the hardware.  Impressed as I was, I ordered 10 more.  One of the primary reasons for acquiring  this many ZipIts was to set up and experiment with a mesh network.  I’m not disappointed, the value of my Zipits went way up this past weekend!  This post describes the steps for configuring the ZipIt as a node on a mesh network.

As of Linux kernel 2.6.38 the batman-adv kernel module is in mainline.  Using buildroot I configured and built the kernel to include the module.  I cross-compiled the user land utility batctrl and installed it to the /usr/sbin directory of Z2Lite.

To set up a mesh network node, boot Z2Lite and issue the following commands.  I put them in a script file and assigned the script to a key in tmux.conf.  Be sure to kill the wpa-supplicant process if it’s running.

z2lite:~# modprobe batman-adv

z2lite:~# ifconfig wlan0 down

z2lite:~# ifconfig wlan0 mtu 1476
z2lite:~# iwconfig wlan0 mode ad-hoc
z2lite:~# iwconfig wlan0 essid zipit ap 02:1A:34:56:78:9A channel 1

z2lite:~# batctl if add wlan0

z2lite:~# ifconfig bat0
z2lite:~# ifconfig wlan0 up
z2lite:~# ifconfig bat0 up

Assign a unique AP mac address for each node (i.e. ZipIt) and choose a channel that best suits your environment.  That’s it, everything else is just like other IP networks, ping, ssh etc.  The batctl utility has a few commands for troubleshooting the network if you have issues.  I haven’t had time to experiment yet, but the first is going to be location triangulation.  I think it’s built into the protocol.

© 2016 engine12