Tuesday 5 May 2015

RPi and CC2520 with 6LoWPAN on Linux

It's been a long time.

Last year I have very little time for my 6Lowpan project but last week finally I managed to run CC2520 transceiver on Raspberry Pi.

First of all i decided to use official CC2520 Linux driver developed by Varka Bhadram. This component handle all basic ruins required by upper layers of IPv6 stack. Yes - I'm going to use IPv6 with 6LowPAN adaptation sublayer. And my device will be IPv6 enable node.

6LowPAN and IoT is a popular topic - more about that you can find in IETF pages ( 6LowPan and 6Lo WG ). There is also very interesting blog by Walter Colitti: www.waltercolitti.consulting.

The base for my experiment with RPi and 6LowPan was openlabs.co page where configuration of a system is described.

Configuration of my solution i very similar. The main difference is obviously that I use CC2520 whereas openlabs solution use at86rf233 transceiver.

Kernel cross-compilation and U-Boot preparation are taken from openlabs. What we have to do to deal with CC2520 is change device tree file to adopt it to Rpi platform.

Below I present how it is done for RPi platform ( in this location: arch/arm/boot/dts/bcm2835-rpi-b.dts )
...
&gpio {
...
cc2520_cape_pins: cc2520_cape_pins {
brcm,pins = <17 22 23 24 25>;
brcm,function = <1 0 0 0 0>;
};
};
&spi {
status = "okay";
cc2520@0 {
compatible = "ti,cc2520";
reg = <0>;
spi-max-frequency = <6000000>;
pinctrl-names = "default";
pinctrl-0 = <&cc2520_cape_pins>;
fifo-gpio = <&gpio 25 0>;
fifop-gpio = <&gpio 24 0>;
sfd-gpio = <&gpio 23 0>;
cca-gpio = <&gpio 22 0>;
reset-gpio = <&gpio 17 0>;
};
};

Also CC2520.c file was slightly changed due to the different pin configuration in my board.
I didn’t use VREG signal on my board and I just commented out the lines that handle it.

After this operation I was able to first radio transmission. I received this first wireless packets on my STM32W-RFCKIT that I bought some time ago to sniff things like this. This is very handy solution because in prepared environment received frames are piped to Wireshark.

Below a print screen from Wireshark is presented.


No comments:

Post a Comment