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:
•ATWILC1000
•ATWILC3000
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
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.
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:
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.
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-linuxgnueabihf$ make ARCH=arm CROSS_COMPILE=../../../output/host/opt/ext-toolchain/bin/arm-linuxgnueabihf- zImage
$ make ARCH=arm CROSS_COMPILE=../../../output/host/opt/ext-toolchain/bin/arm-linuxgnueabihf- dtbs
3. Updating Binary and System Image into the Target Board
This section describes how to update or flash the system image. The pre-build images include pre-build
driver and firmware binaries, which are available at GitHub.
The SAM-BA® tool is used to flash the binaries into the target board.
Note: Ensure that the SAM-BA tool is installed in the host machine before updating the system image.
The scripts in the demo package can use either SAM-BA 2.16 or 3.2.x depending on the download script
the user selects in step 5 of the following procedure.
For additional information, refer to the following:
•Software Tools
•SAMA5D4 Xplained Board
•ATSAMA5D44 Microprocessor
To start flashing, perform the following steps:
1.Download the pre-built images from https://github.com/linux4wilc/wilc_demo.
2.Unzip the downloaded file.
3.Once the new image is built as described in Chapter 2, Building Linux for SAMA5D4 Xplained Ultra
Board, these files must be copied from the buildroot\output\images directory to the directory
where the demo_linux_nandflash.tcl file is available.
Figure 3-1. List of Files in buildroot\output\images Location
4.Add the jumper at JP7 and connect to the host PC via the USB port at J11. Ensure that the host
machine completes the USB serial port connection and then remove the jumper at JP7. The
following figure shows the SAMA5D4 adapter connections.
5.Execute the demo_linux_nandflash.bat (for Windows®) file or the
demo_linux_nandflash.sh (for Linux) file.
Note:
•By default, the demo_linux_nandflash.sh file has sam-ba binary for 32-bit operating
system. For 64-bit operating system, change the sam-ba to sam-ba_64 in the same file.
•Execute the script in the super user mode. If sam-ba 3.2 is installed, use
demo_linux_nandflash_3_2.bat or demo_linux_nandflash_3_2.sh instead.
The output log can be viewed via J1 serial port.
Open the serial terminal on PC via the COM port, with the following configurations:
•115200 baud rate
•8-bit data
•No parity
•One stop bit
•No flow control
6.Successful download of the system image into the board is indicated by a log file, which opens
automatically. This log file contains all the download process history.
This chapter describes how to update the ATWILC firmware or driver on the demo image.
4.1 ATWILC1000 and ATWILC3000 Driver Modules
After the system boots, add the ATWILC driver modules wilc-sdio.ko, or wilc-spi.ko to /lib/
modules/4.9.xx-XX/kernel/drivers/staging/wilc1000/ directory or copy to any location on
the file system.
4.2 ATWILC1000 and ATWILC3000 Firmware Binaries
1.Add the ATWILC1000 firmware wilc1000_wifi_firmware.bin to the /lib/firmware/
mchp/ directory.
2.Add the ATWILC3000 Wi-Fi firmware, wilc3000_wifi_firmware.bin to the/lib/firmware/
mchp/ directory.
3.Add the ATWILC3000 Bluetooth® firmware, wilc3000_ble_firmware.bin to the wilc/lib/
firmware/mchp/ directory.
Updating ATWILC Firmware
Note: The firmware is available at https://github.com/linux4wilc/firmware.
The files can be transferred into the SAMA5D4 platform using any of the following methods:
•Ethernet
•ZMODEM
4.2.1 Adding Files Using Ethernet
The Local Area Network (LAN)/ Wide Area Network (WAN) can be used to transfer the file from one
machine to another machine, using the following command:
$ scp [path of file to send] root@[receiver's IP]:[target directory]
For example, the following command sends the wilc1000_wifi_firmware.bin file from the binary
directory to the /lib/firmware/mchp directory of the device using the internal IP address
This chapter describes how to use the ATWILC1000 and ATWILC3000 on the SAMA5D4 Xplained Board
or any similar Linux platform.
5.1 Accessing the Console
The user can access the serial console through the on board serial-to-USB converter. In fact, the
Embedded Debugger (EDBG) chip on the evaluation kit acts as a serial-to-USB converter and is loaded
with a firmware that can communicate via USB-CDC protocol.
To enable EDBG, open JP1 and connect the USB cable to the board (J20 EDBG-USB).
5.1.1 For Microsoft Windows Users
Install USB drivers for Atmel and Segger tools. Then, identify the USB connection that is established. The
user can verify this by checking if the EDBG virtual COM port appears in the Device Manager. The
COMxx number is used to configure the terminal emulator.
5.1.2 For Linux Users
Identify the USB connection by monitoring the last lines of dmesg command. The /dev/ttyACMx
number is used to configure the terminal emulator.
ATWILC1000/ATWILC3000
Running ATWILC
The following is the USB debug port connection:
[172677.700868] usb 2-1.4.4: new full-speed USB device number 31 using ehci-pci
[172677.792677] usb 2-1.4.4: not running at top speed; connect to a high speed hub
[172677.793418] usb 2-1.4.4: New USB device found, idVendor=03eb, idProduct=6124
[172677.793424] usb 2-1.4.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[172677.793897] cdc_acm 2-1.4.4:1.0: This device cannot do calls on its own. It is not a
modem.
[172677.793924] cdc_acm 2-1.4.4:1.0: ttyACM0: USB ACM device
The identifiers idVendor=03eb, and idProduct=6124 indicate the device as the evaluation kit board with
USB connection.
Now, use the terminal emulator with appropriate terminal settings (see Table 5-1) to communicate with
the SAMA5D4 adapter.
5.1.3 Serial Communication Parameters
The serial communication parameters are as follows:
The following section describes the SD express board and Serial Peripheral Interface (SPI) board
connections.
5.2.1 SD Express Board
Before performing the boot-up operation, ensure that the ATWILC1000 SD Express board is connected in
the SD slot (J24) of the SAMA5D4 Xplained board (see following figure).
Figure 5-1. SAMA5D4 SD Connection
ATWILC1000/ATWILC3000
Running ATWILC
The Secure Digital Input/Output (SDIO) Express card is recognized during boot-up with the following
lines.
mmc0: new high speed SDIO card at address 0001
Use the following commands to load the ATWILC1000 module SDIO driver.
Welcome to Buildroot
buildroot login: root
[root@buildroot ~]# insmod wilc.ko
wilc: module is from the staging directory, the quality is unknown, you have been warned.
[root@buildroot ~]# insmod wilc-sdio.ko
wilc_sdio: module is from the staging directory, the quality is unknown, you have been
warned.
linux_sdio_probe init_power =0
wilc_sdio mmc0:0001:1:Driver Initializing success
Note: Do not panic upon receiving the following message while loading the module:
wilc: module is from the staging directory, the quality is unknown, you have
been warned
This is the default message for all the drivers in kernel staging directory.
The ATWILC1000 Serial Peripheral Interface (SPI) board must be connected to SPI1 interface at J17 as
shown in the following figure.
Figure 5-2. SAMA5D4 SPI Connection
ATWILC1000/ATWILC3000
Running ATWILC
Table 5-2. SPI Pin Descriptions
SPI PinsHeader J17 Pins
MOSIPIN11
CLKPIN13
MISOPIN12
CSPIN10
IRQPIN8
Note: VEXT pin in the SPI card can be connected to 3V3 pin in the header J6. Re-configure to build the
driver in SPI mode with the WILC_SPI option in the kernel menuconfig. The modules wilc.ko and
wilc-spi.ko need to be loaded for the ATWILC1000 SPI driver.
5.3 Recognizing ATWILC3000
The following section describes the SDIO shield board and SPI shield board connections.
5.3.1 SDIO Shield Board
Before performing the boot-up operation, ensure that the ATWILC3000 Shield board is connected to the
Shield Arduino Shield Stacking Connector of the SAMA5D4 Xplained adapter.
Load the Wi-Fi SDIO driver module using the following command:
[root@buildroot ~]# insmod wilc.ko
wilc: module is from the staging directory, the quality is unknown, you have been warned.
[root@buildroot ~]# insmod wilc-sdio.ko
wilc_sdio: module is from the staging directory, the quality is unknown, you have been warned.
linux_sdio_probe init_power =0
wilc_sdio mmc0:0001:1: Driver Initializing success
Note: Do not panic upon receiving the following message while loading the module: