Skip to content

8051 Install and Use

vontio edited this page Jun 13, 2014 · 5 revisions

The official contiki git repository contains all the platform, cpu and example files needed by the 8051-based ports. Unfortunately, due to the issues described in the Understanding 8051 Memory Spaces guide, the vanilla contiki code will not work very well on devices. It will suffer by frequent stack overflow / reset cycles.

In order to get devices to behave, we need a set of patches to the contiki core. Those patches all aim at reducing stack depth during execution. Those changes are not major but they are not very suitable for other contiki platforms. Therefore, they are hosted externally.

Table of Contents

Contiki git Repositories

All the contiki core patching is maintained as a separate git branch. This branch is currently called cc-ports but in the future it may get renamed to cc243x-cc253x or something similar.

Thus, we have two branches:

  • master: Contains the contiki code, platform, cpu and example files
  • cc-ports: Contains core patches
Branch master is hosted on the official contiki repo. Its git URL is: git://github.com/contiki-os/contiki.git

Branch cc-ports is hosted externally, on a separate github repo (contiki-sensinode). Its URL is: git://github.com/g-oikonomou/contiki-sensinode.git. This repository also mirrors master but on occasion it may fall behind a bit. Changes in master get merged into cc-ports every few weeks.

Download

You have two options:

  • Get master from the official repo, add contiki-sensinode as a second remote and get cc-ports from there.
git clone git://github.com/contiki-os/contiki.git
cd contiki
git remote add contiki-sensinode git://github.com/g-oikonomou/contiki-sensinode.git
git fetch contiki-sensinode
git checkout cc-ports
  • Get everything from contiki-sensinode
git clone git://github.com/g-oikonomou/contiki-sensinode.git

This should put you directly on branch cc-ports but if it doesn't: git checkout cc-ports

Compile

That's it. If you have followed the instructions in the Prepare your System - Requirements guide, you may now cd into the examples directories and start using contiki.

cd examples/cc2530dk
make hello-world

cc2531 USB Sticks

To build for USB sticks, add this to your project's Makefile:

DEFINES+=MODEL_CC2531=1

You will need to make a full build (read as: you will have to make clean if you previously built for the cc2530).

Connect your Node to your PC

  • A word of warning for N740 NanoSensors.
 If you are going to program them with nano-usb-programmer,
 you will be trying to do this over the device's miniUSB port. 
 In order for this to work, you
 '''must short pins 3 & 5 on the device's 9-pin connector'''.
 The easiest way to do this is to get/make a 9-pin dongle which
 shorts those pins and stick it on the connector.
  • For N601 USB NanoRouters you don't have to do anything special.
  • For TI's SmartRF Eval. Boards, read the manual

Program the Node

Once the contiki build process finishes, you will find a bunch of files in your project's directory (say it's called proj)

  • For all devices:
    • If you are using Elprotronic Flash/GangPro-CC use the file called proj.hex. You may have to tick the 32KB Bank Placement Code checkbox.
  • For Sensinode devices:
    • If you are using Sensinode's nano-usb-programmer, use proj-<model>.ihx (e.g. proj-n601.ihx). You should only use NanoUSB on windows or Cygwin! On Linux, NanoUSB does not support fast mode and it will take ages to upload the image.
    • If you are using something else, make experiments and let me know about the outcome!
  • To program a cc2531 USB stick or a SmartRF Eval. Board with a cc2530 EM, use proj.hex with TI's flash programmer

Get Serial Output

Open a serial line terminal (PuTTY, CoolTerm etc) and get it to talk to the serial line where your device is connected. On Windows this will be COMx. On Linux it will be /dev/ttyUSBx and on OS X it will be /dev/tty.usbserial or /dev/tty.usbserial-XYZABCD.

Select the following serial line settings, for all devices except the cc2531 USB dongle:

  • Baud Rate: 115200
  • Data Bits: 8
  • Parity: none
  • Stop Bits: 1
  • Flow Control: None
For the cc2531 USB dongle, those settings are irrelevant. If you use cc2531 USB sticks on OS X, you may encounter a situation where opening the serial port succeeds but you're getting no communication with the dongle (e.g, with tunslip6 or with CoolTerm). Closing and re-opening the port a couple of times fixes this.

On PuTTY, you may also want to select the Implicit CR every LF option in the Terminal panel.

Clone this wiki locally