-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
The Meshbee is available from Amazon for instant 2-day gratification. The modules are 2mm pitch, but are physically compatible with Xbee sockets. Seeed Studio also makes a programmer board, which is also available on Amazon
Links to the individual documents and installers are included throughout this page, but for a single clearing house of all collateral, visit the NXP product page. Download installers from the NXP site, NOT the Jennic site, as some of the Jennic files are outdated and will cause you grief.
Bootloader operation is specified in JN-AN-1003.
To enter JN5168 programming mode, pull down SPIMISO with a resistor and pulse reset low (or simply power on with SPI MISO pulled down). You will need to use the Windows programming software, as the linux one can't set the FTDI chip to 100000 baud correctly. The programming software is JN-SW-4007.
- Seeed Studio UartSBee v5 includes IO pins to assert the SPIMISO and reset lines. The meshbee wiki describes how to use one of their programmers as well as how to use the flash tool from NXP.
- Other generic Xbee<->USB adapters can be used to program the Meshbees. Some may not include the right IO lines for SPIMISO and reset, and may require you to do this yourself.
- Basic FTDI breakout boards and cables can also flash the Meshbees, but again you'll have to hold SPIMISO yourself.
- The IoH board issued at BSidesPDX includes an FTDI cable pin header. This header comes with a few gotchas:
- JP4 (or on some boards, JP8) must be set to 2-3 (away from the blue button) to enable programming with the FTDI cable.
- The FTDI cable must supply 3.3v, NOT 5v Vcc. 5v on Vcc is a great way to release the magic smoke from your board.
- Likewise, the TX/RX pins must run at 3.3v IO logic.
- Errata: the TX/RX pins on the IoH header are backwards from standard FTDI pinout.
- Also possibly errata: The FTDI CTS line (which goes to the SPIMISO line to enter the bootloader) doesn't seem to work properly. We've had best results entering the bootloader by directly tying the CTS/SPIMISO line to ground while powering on the board to enter bootloader mode.
Note that the Meshbee has two UARTs, and UART1 is mapped onto the Xbee UART pins. Unfortunately, the Meshbee is programmed via UART0. If you use an Xbee adaptor for programming, just connect RX1 to RX0 and TX1 to TX0 as a workaround.
NXP also provides border-router code (JN-AN-1110) that is an openwrt based stack. The border router has two parts: the host and the node. The host runs openwrt and communicates with the node (a JN5168 radio) that does coordination. The idea is explained, along with some 6lowpan concepts well in JN-AN-1162.
The node for the border router needs to be programmed before use. There are several firmwares available in JN-AN-1110_JenNet-IP-Border-Router-BR_1v8v2/Node/Build. Only two of them are for the JN5168, the meshbee chip. There is one that is set up to talk over UART0 at 1000000 baud and one that uses 115200 baud. I chose the 115200 baud one, as I didn't think the rpi could probably get the serial port going at that speed properly. To flash it, use the above procedure. The node FW uses UART0 to talk to the host. So, if you're using an Xbee style adapter, short UART1 and UART0 together as before.
The border router package has binaries for a number of platforms including a raspberry pi (see JN-AN-1110_JenNet-IP-Border-Router-BR_1v8v2/Host/Binaries). To get the host part up and running, simply flash an SD card with the raspberry pi image. Unlike some of the other routers, the rpi has only one Ethernet interface. Openwrt assumes this to be the wan interface. Once openwrt is booted, it serves up an http page as well as having ssh open. The root password is "snap" To get the node up and going with the border router, connect your adapter to the pi and navigate to the web interface. After you log in, go to Jennet-IP->6LoWPANd and edit /dev/ttyUSB0. Edit the baud to be 115200 and hit save and apply. Back at the home page, you should see three links. One of them, JIP Browser, will take you to a ajaxy JIP (like snmp) browser.
-
Download the IP application template JN-AN-1190.
-
Inside you will find binaries in JN-AN-1190-JenNet-IP-Application-Template/Binary. Flash the end-device (0x11111111s_DeviceDio_DR1199_EndDevice_JN5168_v1059.bin) to a module.
-
Power the module on, and visit the border router configuration page. Go to JenNet-IP->Whitelist. You should see a node there. Check the box and apply and save the settings.
-
Your node should now be provisioned on the network. You can use the JIP browser to find the node and manipulate the IO pins via MIB. It's a hop, skip, and a jump from there to set/get GPIO via curl.
-
Download and install the SDK from NXP (eclipse/cygwin/etc for Windows only). You do not need to install the Eclipse portion if you don't plan to use it, since the installer also provides 'make', sufficient for building a project. (SDK: JN-SW-4041
-
Download and install the Jennet IP stack (JN-SW-4065).
-
Clone the ioh-node github project into c:\jennic\Application. The project is based on Jennic application note 1190 mentioned in the Blinking Lights Test.
-
Start the Jennic bash shell (Start->Jennic->AN4041->Shell), export the board setting, and build the project.
$ cd /cygdrive/c/Jennic/Application/ioh-node/DeviceDio/Build
$ export NODE_TYPE=EndDevice
$ make
Assuming no errors, the output binaries are in c:\Jennic\Application\ioh-node\Binary. Use the Flash Programmer tool to flash your node with the .bin file.
Now that you have some software compiled and able to flash it, it's time to start getting code you wrote to run. If you're just trying to get something to run (such as a peripheral bringup), you'll likely end up with a snippet of code you just want to run. I suggest stuffing your code into Device_vMain in DeviceDio.c. Note that the watchdog is running. You'll need to tickle it if you while(1) inside there. When doing this way, you get a workflow of hack->flash->run. You don't need the border router up and going.
You'll see code that has DBG_vPrintf() sprinkled throughout. This function prints to the debug UART (UART0 @ 115200).
To enable debug messages in the build:
- Rebuild the MibCommon objects with debug enabled. Make sure to export NODE_TYPE=EndDevice if you restart the shell.
cd /cygdrive/c/Jennic/Application/ioh-node/MibCommon/Build
make clean
TRACE=1 make
cd ../../DeviceDio
make clean
TRACE=1 make
At the end of the build you should see a file with EndDevice and DEBUG in the filename in c:\Jennic\Application\ioh-node\Binary. Flash to your node with the flash utility. You can connect your node UART0 to an FTDI chip/cable at 115200 (PuTTY can talk to serial ports; in Linux use "screen /dev/ttyUSB0 115200"), and you should see debug output.