Skip to content

sama5d4ek

Tony Cho edited this page Mar 16, 2015 · 14 revisions

WikiQuick Start GuideAndroid SAMA5D4-EK Board

Introduction

This page describes how to integrate the ATWILC3000 into the Android SAMA5D4-EK board. Visit the following sites for more information.

Download SAMA5D4-EK Android source code

The Android source is maintained at the Android4Sam. See the following instructions to get the Android SDK. This instruction is based on NAND flash boot mode.

$ mkdir android4sam_v4.4_rc2
$ cd android4sam_v4.4_rc2
$ repo init -u git://github.com/Android4SAM/platform_sammanifest.git -b android4sam_v4.4_rc2
$ repo sync

Build Android source

$ . build/envsetup.sh
$ lunch sama5d4-eng
$ make
$ mkubi_image -b sama5d4

This build process generates system_ubifs-SAMA5D4-ANDROID-4.4.2_r2.img and userdata_ubifs-SAMA5D4-ANDROID-4.4.2_r2.img in the Android root directory if successful.

Download SAMA5D4-EK kernel source code

$ git clone git://github.com/Android4SAM/linux-at91.git
$ cd linux-at91
$ git checkout -b linux-at91 Android4sam_v4.4_rc2

Build the kernel source

  • Copy the android4sam_v4.4_rc2/out/target/product/sama5d4/root directory in the Android source directory to the Kernel root directory.

$ cp –r android4sam_v4.4_rc2/out/target/product/sama5d4/root ../linux-at91

  • Then, issue the following commands to build the kernel, modules and dtbs.
$ make mrproper
$ make ARCH=arm sama5_android_defconfig
$ make ARCH=arm CROSS_COMPILE=(path_to_cross-compiler/cross-compiler-prefix-) zImage
$ make ARCH=arm CROSS_COMPILE=(path_to_cross-compiler/cross-compiler-prefix-)
$ make ARCH=arm CROSS_COMPILE=(path_to_cross-compiler/cross-compiler-prefix-) dtbs

Flash images

Prebuilt image

  • Download the Android-4.4.2_r2-sama5d4-nandboot-rc2.tgz from here.
  • Click PB4 (RESET) on the SAMA5D4EK board while pushing PB3. Then, the board goes to boot mode.
  • Run the batch file, sama5d4_nandflash.bat for Windows. For Linux, run the script file, sama5d4_nandflash.sh.
  • Reset the board.

Engineering image

The following outputs are generated when Android and Kernel are successfully built.

  • android4sam_v4.4_rc2/system_ubifs-SAMA5D4-ANDROID-4.4.2_r2.img
  • android4sam_v4.4_rc2/userdata_ubifs-SAMA5D4-ANDROID-4.4.2_r2.img
  • linux-at91/arch/arm/boot/zImage
  • linux-at91/arch/arm/boot/dts/sama5d4ek.dtb

All of them can be downloaded with sama5d4_nandflash.bat or sama5d4_nandflash.sh files as done with prebuit images.

Bring up ATWILC3000

This section describes how to integrate the ATWILC3000 into the SAMA5D4EK Android platform. The patch file for the SAMA5D4EK is available in the following link: http://github.com/atwilc3000/patch

Android

  • Apply the patch to the Android source codes.
  • Build the Android with the following commands:
$ . build/envsetup.sh
$ lunch sama5d4-eng
$ make
$ mkubi_image -b sama5d4
  • Then, copy the android4sam_v4.4_rc2/out/target/product/sama5d4/root directory in the Android source directory to the kernel directory.

$ cp –r android4sam_v4.4_rc2/out/target/product/sama5d4/root ../linux-at91

Linux Kernel

  • Apply the patch to the kernel source
  • Build the kernel with the following commands:
$ make mrproper
$ make ARCH=arm sama5_android_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs
  • Flash the outputs to the target board.

Customizing ATWILC3000 driver

This section introduces how to make new working images when generating new wilc3000.ko file. The ATWILC3000 WLAN driver is located on the linux-at91/drivers/net/wireless/atmel/wilc3000.

  • The wilc3000.ko file is generated by issuing the following command.

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

  • This output should be placed in the following directory. Then, rebuild Android source.

android4sam_v4.4_rc2/device/atmel/common/config.

  • copy the android4sam_v4.4_rc2/out/target/product/sama5d4/root in the Android source directory to the Kernel root directory.

$ cp –r android4sam_v4.4_rc2/out/target/product/sama5d4/root ../linux-at91

  • Then, make new zImage.

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage

Hardware consideration

Bluetooth

The HCI UART transport layer uses the following configurations:

  • data length: 8 bits
  • parity: no parity
  • stop bit: 1stop bit
  • flow control: RTS/CTS
  • baud rate: vendor specific
  • flow-off response time: vendor specific

The local RXD should be connected to the remote TXD and the local RTS should be connected to the remote CTS and vice versa. For Bluetooth, the USART2 of SAMA5D4EK is connected to the ATWILC3000 EVB. However, USART2 conflicts with the ISI on the SAMA5D4EK board. So, it’s required to disable the ISI and enable the USART2 in the device tree file for the ATWILC3000 demo (Refer to dts). There is I/O expansion, J15 on the SAMA5D4-EK board. The expansion, J15 has the TXD2 on pin 6, RXD2 on pin 14, RTS2 on pin 5 and CTS2 on pin 12.

The TXD2 on the SAMA5D4EK should be connected to the RXD on the ATWILC3000 EVB, J216 pin18. In contrast, the RXD2 on the SAMA5D4EK should be connected to the TXD on the ATWILC3000 EVB, J216 pin19. The RTS2 on the SAMA5D4EK should be connected to the CTS on the ATWILC3000 EVB, J216 pin16 and the CTS2 should be connected to the RTS on the ATWILC3000 EVB, J216 pin24. Make sure open J227, J805 and J901 on ATWILC3000 EVB before running the Bluetooth.

WLAN

For the WLAN, the MCI1 MicroSD socket J14 on the SAMA5D4EK should be connected to the SDIO_J1 on the ATWILC3000 EVB. The I/O expansion, J19 on SAMA5D4EK has the DAT0 to DAT3 on pin 53 to 56 respectively, SD_CMD on pin 52, SD_CLK on pin 50, GND on pin 51 and VCC3V3 on pin 21. For the card detection, MC1_CD on pin 38 should be connected to GND on pin 31.The SD_DAT0 to SD_DATA3 should be connected to support SDIO 4-bit mode. In addition, SD_CMD, SD_CLK and GND should be connected to the SAMA5D4EK board.

  • SD_DAT0: SDIO_J1 Pin 8
  • SD_DAT1: SDIO_J1 Pin 9
  • SD_DAT2: SDIO_J1 Pin 1
  • SD_DAT3: SDIO_J1 Pin 2
  • SD_CLK: SDIO_J1 Pin 6
  • SD_CMD: SDIO_J1 Pin 3
  • GND: SDIO_J1 Pin 4, 7, 10, 11, 12