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:
- Download and install the latest release of LPCXpresso.
- Create an account / login at http://lpcware.com/
- 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.
- With the help of GIT GUI I replicated the source directory of SimpleMesh.
- In LPCXpresso, choose „Import project(s)“ and choose the root dir of the cloned GIT files.
- 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 (#).
- Click on „Clean“ and then on „Build“; the default will compile the „Debug“ version of the files.
- 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
- 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.
- Right-Click on the project, Properties -> C/C++ Build -> Settings -> ‚Tool Settings‘ Tab -> Optimization -> „Optimize for size (-Os)“
- 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 lpc111xisp.py-Script.
- Download and install Python 2.7 (I’m assuming an installation directory C:\Python27)
- Download and install pySerial
- Download the lpc111xisp.py-script and unzip into your Python installation directory.
- Connect the JTAG/ISP Interface Board, the RadioBlock and the USB2UART-Interface together as it is shown in the Bootloading Guide.
- NOW connect the USB2UART-Board to your computer
- Find out which COM-Port was created by your USB2UART-Device
- Open a command prompt (Start -> „cmd“) and change into your python installation directory (cd C:\Python27)
- Run the following command. Remember to change %USERNAME% and %VERSION% to your appropriate values.
python.exe lpc111xisp.py 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.