Quick Start Guide
6LoWPAN Clicker is a PIC32MX board designed by MikroElektronika.
Initial board state
Out of the box, a 6LoWPAN Clicker will have a MikroElektronika bootloader on it. You will need to program the board with a hex file to get started.
Powering 6LoWPAN Clicker
The Clickers can be powered in one of 2 ways:
- Using a microUSB cable
- Using a pair of AAA batteries
Obtaining .hex files
See our working with Contiki guide to learn more about building simple apps (LED flasher, UDP Client etc.) to get started on 6LoWPAN Clicker.
Programming a 6LoWPAN Clicker
There are 3 ways to program your board:
- using USB with AVRDUDE
- using jumper leads and Pickle from Ci40
- using an in-circuit programmer (such as a Pickit3, ICD3 or mikroProg)
AVRDUDE is a bootloader that allows you to program your 6LoWPAN Clicker over USB. To program using AVRDUDE we must first overwrite the default bootloader.
This guide assumes that the 6LoWPAN Clicker is in it's factory default state (with the MikroE bootloader installed).
Flash 6LoWPAN Clicker with AVRDUDE bootloader
$ git clone https://github.com/thotypous/mikroe-uhb.git $ cd mikroe-uhb $ sudo apt-get install python-setuptools $ sudo ./setup.py install
Connect your 6LoWPAN Clicker over USB but leave the power switch off
$ sudo ./mikroe-uhb -v
Power on the 6LoWPAN Clicker while this application is running. You should see output similar to this:
$ sudo ./mikroe-uhb -v DEBUG:mikroeuhb.hid.linux:opening device vendor=1234, product=1 INFO:mikroeuhb.hid.linux:USB device 1234:0001 plugged INFO:mikroeuhb.hid.linux:USB ID matches the expected one DEBUG:mikroeuhb.device:send cmd: stx, cmd=INFO, addr=0x00000000, counter=0x0000 DEBUG:mikroeuhb.device:recv data: 3801140008000000000008000300001004000002050000130600000000c0079d07364c6f5750414e20636c69636b65720000000000000000f5c5e3ddc32ee4aa McuType: 'PIC32' EraseBlock: 0x1000 WriteBlock: 0x200 BootRev: 0x1300 BootStart: 0x9d07c000 DevDsc: '6LoWPAN clicker' McuSize: 0x80000
Download the AVRDUDE bootloader from here.
Flash the bootloader onto the board with the following command:
$ sudo ./mikroe-uhb --disable-bootloader -v avrdude-bootloader.hex
Power cycle the 6LoWPAN Clicker. LED1 should now be flashing, indicating that the bootloader is ready. If you want to enter the bootloader again in future, simply hold Button1 (T1) when booting the board. LED1 will flash rapidly while in the bootloader.
Program a .hex file onto an AVRDUDE 6LoWPAN Clicker
Firstly, install the AVRDUDE programmer on your machine:
$ sudo apt-get install avrdude
You will need to create a .hex file that is compatible with AVRDUDE. In order to do this, use the Creator branch of our Contiki repository here:
$ git clone https://github.com/CreatorDev/contiki/ $ cd contiki $ git checkout creator $ git submodule init && git submodule sync && git submodule update
When you build your hex file, you need to build with:
$ make TARGET=mikro-e USE_AVRDUDE=1
When the build has finished you can run the following using your hex file name instead of hello-world to program the Clicker:
$ make hello-world.u
Pickle can only be used if you have the bit-bang-gpio kernel module installed on Ci40 - This is installed by default on Ci40 Creator Images (version numbers starting 'creatorci40...' but not on standard platform images.
See here for AVRDUDE bootloader that can be flashed with Pickle onto the Clicker board.
One way to program the clicker boards is by using Pickle. Pickle is a low-voltage programmer for PIC Microcontrollers, and in conjunction with the Ci40 it will be used to program the Clicker boards.
- Connect the 6LoWPAN Clicker board to Ci40, following this wire diagram:
3v3 -> 3v3
PGC -> MFIO_85
PGD -> MFIO_84
RST -> MFIO_82
GND -> GND
Connect the Ci40 to power and to the Internet (using Ethernet or WiFi)
Install pickle on Ci40. For that, type following command on terminal:
$ opkg install pickle
- Verify that Pickle is installed
$ pickle -h $ p32 info
- Finally flash the clicker board with the .hex file.
$ p32 program <-hex file->
The first step is to connect a Pickit3 - if you are using a different programmer, check the hardware documentation to identify differences in the pin mapping.
Make sure that RST on the 6LoWPAN Clicker is matched with the arrow on the Pickit3. Once this is done you need to run the MPLAB X IPE, available here, and choose PIC32MX470F512H as the target device.
The Tool field will populate when your Pickit3 has been detected.
Click on the Browse button next to the Source field and select the desired .hex file.
Click Connect next to the Tool field to connect your Pickit3 to your Clicker board. You Clicker board will need to be powered on for this to work. Use USB, Battery or the optional 'power by Pickit3' method described at the end of this section.
Once connected, you can click Program to flash the board. It should only take a few seconds to complete.
OPTIONAL: If you want to, you can use the Pickit3 to power your board while you program. To do this, you need to configure MPLAB X IPE to enable the feature. Click "Settings" > "Advanced Mode". Click on the "Power" category on the left and click the checkbox for "Power Target Circuit from Tool". You can then go back to the "Operate" section and proceed.