Archiv für den Monat: Oktober 2013

Rebuild code for RadioBlocks

I aquired some RadioBlocks, which are little radio components which can be accessed via an arduino and build a Mesh-Network called „SimpleMesh“ on their own.

They can be customized quite a lot and even provide some security.

As I thought it would be overkill to use an arduino with one of these devices just to trigger a relais, I tried to understand the making of the (open source) firmware.

Here are the steps I did so far:

  1. Download and install the latest release of LPCXpresso.
  2. Create an account / login at
  3. In LPCXpresso, go to Help -> Activate LPCXpresso Free Edition -> „Create serial number and register“
    • Enter the serial number on the LPCXpresso Activation Page
    • Enter the resulting activation code in LPCXpresso and have a „FULL“ licensed LPCXpresso.
  4. With the help of GIT GUI I replicated the source directory of SimpleMesh.
  5. In LPCXpresso, choose „Import project(s)“ and choose the root dir of the cloned GIT files.
  6. As stated in the RadioBlocks Bootloading Guide, I right-clicked on the project „simplemesh_serial“, choose „Properties“ and under „C/C++ Build -> Settings -> Tab ‚Build Steps'“ removed the indicated hash (#).
  7. Click on „Clean“ and then on „Build“; the default will compile the „Debug“ version of the files.
  8. The resulting files (.axf and .bin, the latter is for uploading into the RadioBlock) can be found at your „workspace“-location of your LPCXpresso, e.g.:
    • C:\Users\%USERNAME%\Documents\LPCXpresso_%VERSION%\workspace\simplemesh_serial\Debug
  9. The .bin file is 19K in size, which is too big for the used LPC1114, at least in the current configuration. The image must be further optimized (~10K) to be uploaded into the RadioBlock.
  10. Right-Click on the project, Properties -> C/C++ Build -> Settings -> ‚Tool Settings‘ Tab -> Optimization -> „Optimize for size (-Os)“
  11. Click on „Clean“ and then on „Build“, the result is a ~10K size image.

Having now a size optimized image, we can flash this onto the RadioBlock. You need the JTAG/ISP Interface Board and the USB2UART-Adapter from Colorado Micro Devices. On the software side, you need Python 2.7 and the

  1. Download and install Python 2.7 (I’m assuming an installation directory C:\Python27)
  2. Download and install pySerial
  3. Download the and unzip into your Python installation directory.
  4. Connect the JTAG/ISP Interface Board, the RadioBlock and the USB2UART-Interface together as it is shown in the Bootloading Guide.
  5. NOW connect the USB2UART-Board to your computer
  6. Find out which COM-Port was created by your USB2UART-Device
  7. Open a command prompt (Start -> „cmd“) and change into your python installation directory (cd C:\Python27)
  8. Run the following command. Remember to change %USERNAME% and %VERSION% to your appropriate values.
python.exe C:\Users\%USERNAME%\Documents\LPCXpresso_%VERSION%\workspace\simplemesh_serial\Debug\simplemesh_serial.bin -p COM3 -b 115200 -e -d

That’s it. The new (so far unmodified) version of the firmware was uploaded. If you want to hard-program the information like PANID or Security Key, you can change the information in simplemesh_serial -> apps -> serial –> include -> config.h

Although I have a different chip, the AT86RF230-files seem to work nicely. With these modifications I could NOT make LPCXpresso use only the AT86RF231-files, so I just left it at AT86RF230. I’m leaving this information here in case I ever have to start over again…

  • On my RadioBlock boards, I can see that the AT86RF231 is placed there, but the project references the AT86RF230, we have to change this in a couple of locations:
    • The default Symbols in the simplemesh_serial point to AT86RF230. So I changed this in „C/C++ Build -> Settings -> Tab ‚Tool Settings‘ -> Symbols -> PHY=AT86RF231
    • In the Symbols, also changed the PHY_AT86RF230 to PHY_AT86RF231 (it has no other value).
    • Change the at86rf230 to at86rf231 in „C/C++ Build -> Settings -> Tab ‚Tool Settings‘ -> Includes“ as well.