Microchip ATWILC1000 User Manual

ATWILC1000/ATWILC3000
Wi-Fi® Link Controller Linux® User Guide

Introduction

This user guide describes how to run Wi-Fi on the ATWILC1000 SD card or the ATWILC3000 Shield board on the SAMA5D4 Xplained Ultra running with the Linux® kernel 4.9. Note:  All references to the ATWILC module includes all the devices listed below unless otherwise noted:
The source codes are maintained on GitHub. For latest source codes, see GitHub Linux for ATWILC at
https://github.com/linux4wilc.
Figure 1. ATWILC1000 SD Card and ATWILC3000 Shield Board
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 1
ATWILC1000/ATWILC3000

Table of Contents

Introduction......................................................................................................................1
1. Prerequisites..............................................................................................................4
2. Building Linux for SAMA5D4 Xplained Ultra Board...................................................5
2.1. Cloning a Kernel Source and Root File System........................................................................... 5
2.2. Loading SAMA5D4 Configuration File..........................................................................................5
2.3. Buildroot File System and Linux Kernel....................................................................................... 5
2.4. Building Linux Kernel Individually.................................................................................................6
3. Building Linux for SAMA5D2 Xplained Ultra Board...................................................7
3.1. Cloning and Building Binaries...................................................................................................... 7
3.2. Creating an Image for SAMA5D2_Xplained to Boot using eMMC............................................... 9
3.3. Install the Demo Image on the SAMA5D2 Xplained eMMC....................................................... 11
4. Building and Flashing the System Image into the SAMA5D3 Xplained Board........13
5. Building and Flashing the System Image into the SAMA5D27-SOM1-EK1............ 15
5.1. Building the Components........................................................................................................... 15
5.2. Building Kernel........................................................................................................................... 16
6. Updating Binary and System Image into the Target Board......................................19
7. Updating ATWILC Firmware.................................................................................... 21
7.1. ATWILC1000 and ATWILC3000 Driver Modules........................................................................21
7.2. ATWILC1000 and ATWILC3000 Firmware Binaries...................................................................21
8. Running ATWILC..................................................................................................... 22
8.1. Accessing the Console...............................................................................................................22
8.2. Recognizing ATWILC1000......................................................................................................... 23
8.3. Recognizing ATWILC3000......................................................................................................... 24
8.4. Modifying Configuration Files..................................................................................................... 27
8.5. Running in the ATWILC Station Mode........................................................................................29
8.6. Running in the ATWILC AP Mode..............................................................................................31
8.7. Running in the ATWILC P2P Mode............................................................................................32
8.8. Supported Modes with Concurrency.......................................................................................... 34
8.9. Powersave .................................................................................................................................35
8.10. Antenna Switching......................................................................................................................37
8.11. Debug Logs ...............................................................................................................................38
8.12. Monitor Mode............................................................................................................................. 39
8.13. Miscellaneous Linux Topics........................................................................................................39
8.14. Running ATWILC3000 in Bluetooth Mode..................................................................................43
9. Document Revision History..................................................................................... 49
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 2
ATWILC1000/ATWILC3000
The Microchip Web Site................................................................................................ 50
Customer Change Notification Service..........................................................................50
Customer Support......................................................................................................... 50
Microchip Devices Code Protection Feature................................................................. 50
Legal Notice...................................................................................................................51
Trademarks................................................................................................................... 51
Quality Management System Certified by DNV.............................................................52
Worldwide Sales and Service........................................................................................53
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 3

1. Prerequisites

The build prerequisite for Linux is a host PC with Linux operating system. The hardware prerequisites are the following:
• Linux
– SAMA5D4 Xplained Ultra
– ATWILC1000 SD Pro card
– ATWILC3000 Shield board
– USB to Serial adapter (for DEBUG port)
• Common
– Micro-USB cable (Micro-A/Micro-B)
To avoid modifying kernel code, mount the resistor R312 with an approximate value of 120k Ohm in the location shown below on the ATWILC3000 Shield board.
ATWILC1000/ATWILC3000
Prerequisites
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 4
ATWILC1000/ATWILC3000
Building Linux for SAMA5D4 Xplained Ultra ...

2. Building Linux for SAMA5D4 Xplained Ultra Board

This section describes how to build the root file system and kernel image to use for ATWILC devices demo.
This user guide describes general information on the AT91Bootstrap and U-Boot information. For more details on the AT91Bootstrap and U-Boot, see U-Boot of Linux & Open Source related information for AT91 Smart ARM Microcontrollers.

2.1 Cloning a Kernel Source and Root File System

The demo uses buildroot to get the suitable toolchain, root file system, and Linux kernel.
The buildroot is cloned from linux4wilc github at the following address:
$ git clone https://github.com/linux4wilc/buildroot4wilc.git
The buildroot is cloned at the following path in the current directory:
\buildroot4wilc
The current buildroot4wilc is copied from buildroot's repository at git://git.buildroot.net/ buildroot, branch 2017_08, modified with WILC config files (configs/sama5_wilc_defconfig),
and other config files that help run WILC examples.

2.2 Loading SAMA5D4 Configuration File

Use the predefined defconfig file to create the required .config configuration file. This defconfig file is available in configs folder of the buildroot folder buildroot4wilc.
For SAMA5D4, the sama5_wilc_defconfig defconfig file is used.
To build the root file system for SAMA5D4 with Linux kernel 4.9 for the ATWILC board, browse to the directory where the files are extracted and create the .config file, using the following commands:
$ cd buildroot4wilc $ make sama5_wilc_defconfig

2.3 Buildroot File System and Linux Kernel

Start the build operation using $ make command from the buildroot directory.
This $ make command displays the build status on the terminal. Note:  Ensure that the host PC is connected to the internet before starting the build operation and do not use any build options.
The rootfs.ubi file is generated in the buildroot/output/images directory when the build operation is complete. The default build will include the WILC modules in the rootfs.ubi.
The driver source files are located at: https://github.com/linux4wilc/linux-at91/tree/ master/drivers/staging/wilc1000 in the linux-at91 kernel. Note:  The driver directory name is wilc1000 for legacy reasons only. The driver supports both ATWILC1000 and ATWILC3000.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 5

2.4 Building Linux Kernel Individually

Buildroot downloads the Linux kernel as per the buildroot configuration file from GitHub. The downloaded kernel must be available in the buildroot4wilc/output/build/linux-xxxx path, and is built automatically during the buildroot build operation.
However, if the kernel is modified after building the buildroot, the user must rebuild the kernel. The following is the procedure to build the Linux kernel against the toolchain and ARM architecture:
1. Change the directory to the Linux kernel source folder, using the following command:
$ cd output/build/linux-xx
2. Create the kernel with the help of sama5_defconfig defconfig file, using the following command:
$ make ARCH=arm sama5_defconfig
3. Perform the required changes using the menuconfig tool, using the following command:
$ make ARCH=arm menuconfig
4. Build the Linux kernel against the toolchain and ARM architecture, using the following commands:
$ make ARCH=arm CROSS_COMPILE=../../../output/host/opt/ext-toolchain/bin/arm-linux­gnueabihf­$ make ARCH=arm CROSS_COMPILE=../../../output/host/opt/ext-toolchain/bin/arm-linux­gnueabihf- zImage $ make ARCH=arm CROSS_COMPILE=../../../output/host/opt/ext-toolchain/bin/arm-linux­gnueabihf- dtbs
ATWILC1000/ATWILC3000
Building Linux for SAMA5D4 Xplained Ultra ...
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 6
ATWILC1000/ATWILC3000
Building Linux for SAMA5D2 Xplained Ultra ...

3. Building Linux for SAMA5D2 Xplained Ultra Board

This section describes how to build the bootstrap, U-Boot, Root File System (RFS), and Kernel image to use for the ATWILC devices demo.

3.1 Cloning and Building Binaries

This section details how to clone and build the AT91Bootstrap, U-Boot, Kernel, and RFS.

3.1.1 AT91Bootstrap

Perform the following steps to build the AT91Bootstrap.
1. Clone the AT91Bootstrap from github at the following address:
$ git clone git://github.com/linux4sam/at91bootstrap.git
2. After the AT91Bootstrap download, enter in to the cloned directory using the following command:
$ cd at91bootstrap/
3. Build the bootstrap using the following commands: Assuming that the user is at the AT91Bootstrap root directory, a board/sama5d2_xplained folder is available which contains several default configuration files. The AT91Bootstrap is configured and U-Boot binary is loaded from the embedded Multi-Media Controller (eMMC).
4. For the boot ROM code to recognize the valid boot code in the SD card or embedded Multi-Media

3.1.2 U-Boot

Perform the following steps to build the u-boot.
Note:  Make sure to install the mkenvimage tool on the Linux machine.
1. Clone the u-boot from github at the following address:
2. After the AT91Bootstrap download, enter in to the cloned directory using the following command:
3. Switch to a new branch u-boot-2018.07-at91, using the following commands:
$make mrproper make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sama5d2_xplainedemmc_uboot_defconfig
Note:  Make sure that the path of the toolchain is exported to PATH environment variable.
This generates the sama5d2_xplained-sdcardboot-uboot-3.8.12.bin binary which is located in the binary folder.
Controller (eMMC) , rename the sama5d2_xplained-sdcardboot-uboot-3.8.12.bin AT91bootstrap file to BOOT.bin.
$ git clone git://github.com/linux4sam/u-boot-at91.git
$ cd u-boot-at91
$git branch -r $ git checkout origin/u-boot-2018.07-at91 -b u-boot-2018.07-at91
4. Apply the configuration file (sama5d2_xplained_mmc_defconfig) to u-boot, using the following command:
$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sama5d2_xplained_mmc_defconfig
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 7
ATWILC1000/ATWILC3000
Building Linux for SAMA5D2 Xplained Ultra ...
5. Open the u-boot-at91/include/configs/sama5d2_xplained.h file and modify the definitions for FAT_ENV_DEVICE_AND_PART and CONFIG_BOOTCOMMAND, using the following commands:
/*bootstrap + u-boot + env in sd card */ #undef FAT_ENV_DEVICE_AND_PART #undef CONFIG_BOOTCOMMAND #define FAT_ENV_DEVICE_AND_PART "0" #define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 at91-sama5d2_xplained.dtb; " \ "fatload mmc 0:1 0x22000000 zImage; " \ "bootz 0x22000000 - 0x21000000" #undef CONFIG_BOOTARGS #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait"
6. Build the u-boot binary, using the following command:
$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
The u-boot.bin output is built in the root folder (u-boot-at91 folder).
Note:  Make sure that the cross compiler toolchain is available in the same path.
7. Create a text file u-boot-env.txt in a directory, such as home folder with the u-boot environment variables and copy the following to the file:
bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait bootcmd=fatload mmc 0:1 0x21000000 at91-sama5d2_xplained.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000 bootdelay=1 ethact=gmac0 stderr=serial stdin=serial stdout=serial
8. Move to the main folder and enter the following command to generate uboot.env file.

3.1.3 Kernel

Perform the following steps to build the kernel.
1. Clone the repository to get the source code, using the following command:
2. To use another branch, list the branches and use one of them by using the following commands:
3. Replace the ATWILC1000 driver in drivers/staging/wilc with the content for the driver/
4. Modify the following line in linux-at91/drivers/staging/Makefile so that the build finds
$ mkenvimage -s 0x2000 -o uboot.env u-boot-env.txt
git clone git://github.com/linux4sam/linux-at91.git
git branch -r git checkout origin/linux-4.14-at91 -b linux-4.14-at91
wilc directory on the ATWILC driver repository. The repository is available at: https://github.com/
linux4wilc.
Enter the following command to get the files from linux4wilc:
git clone git://github.com/linux4wilc/driver
the correct directory:
FROM: obj-$(CONFIG_WILC1000) += wilc1000/ TO: obj-$(CONFIG_WILC) += wilc1000/
5. Configure the kernel using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sama5_defconfig
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 8
ATWILC1000/ATWILC3000
Building Linux for SAMA5D2 Xplained Ultra ...
6. Modify the default configuration using the menuconfig. Perform the following to open the menuconfig:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
– Select the ATWILC driver module, using the following steps:
1. Go to menuconfig.
2. Navigate to Device Drivers>Staging driver.
3. Press 'y' to include Staging Drivers.
4. Select either Atmel WILC SDIO or Atmel WILC SPI based on the requirement.
5. Press 'M' to select the WILC SDIO or WILC SPI.
6. Save the configuration.
Make sure the mmc1 node of arch/arm/boot/dts/at91-sama5d2_xplained.dts file is similar to the following node.
mmc1: mmc@fc000000 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>; vmmc-supply = <&vcc_mmc1_reg>; vqmmc-supply = <&vcc_3v3_reg>; non-removable; status = "okay"; slot@0 { reg = <0>; bus-width = <4>; }; };
7. Build the kernel, using the following command:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage
8. Build the .dtb file, using the following command:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- at91-sama5d2_xplained.dtb
9. Build the modules, using the following command:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
When the building process is successful, the final kernel image is available in arch/arm/boot/ directory and the at91-sama5d2_xplained.dtb file is available in arch/arm/boot/dts folder.

3.1.4 Root File System

Use the build root to build the rootfs. For more information, see Building rootfs for SAMA5D2 Xplained
Pro Board.

3.2 Creating an Image for SAMA5D2_Xplained to Boot using eMMC

A single bootable image is required to write on eMMC of the SAMA5D2 Xplained target. This image must contain all the images (AT91bootstrap, u-boot, kernel and rootfs) built (Cloning and Building Binaries). To create the image, perform the following steps.
1. Create a directory called junk under home directory. Create a dummy image file sdcard.img, using the following command:
$sudo dd if=/dev/zero of=~/junk/sdcard.img bs=2G count=1 $ls -al
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 9
ATWILC1000/ATWILC3000
Building Linux for SAMA5D2 Xplained Ultra ...
2. >Move to the junk directory and partition the image file with two partitions, using the following commands:
$sudo fdisk sdcard.img
Welcome to fdisk(util-linux 2.27.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x24d68b30.
Command (m for help): n Partion type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partions) Select (default p): p Partition number (1-4, default 1): First sector (2048-4194295, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-4194295, default 4194295):+64M
Created a new partition 1 of type 'Linux' and of size 64 MiB.
Command (m for help): t Selected partion 1 Partition type (type L to list all types): b Changed type of partition 'Linux' to 'W95 FAT32'.
Command (m for help): n Partion type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p):
Using default response p. Partition number (2-4, default 2): First sector (133120-4194295, default 133120): Last sector, +sectors or +size{K,M,G,T,P} (133120-4194295, default4194295):
Created a new partition 2 of type 'Linux' and of size 2 GiB. Command (m for help): w The partition table has been altered. Syncing disks.
Two partitions in sdcard.img file are created successfully.
3. Mount the two partitions on two loop devices, using the following commands:
$sudo losetup /dev/loop0 sdcard.img -o 1048576 $sudo losetup /dev/loop1 sdcard.img -o 68157440
Note:  The numbers 1048576 and 68157440 are the offsets of the partitions.
This partition can be verified using the following command:
fdisk -l sdcard.img
Disk linux4sam-yocto-sama5d2_xplained.img: 2 GiB, 2147479552 bytes, 4194296sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x24d68b30
Device Boot Start End Sectors Size Id Type linux4sam-yocto-sama5d2_xplained.img1 2048 133119 131072 64M b W95 FAT linux4sam-yocto-sama5d2_xplained.img2 133120 4194295 4061176 2G 83 Linux
Here, the first partition starts at “2048” location and its physical location is (512 bytes * 2048)
1048576.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 10
ATWILC1000/ATWILC3000
Building Linux for SAMA5D2 Xplained Ultra ...
Similarly, the second partition starts at “133120” location and its physical location is (512 bytes *
133120) 68157440.
4. Format the partitions that are mounted on the loop devices, using the following commands:
$sudo mkfs.vfat /dev/loop0 $sudo mkfs.ext4 /dev/loop1
5. Create two temporary folders and mount each partition (FAT32 and EXT4) on the folders, using the following commands:
$ mkdir emmcmntp1 $ mkdir emmcmntp2 $ sudo mount -o loop,offset=1048576 sdcard.img emmcmntp1 $ sudo mount -o loop,offset=68157440 sdcard.img emmcmntp2
6. In the first partition (FAT32), copy the AT91bootstrap, u-boot, uboot.env, kernel and dtb files, using the following commands:
$ cd emmcmntp1 $ sudo cp <path>at91bootstrap/binaries/BOOT.bin . $ sudo cp <path>u-boot-at91/u-boot.bin . $ sudo cp <path>uboot.env . $ sudo cp <path>linux-at91/arch/arm/boot/zImage . $ sudo cp <path>linux-at91/arch/arm/boot/dts/at91-sama5d2_xplained.dtb .
7. In the second partition (EXT4), copy the rootfs , using the following commands:
$ cd ../emmcmntp2 $ sudo tar -zxvf <path> <path to the newly build rootfs tar file> eg: core-image-minimal-sama5d2-xplained-20181114120437.rootfs.tar.gz
8. Unmount the temporary mount points emmcmntp1, emmcmntp2, and loop device using the following commands:
$ cd .. $ sudo umount emmcmntp1 emmcmntp2 $ sudo losetup -d/dev/loop0 $ sudo losetup -d/dev/loop1

3.3 Install the Demo Image on the SAMA5D2 Xplained eMMC

Prerequisite:
• Connect the FTDI cable to the Debug connector (J1).
Note:  Do not use J14 connector to receive debug messages.
• Download the SAM-BA
1. Add the path to SAM-BA in your ~.bashrc file.
2. Connect a USB cable to J23 port to flash the image.
3. Close the jumper JP9, press the reset button and open the jumper.
4. Create a qml file emmc-usb.qml and add the following:
import SAMBA 3.2 import SAMBA.Connection.Serial 3.2 import SAMBA.Device.SAMA5D2 3.2
SerialConnection { //port: "ttyACM0" //port: "COM85" //baudRate: 57600
device: SAMA5D2Xplained { }
onConnectionOpened: { // initialize SD/MMC applet
®
3.2.1 for Linux software from the SAM-BA In-system Programmer.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 11
ATWILC1000/ATWILC3000
Building Linux for SAMA5D2 Xplained Ultra ...
initializeApplet("sdmmc")
// write file applet.write(0, "sdcard.img", false)
// initialize boot config applet initializeApplet("bootconfig")
// Use BUREG0 as boot configuration word applet.writeBootCfg(BootCfg.BSCR, BSCR.fromText("VALID,BUREG0"))
// Enable external boot only on SDMMC0 applet.writeBootCfg(BootCfg.BUREG0, BCW.fromText("EXT_MEM_BOOT,UART1_IOSET1,JTAG_IOSET1," + "SDMMC0,SDMMC1_DISABLED,NFC_DISABLED," + "SPI1_DISABLED,SPI0_DISABLED," + "QSPI1_DISABLED,QSPI0_DISABLED")) } }
5. Run the .qml script, using the following command:
$sudo su $ <path>sam-ba -x emmc-usb.qml
Note:  This process takes several minutes to complete.
The sdcard.img is installed on the SAMA5D2 Xplained eMMC.
When the flashing is complete, debug messages are sent via J1 port.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 12
ATWILC1000/ATWILC3000
Building and Flashing the System Image into ...

4. Building and Flashing the System Image into the SAMA5D3 Xplained Board

Perform the following steps to build and Flash the system image in to the SAMA5D3 Xplained board.
1. Download the default demo package linux4sam-poky-sama5d3_xplained-6.0.zip from
https://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage.
2. Download the Linux kernel 4.4.87 from https://www.kernel.org/.
3. Replace the existing WILC1000 driver directory from drivers/staging/wilc1000 directory with the ATWILC driver available in www.github.com/linux4wilc/.
4. Modify the CONFIG_WILC1000 macro to CONFIG_WILC in the Makfile. This file is available in drivers/staging/Makfile location.
5. Download the firmware binaries from https://github.com/linux4wilc/firmware and update the existing firmware files in /firmware/mchp/ of the kernel directory.
6. Configure the kernel using the command make ARCH=arm sama5_defconfig.
7. Open the menuconfig using the command make ARCH=arm menucofig.
8. Select the ATWILC driver module, using the following steps:
8.1. Go to menuconfig.
8.2. Navigate to Device Drivers > Staging driver.
8.3. Select either Atmel WILC SDIO or Atmel WILC SPI based on the requirement.
Note:  Ensure that the mmc1 node of arch/arm/boot/dts/at91-sama5d3_xplained.dts file is similar to the node with the following:
mmc1: mmc@fc000000 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>; vmmc-supply = <&vcc_mmc1_reg>; vqmmc-supply = <&vcc_3v3_reg>; non-removable; status = "okay"; slot@0 { reg = <0>; bus-width = <4>; }; };
9. Save the .config file.
10. Build the kernel using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi
11. Build the modules using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi modules
12. Build the zImage using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi zImage
13. Build the dtb file using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi at91-sama5d2_xplained.dtb
The ATWILC driver modules are built under /drivers/staging/wilc1000. The wilc.ko, wilc-sdio.ko, and wilc-spi.ko modules are common for ATWILC1000 and ATWILC3000.
14. Download the SAM-BA tool version SAM-BA 2.16 for Linux software from SAM-BA In-system
Programmer.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 13
ATWILC1000/ATWILC3000
Building and Flashing the System Image into ...
15. Export the path of the SAM-BA binary to the PATH environment variable.
16. Copy the zImage and at91-sama5d3_xplained.dtb files in to the demo package linux4sam-poky-sama5d3_xplained-5.6.
17. Rename the zImage file to zImage-sama5d3-xplained.bin in the demo package.
18. Connect the Micro USB cable to the EDBG-USB connector (J6) of the ATSAMA5D3 board.
19. Connect the FTDI cable to the DEBUG connector (J23) of the ATSAMA5D3 board to receive the debug messages.
20. Open /dev/ttyUSB0 with minicom. Set the baudrate as 115200.
21. Open the jumper jp5. Press Reset button. A log message "RomBOOT" is sent to minicom.
22. Short the jumper (jp5) and run the demo_linux_nandflash.sh script to flash the binaries.
23. When the booting is complete, copy the wilc.ko.wilc-sdio.ko, and wilc-spi.ko to the rootfile system using mass storage drive.
24. Copy and replace the existing firmware files from http://www.github.com/linux4wilc/.
25. Run the wilc.ko and wilc-sdio.ko modules. When successful, wlan0 interface is up and running.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 14
ATWILC1000/ATWILC3000
Building and Flashing the System Image into the SA...
5. Building and Flashing the System Image into the SAMA5D27-SOM1­EK1
This section provides the instructions to build the components for running Linux on the SAMA5D27­SOM1-EK1 board. This setup is configured to boot from the micro-SD card slot which leaves the standard SD card slot open for the ATWILC1000 SDIO board. Note:  Since the reset and chip-enable signals are not brought across the SDIO connector to the ATWILC1000 module, the SDIO board must be power cycled to reset it in the case of a system reset. If this is not done then repeated errors will be displayed at the Linux prompt until the card is removed and re-inserted. This behavior can be seen on a reset via NRST on the board or via a Linux reboot command. The workaround for the demo board is to remove and re-insert the card. In a client application the reset and chip enable signals to the ATWILC1000 must be controlled via I/O pins.
If the building process is successful, the final images can be found under the arch/arm/boot/ directory.

5.1 Building the Components

This section provides the procedure to build Bootstrap and U-Boot.

5.1.1 Bootstrap

This section provides the procedure to get source code from the git repository, configure with the default configuration, customize the AT91Bootstrap based on the default configuration, and build the AT91Bootstrap to generate the binary.
1. Clone the repository to get the source code, using the following commands:
git clone git://github.com/linux4sam/at91bootstrap.git cd at91bootstrap/
2. Configure the AT91Bootstrap. It is assumed that the user is at AT91Bootstrap root directory, board/sama5d27_som1_ek folder which contains several default configuration files: Configure the AT91Bootstrap to load U-boot binary from SD card.
$ make mrproper $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-ama5d27_som1_eksd_uboot_defconfig
If the configuring process is successful, the .config file can be found at AT91Bootstrap root directory.
3. Customize the AT91Bootstrap using the menuconfig. Enter the following command and select SDHC1 as the SD card interface rather than the default SDHC0.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
4. Build the AT91Bootstrap using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

5.1.2 U-Boot

Perform the following steps to build the U-boot.
© 2019 Microchip Technology Inc.
On successful building process, the final .bin image can be found in binaries/ at91bootstrap.bin folder.
User Guide
DS70005328C-page 15
ATWILC1000/ATWILC3000
Building and Flashing the System Image into the SA...
1. Get the SAMA5D2 default u-boot code by cloning the Linux4sam GitHub U-Boot repository, using the following commands:
git clone git://github.com/linux4sam/u-boot-at91.git cd u-boot-at91
2. The source code is fetched from the master branch which leads to the latest branch. If the user wants to use the other branch, the user can list them and use one of branches by using the following commands:
git branch -r git checkout origin/u-boot-2018.07-at91 -b u-boot-2018.07-at91
3. Compile the u-boot. The U-Boot environment variables can be stored in different media, the config files specifies where to store the U-Boot environment. Use the following command to add the environment variables in SD/MMC card:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sama5d27_som1_ek_mmc1_defconfi
4. Build the U-boot, using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
The U-boot binary u-boot.bin file is generated.

5.2 Building Kernel

Perform the following steps to build the kernel.
1. Clone the repository to get the source code, using the following commands:
git clone git://github.com/linux4sam/linux-at91.git
2. To use another branch, list the branches and use one of them by using the following commands:
git branch -r git checkout origin/linux-4.14-at91 -b linux-4.14-at91
3. Replace the ATWILC1000 driver in drivers/staging/wilc with the content for the driver/ wilc directory on the ATWILC driver repository. The repository is available at: https://github.com/
linux4wilc.
Enter the following command to get the files from linux4wilc:
git clone git://github.com/linux4wilc/driver
4. Modify the following line in linux-at91/drivers/staging/Makefile so that the build finds the correct directory:
FROM: obj-$(CONFIG_WILC1000) += wilc1000/ TO: obj-$(CONFIG_WILC) += wilc1000/
5. Configure the kernel using the following command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sama5_defconfig
6. Modify the default configuration using the menuconfig. Perform the following to open the menuconfig:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menucofig
– Select the ATWILC driver module, using the following steps:
1. Go to menuconfig.
2. Navigate to Device Drivers>Staging driver.
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 16
Loading...
+ 37 hidden pages