Showing posts with label Contiki. Show all posts
Showing posts with label Contiki. Show all posts

Tuesday, 2 December 2014

Disable 6lbr to be launched at boot


I luckily found out 6lbr some months ago (I have an unfinished post about it yet to finish, loving foren6 also), but I needed to stop the service to be launched from boot while I did some testing.  As I didn't found any configuration tweak to do so, I disabled the service at all /etc/rcX.d run levels using the well known update-rc.d script.

update-rc.d -f 6lbr remove

To enable back:

update-rc.d 6lbr defaults

And business as usual.

Saturday, 29 November 2014

Setting up CSS Uniflash to program the CC2538DK in Contiki

When I first started trying-out setting Uniflash to work with the CC2538DK and Contiki, I stumbled upon this warning:

I first tried Uniflash v3.1.0.00026 with no luck, so I downgraded to version v2.2.00016, you might want to skip the next section as it mostly describes the pain and futility of my first attempts with the latest Uniflash version, mostly kept as a warning of the severed-head-on-a-pike type for others encountering the same errors, and maybe lurking a kind soul who has fought this monster and prevailed, willing to share the solution.

At the end the solution was to find the right combinations of magic ingredients:

The right CCXML recipe:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
    <configuration XML_version="1.2" id="configuration_0">
        <instance XML_version="1.2" desc="Texas Instruments XDS100v3 USB Emulator" href="connections/TIXDS100v3_Dot7_Connection.xml" id="Texas Instruments XDS100v3 USB Emulator" xml="TIXDS100v3_Dot7_Connection.xml" xmlpath="connections"/>
        <connection XML_version="1.2" id="Texas Instruments XDS100v3 USB Emulator">
            <instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
            <instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
            <instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
            <property Type="choicelist" Value="4" id="The JTAG nTRST Boot-Mode"/>
            <property Type="choicelist" Value="4" id="The Power-On-Reset Boot-Mode"/>
            <property Type="choicelist" Value="2" id="The Converter Usage"/>
            <platform XML_version="1.2" id="platform_0">
                <instance XML_version="1.2" desc="CC2538SF53" href="devices/cc2538sf53.xml" id="CC2538SF53" xml="cc2538sf53.xml" xmlpath="devices"/>
            </platform>
        </connection>
    </configuration>
</configurations>

The right CSS Uniflash version (mine was 3.1.0.00026).

And finally the right flashing command:

contiki/examples/cc2538dk$ sudo /opt/ti/uniflash.sh -ccxml /opt/ti/CC2538SF53.ccxml -operation Erase -program cc2538-demo.elf

Then the magic starts:

***** Texas Instruments Universal Flash Programmer *****
<START: 19:19:29 GMT+0100 (CET)>
> Configuring the Flash Programmer with the given configuration ...
> Flash Manager is configured for the following part: CC2538SF53
> Connecting to the target for Flash operations ... 
> Connected.
> Performing operation: Erase
> Completed current operation.
> Loading Program: cc2538-demo.elf
> Finish Loading.
> Disconnecting from target. 
Cortex_M3_0: GEL Output: CPU Reset.
<END: 19:19:56 GMT+0100 (CET)>
<Operation Time: 19.341s>
<Total Time: 27.662s>

This is not my preferred way to flash the CC2538DK, as now with the bootloader backdoor unlocked it is possible to program the devices over UART using the built-in bootloader BSL script, but there may be cases in which you accidentaly flash an image with the backdoor unlocked, and need to enable this again.

Thursday, 1 May 2014

Unboxing and testing the Thingsquare IoT kit


Some months ago the Thingsquare folks hosted a contest to help spreading the world abouth Thingsquare and their wireless mesh networking and connectivity solution to the Internet of Things (see chached details about the contest here)... well, luckily I was one of the winners of the The Thingsquare IoT Kit (a limited edition unavailable now), featuring:
  • USB cables.
  • Ethernet cable.
  • SmartRF06 evaluation boards, featuring a LCD, buttons and plenty of test points, with on-board accelerometer, light sensor and UART back-channel over USB.
  • Radio System on a Chip (SoC) boards(TI CC2538-based), featuring an ARM Cortex M3-based MCU system with 32K RAM, 512 KB flash,  alongside a 2.4GHz radio transceiver, IEEE 802.15.4 compatible.
  • An Olimex MOD-ENC28J60-based Ethernet connectivity router.
  • Login credentials for the Thingsquare server.
  • Cool stickers!. 
Running on top of Contiki operative system of course.

Here it is after unboxing:

Thingsquare's IoT kit unboxed

The setup was quite straight-forward: 

Just assemble the Router-labeled node together, bundling the ethernet board onto the intermediate assembly board, on top of the SmartRF06 board (quite a sandwich there), and plug-in the CC2538EM with the router label.  Once the router was assembled I only had to connect it to one of my router's free LAN port through the provided ethernet cable, power the evaluation board through the uUSB port (be sure to enable powering via USB by moving the SOURCE switch to USB, and to place the jumper to connect VDD and EB power pins on the SoC board). 

After powering the board, a green LED next to the ethernet board should lit up and the yellow one will start blinking, another green LED on the board will start blinking until obtaining an IPv4 address from the router, the it will stop blinking... I did not catch this at first (an engineers motto taken from Tropic Thunder: we don't read manuals, manuals read us!), I was expecting "something" to show up on the LED display but no feedback there (I was tempted to replace the board's display to discard a broken unit), but as I was already on my routers box management utility, I found the assigned IP address given by the DHCP server, and test connectivity to the board with an extended ping.

To assemble the remaining nodes just plug in the SoC boards on top of the SmartRF06 boards, and power as above.  

A quick photo of both nodes back-to-back is show below:

Router and device back-to-back

The nodes will display the follow progress messages over the LCD display:
Waiting for wireless network
Waiting for Internet DNS
Waiting for server connection
Register PIN ##### at thingsquare.com
 If everything goes well then you should get a PIN number for each node (except the Router).

Registering the device is quite simple, at the Thingsquare's demo page just register the device and name it, the node's LED display will be updated quickly afterwards, in case you are wondering mine's Luffy (you can expect the rest of the tripulation to jump in anytime):

The node registered and ready

The demo has some cool stuff, what I liked the most was to actual develop code on the web browser and then remotely compile and flash the node, allowing to pause/continue the device after being programmed, and commanding the device to blink on request to assert it is running, simple but always useful, specially when introducing people to the IoT world and needing to show some real hardware doing wireless "stuff" (do not under appreciate the commercial power of a blinking LED!). 

Thingsquare browser-based IDE


The setup was simply enough to have it ready in 5 minutes, the demo page is very straight-forward to follow and the code examples and shown features briefly show the capabilities and possibilities of  the system, below are some cool examples of a sensor metering system and an intelligent street lighting deployment.



The development kit is quite complete and it was a great addition to my collection: TI evaluation boards are well suited for testing, prototyping and the TI CC2538 support on Contiki is coming along just great, and as Thingsquare actively contributes to Contiki (heck, the CEO is Adam Dunkels), one can expect nodes and products based on this SoC to be a popular choice amongst developers.

I will continue testing, I missed to take some wireshark pcap screenshots, so hopefully I will update this anytime soon.