OpenWRT/LEDE WiFi Statup Process

This article will briefly introduse the WiFi startup process of OpenWRT/LEDE system.
The analysis will start from boot script which is located in /etc/initi.d/

openwrt_wifi_startup_process

Advertisements
Posted in 6lowpan for linux, 802.15.4, LEDE, Linux, OpenWRT | Leave a comment

iwpaninfo: Bring 802.15.4 into OpenWRT/LEDE

During last few days I have worked on a new project called iwpaninfo. It is a “clone” project from iwinfo and designed for 802.15.4 protocol. It is a wrap program like wpan-tools but it only read 802.15.4 device information via nl802154 interface. It also provides Lua bindings.

WIth the help of this project the intergration of 802.15.4 into OpenWRT/LEDE project will become easier.

Projects:
iwpaninfo
iwpaninfo-feed

Posted in 6lowpan for linux, 802.15.4, LEDE, OpenWRT | Leave a comment

[802.15.4 Linux] Add BEE click board support for Ci40

This post will briefly introduces how to add support of BEE click board for IMG ci40 board.

BEE Click is an accessory board in mikroBUS form factor. It features 2.4 GHz IEEE 802.15.4 radio transceiver module MRF24J40MA. This module includes an integrated PCB antenna and matching circuitry and is connected to the microcontroller via a SPI interface. As such, this module is an ideal solution for wireless networks, smart home automation, building automation and other electronic applications that need wireless communication. Board is designed to use 3.3V power supply only.

ci40 Linux kernel (4.4.14) has already driver support for MRF24J40. What we should do is adding device tree config for it, like

    mrf24j40ma@0 {
        compatible = "microchip,mrf24j40ma", "microchip,mrf24j40";
        spi-max-frequency = <4000000>;
        reg = <2>;
        interrupt-parent = <&gpio1>;
        interrupts = <5 GPIO_ACTIVE_HIGH>;
    };

Or you can find the patch here.

It is noted that current driver has no support for reset and wake pin. And a pending patch is not merged. Since ci40 board has already 802.15.4 support via ca8210. mrf24j40 driver will be not automatically activated but explicitly loaded mrf24j40 driver via modprobe or insmod.

References:
https://shop.mikroe.com/click/wireless-connectivity/bee

Posted in 6lowpan for linux, 802.15.4, Ci40 | Leave a comment

[802.15.4 Linux] MCR20A Driver is Comming

The MCR20A expands the NXP® portfolio of wireless connectivity products by delivering a new generation of 2.4 GHz transceiver for the IEEE® 802.15.4 standard. The MCR20A provides a world-class link budget of 110 dB that ensures the longest range of communication. At the same time, the MCR20A is able to receive and transmit at significantly lower peak currents than other competitive devices. This enables mesh networks to run on the same battery for a much longer period. The Dual PAN support allows the system to concurrently participate in two 802.15.4 networks, eliminating the need for multiple radios.

  • High-performance 2.4 GHz IEEE 802.15.4 RF transceiver
  • 802.15.4 PHY/MAC support
  • -102 dBm sensitivity +8 dBm maximum output power reducing the need for external power amplifiers
  • Low-power receive mode (LPPS)
  • TX 17 mA @ 0 dBm and RX 19 mA typical
  • TX 18 mA @ 0 dBm and RX 19.5 mA max
  • Dual PAN support
  • Supports single-ended and fast diversity antenna options: single 50 ohm antenna uses single balun to reduce component count and cost
  • Packet processor for hardware acceleration
  • 128-bit random number generator
  • 1.8-3.6 V operating range
  • Small footprint: 5×5 LGA 32 pin
  • –40 ˚C to +105 ˚C operational temperature range
  • Supports SMAC, Thread Networking Protocol and ZigBee stacks

The MCR20A Linux driver is coming soon. link

Update: 16.02.2017
* Support only one PAN network

Posted in 6lowpan for linux, 802.15.4, Linux | Leave a comment

[802.15.4 Linux] CC2420 driver

This is a deprecated cc2420 driver for Linux 802.15.4 and it is developed based on Imote2 platform.

Because I do not have any Imote2 or cc2420 boards. I can not continue maintain this driver.

Any Donation of cc2420 or Imote2 boards are welcome, thus I could try to push this driver to mainline.

repo

Posted in 6lowpan for linux, Linux | 5 Comments

[802.15.4 Linux] Receiving Path

802154_rx_path

Image | Posted on by | Leave a comment

ARMADA 388 ClearFog: Install LEDE into eMMC in an easy way

Last time I have talked about the install of system into eMMC flash. This process is rather complicated and time consuming. After that I have a further research of the current LEDE project, Solid-Run forum and Armbian forum. And I will try to figure out another easy way to prepare the LEDE system into the eMMC flash in this post.

Note: Following method is only tested in ClearFog Pro board.

1. Preparation

  1. ARMADA SoM with eMMC flash
  2. ARMADA carrier board. Here I have only ClearFog Pro;
  3. Ehternet cable;
  4. Plug in USB cable in Debug port and open your serial terminal;
  5. 12V power adapter;
  6. Ready-to-use images or compile your own from scratch U-Boot, LEDE;

2. U-Boot: Compile

As this wiki said, following the instructions below to build U-Boot for ClearFog board

git clone https://github.com/SolidRun/u-boot-armada38x.git
cd u-boot-armada38x
export CROSS_COMPILE=<Set toolchain prefix to your toolchain>
make armada_38x_clearfog_config
make u-boot.mmc

You will get u-boot.mmc and u-boot-uart.mmc. The first one is for SD/eMMC boot mode and the second one is for UART boot mode.

2. U-Boot: Download UART Bootloader

When the board is not power on, changing SW1 to UART boot mode. The u-boot-mmc.mmc version that is build in the last step is ready to use. At first we need a program to transfer this image to ClearFog board. Here we have two choice, the first one is download-serial.sh which you can find in the u-boot source tree. The other one is kwboot which you can compile from uboot-kirkwood package in both OpenWRT and LEDE system. Here is a instruction of this program:

Usage: kwboot [-d | -a | -q <req-delay> | -s <resp-timeo> | -b <image> | -D <image> ] [ -t ] [-B <baud> ] <TTY>

  -b <image>: boot <image> with preamble (Kirkwood, Armada 370/XP)
  -p: patch <image> to type 0x69 (uart boot)
  -D <image>: boot <image> without preamble (Dove)
  -d: enter debug mode
  -a: use timings for Armada XP
  -q <req-delay>:  use specific request-delay
  -s <resp-timeo>: use specific response-timeout

  -t: mini terminal

  -B <baud>: set baud rate

Following instruction is used to prepare the transfer of u-boot-uart.mmc into RAM of ARMADA388 chip from PC side.

kwboot -b u-boot-uart.mmc -t /dev/ttyUSB0 -B 115200n8

Then power on your board and you will have following output:

Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [......................................................................]
  0 % [......................................................................]
  1 % [......................................................................]
............
 96 % [......................................................................]
 97 % [......................................................................
 98 % [......................................................................]
 99 % [............................................................]

kwboot will start a terminal after the transfer is finished. You will see U-Boot information and should press Enter to stop the automatic boot progress and come to the next step.

3. U-Boot: Flash eMMC Bootloader

Now the U-Boot is running and the hardwares such as Ethernet are initialised. Plugin the Ethernet cable and setup the IP addresses:

Marvell>> setenv serverip <server ip>
Marvell>> setenv ipaddr <board ip>
Marvell>> saveenv
Saving Environment to MMC...
Writing to MMC(0)... done
Marvell>> 

You could use ping command to check the connection

Marvell>> ping $serverip
host 192.168.112.17 is alive

Now you could download another bootloader:

Marvell>> tftp u-boot.mmc
Using egiga0 device
TFTP from server 192.168.112.17; our IP address is 192.168.112.18
Filename 'u-boot.mmc'.
Load address: 0x1000000
Loading: #################################################################
     6 MiB/s
done
Bytes transferred = 952620 (e892c hex)
Marvell>>

There are two import information which should be noted: Load address: 0x1000000 and Bytes transferred = 952620 (e892c hex). The first one is the start address of image in RAM from where we should copy into the eMMC flash. The second one indicates 952620 / 512 ~ 1861 (0x745) ~ 0x800 blocks we should copy.

As this wiki said:

The main different between booting u-boot on eMMC and MicroSD is that in MicroSD u-boot resides in second sector of the SD card, where in eMMC it must reside in first block in either the main eMMC storage or it’s first or second boot partitions.

So if the main physical partition of eMMC is used then it will override the partition table. So it’s recommended to use the boot partitions for that purpose.

Therefore:

Marvell>> mmc dev 0 1
switch to partions #1, OK
mmc0(part 1) is current device
Marvell>> mmc write 0x1000000 0 0x800

MMC write: dev # 0, block # 0, count 2048 ... 2048 blocks write: OK

Now the normal eMMC bootloader is ready. It’s time to download the filesystem.

4. LEDE: Download

Recently LEDE system has rather good support for ClearFog Pro board. It has a special SD card image generation script to make a All-in-One image for SD card. After some tests I made, I found this image is also working in eMMC flash.

Note: The size of the SD image mainly depends on CONFIG_TARGET_ROOTFS_PARTSIZE which you can find in Target Images –> Root filesystem partition size (in MB).

You can find lede-mvebu-armada-388-clearfog-sdcard.img.gz in /bin/targets/mvebu/generic. Unzip with

gunzip lede-mvebu-armada-388-clearfog-sdcard.img.gz

On your U-Boot side, type

Marvell>> tftp lede-mvebu-armada-388-clearfog-sdcard.img
TFTP from server 192.168.112.17; our IP address is 192.168.112.65
Filename 'lede-mvebu-armada-388-clearfog-sdcard.img'.
Load address: 0x1000000
Loading: #################################################################

....

     #################################################################
     ######
     8.3 MiB/s
done
Bytes transferred = 52559872 (3220000 hex)

Note the two import numbers: Load address: 0x1000000 and Bytes transferred = 52559872. The second one indicates 52559872 / 512 = 102656 (0x19100) blocks we should copy.

5. LEDE: Flash

Type mmcinfo to get info about eMMC flash:

Marvell>> mmcinfo
Device: mv_sdh
Manufacturer ID: 15
OEM: 100
Name: 8GND3 
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.0
High Capacity: Yes
Capacity: 7.3 GiB
Bus Width: 4-bit

Switch back to the main physical partition and start flash:

Marvell>> mmc dev 0 0
Marvell>> mmc write 0x01000000 0 0x19100

This process is very fast.You can use mmc command to list all the partitions found in main physical partition of eMMC:

Marvell>> mmc part

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors UUID        Type
  1 4096        33280       00000083-01 83 Boot
  2 40960       131584      00000083-02 83
Marvell>> 

Finally power off your board and switch back to SD/eMMC boot mode.

Enjoy 🙂

Posted in armada-38x, ClearFog Pro, LEDE, OpenWRT | Leave a comment