i.MX6Q/DL Piano PI Linux BSP User Guide

21
i.MX6Q/DL Piano PI Linux BSP User Guide

Transcript of i.MX6Q/DL Piano PI Linux BSP User Guide

Page 1: i.MX6Q/DL Piano PI Linux BSP User Guide

i.MX6Q/DL Piano PI

Linux BSP

User Guide

Page 2: i.MX6Q/DL Piano PI Linux BSP User Guide

Boot Mode Table (Switch SW1 on the board)

1 2 3 4

x x01 = SATA Boot

Booting protocol How many bits of data bus

11 = MMC/eMMC Boot 10 = 8-bit

10 = SD/eSD Boot X1 = 4-bit

(Switch SW1 on the board)

5 6 7 8

BOOT_MODE1 BOOT_MODE0

x 0

How many bits of data bus Boot from which device

10 = Internal boot mode

01 = USB OTG download

10 = SD3 Boot

11 = SD4 Boot

BOOT_MODE0

Page 3: i.MX6Q/DL Piano PI Linux BSP User Guide

BSP Installation

1. Download the BSP source code and the BSP Documents

a. Download the Linux BSP L3.0.35_4.1.0_ER_SOURCE_BSP from i.MX6 Sabre SD web site.

<

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=RDIMX6SABREBRD&fpsp=1&tab=Design_

Tools_Tab

>

b. Download the package L3.0.101_4.1.1_SOURCE_BSP

c. Download the codec package L3.0.101_4.1.1_MM_CODECS

d. Download the Ubuntu RFS file L3.0.35_4.1.0_UBUNTU_RFS_BSP

e. Go to Documentation page to download the BSP documents. Here is the web page:

< http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=RDIMX6SABREBRD&fpsp=1&tab=Documentation_Tab

>

f. Download the Linux BSP L3.0.35_4.1.0 documentation L3.0.35_4.1.0_LINUX_DOCS

2. Install the BSP L3.0.35_4.1.0

a. Open the i.MX_6Dual6Quad_SABRE-SD_Linux_User's_Guide.pdf which is in the L3.0.35_4.1.0_LINUX_DOCS.

b. Follow the Chapter 3 to install and build the BSP.

c. After built the BSP once (i.e. type the ./ltib and build succeeded), then apply the L3.0.101_4.1.1 and codec

packages to the BSP. Extract the L3.0.101_4.1.1_SOURCE_BSP and L3.0.101_4.1.1_MM_CODECS package and

follow the IMX6LXPATCHRN.pdf to install the packages to L3.0.35_4.1.0 BSP.

d. After applied all the patches, type ./ltib to build the BSP once again.

3. Adding the i.MX6 Pianopi to the LTIB

a. Add the Pianopi in the main.lkc, so you can select the Pianopi in the LTIB menuconfig. Copy the

Add_pianopi_to_ltib.patch to ltib/config/platform/imx/ and then apply the patch.

The command is:

~/ltib/config/platform/imx$ patch -p1 < Add_pianopi_to_ltib.patch

4. Adding the i.MX6 Pianopi into the u-boot and kernel

In U-boot:

a. Extract the u-boot source code first by this command:

./ltib -p u-boot -m prep

The u-boot source code will be extracted to ltib/rpm/BUILD/u-boot-2009.08/.

b. Copy the Add_pianopi_to_u-boot.patch to ltib/rpm/BUILD/u-boot-2009.08/

c. Apply the patch:

patch -p1 < Add_pianopi_to_u-boot.patch

Page 4: i.MX6Q/DL Piano PI Linux BSP User Guide

In Kernel:

a. bcmdhd.tar.gz is the Wifi support package. Copy the bcmdhd.tar.gz to

ltib/rpm/BUILD/linux/drivers/net/wireless/.

b. Decompress the bcmdhd.tar.gz. (command is : tar -zxvf bcmdhd.tar.gz)

c. Copy the Add_pianopi_to_kernel.patch to ltib/rpm/BUILD/linux/.

d. Apply the patch:

patch -p1 < Add_pianopi_to_kernel.patch

5. Build u-boot and uImage for i.MX6 Pianopi

a. Type ./ltib -c go into the LTIB configuration menu.

b. Now, the u-boot support pianopi board.

c. Select “Configure the kernel”

d. “Exit” and “Save”.

Page 5: i.MX6Q/DL Piano PI Linux BSP User Guide

e. In the Kernel Configuration, go to “System Type”-> “Freescale MXC Implementations”. You can select the

“i.MX6Q PIANOPI platform”.

f. Exit and Save.

g. After build succeeded, the u-boot.bin and uImage are stored in ltib/rootfs/boot/.

Page 6: i.MX6Q/DL Piano PI Linux BSP User Guide

Mfgtool

1. Download the Mfgtool :

a. For i.MX6Q, download the Mfgtool IMX_6DQ_MFG_TOOL from here:

<

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&fpsp=1&tab=Design_Tools_Tab

>

b. For i.MX6DL, download the Mfgtool IMX_6DL_6S_MFG_TOOL from here:

<

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6DL&fpsp=1&tab=Design_Tools_Tab

>

2. Build the MFGtool firmware for i.MX6 Pianopi board

a. Type the command :

./ltib --select

b. Select the “mfg firmware profile” to build the MFGtool firmware.

c. Exit and Save.

d. Then in the LTIB configuration under “Choose your board for u-boot”, select “mx6q_pianopi” for i.MX6Q Pianopi

or “mx6dl_pianopi” for i.MX6DL Pianopi.

Page 7: i.MX6Q/DL Piano PI Linux BSP User Guide

e. Select “Configure the kernel”

f. Exit and Save.

g. In the Kernel Configuration, go to “System Type”-> “Freescale MXC Implementations”.

Select the “i.MX6Q PIANOPI platform”.

h. Exit and Save.

Page 8: i.MX6Q/DL Piano PI Linux BSP User Guide

i. After build succeeded, the firmware u-boot.bin and uImage are stored in ltib/rootfs/boot. The ram filesystem

initramfs.cpio.gz.uboot is stored in ltib folder.

j. Store your firmware files to the “OS Firmware” folder of MFGtool.

3. Copying the images to EMMC by using MFGtool

Modify the ucl2.xml for i.MX6Q Pianopi

a. Find the “SabreSD-eMMC” in the file.

b. You can change the “SabreSD-eMMC” script directly OR you can Copy & Paste to create a new script, for

example : “PianoPi-eMMC”.

c. Make sure the filename of Pianopi firmware (stored in “OS Firmware“ folder) is same as the filename used in the

ucl2.xml script.

For example: my Pianopi firmware are mx6q_pianopi_u-boot.bin and mx6q_pianopi_uImage . Modify the

filename for firmware like this:

<CMD state="BootStrap" type="boot" body="BootStrap" file ="mx6q_pianopi_u-

boot.bin" >Loading U-boot</CMD>

<CMD state="BootStrap" type="load" file=”mx6q_pianopi_uImage" address="0x10800000"

d. Make sure the filename of the target images are same as the filename used in the script.

For example: my target images are u-boot.bin and uImage. Modify the filename for the target images like this:

<CMD state="Updater" type="push" body="send" file="files/u-boot.bin"> Sending U-

Boot</CMD>

<CMD state="Updater" type="push" body="send" file="files/uImage"> Sending kernel

uImage</CMD>

Note : For i.MX6DL Pianopi MFGtool, there is no ”SabreSD-eMMC “. There is a same script called “i.MX6DL-SABRESD-

eMMC” in the ucl2.xml file.

Modify the cfg.ini

Change the LIST name to “SabreSD-eMMC” or the name which is same as the LIST name you want to use in ucl2.xml.

Page 9: i.MX6Q/DL Piano PI Linux BSP User Guide

Copying the images to the EMMC

a. Run the MfgTool2.exe

b. Change the boot mode on the board (switch SW1 ) to “USB download” mode. BOOT_MODE[1-8] = 11101101

(for details, please refer to Boot Mode Table)

c. Connect the board to your PC by USB OTG cable.

d. Power on the board

e. “HID-compliant device” will be detected on MFGtool

f. Click “Start” button to start to program the EMMC on the board

4. Copying the images to the SD card by using MFGtool

Modify the ucl2.xml for i.MX6Q Pianopi

a. Find the “SabreSD-eMMC” in the file.

b. You can change the “SabreSD-eMMC” script directly OR you can Copy & Paste to create a new script, for

example : “PianoPi-SD_CARD”.

c. Make sure the filename of Pianopi firmware (stored in “OS Firmware“ folder) is same as the filename used in the

ucl2.xml script.

For example: my Pianopi firmware are mx6q_pianopi_u-boot.bin and mx6q_pianopi_uImage . Modify the

filename for firmware like this:

Page 10: i.MX6Q/DL Piano PI Linux BSP User Guide

<CMD state="BootStrap" type="boot" body="BootStrap" file ="mx6q_pianopi_u-

boot.bin" >Loading U-boot</CMD>

<CMD state="BootStrap" type="load" file=”mx6q_pianopi_uImage" address="0x10800000"

d. Make sure the filename of the target images are same as the filename used in the script.

For example: my target images are u-boot.bin and uImage. Modify the filename for the target images like this:

<CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-

Boot</CMD>

<CMD state="Updater" type="push" body="send" file="files/uImage">Sending kernel

uImage</CMD>

e. In the linux system, the SD card is /dev/mmcblk1. So, change all the mmcblk0 to mmcblk1.

f. Remove the following statements in the ucl2.xml which are used for copying the u-boot.bin to SD card.

<CMD state="Updater" type="push" body="$ echo 0 > /sys/block/mmcblk1boot0/force_ro">access boot partition

1</CMD>

<CMD state="Updater" type="push" body="send" file="files/u-boot-mx6dl-sabresd.bin">Sending U-Boot</CMD>

<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk1boot0 bs=512 seek=2 skip=2">write U-Boot

to sd card</CMD>

<CMD state="Updater" type="push" body="$ echo 1 > /sys/block/mmcblk1boot0/force_ro"> re-enable read-only

access</CMD>

<CMD state="Updater" type="push" body="$ echo 8 > /sys/devices/platform/sdhci-esdhc-

imx.3/mmc_host/mmc0/mmc0:0001/boot_config">enable boot partition 1

g. Add the following simple script back for copying the u-boot to SD card.

<CMD state="Updater" type="push" body="send" file="files/u-boot.bin">Sending U-Boot</CMD>

<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk1 bs=512 seek=2 skip=2">write U-Boot to

sd card</CMD>

Note : For i.MX6DL Pianopi MFGtool, there is no ”SabreSD-eMMC “. There is a same script called “i.MX6DL-SABRESD-

eMMC” in the ucl2.xml file.

Modify the cfg.ini

Change the LIST name to “SabreSD-eMMC” or the name which is same as the LIST name you want to use in ucl2.xml.

Copying the images to the SD Card

a. Run the MfgTool2.exe

b. Change the boot mode on the board (switch SW1 ) to “USB download” mode. BOOT_MODE[1-8] =

10111001 (for details, please refer to Boot Mode Table)

Page 11: i.MX6Q/DL Piano PI Linux BSP User Guide

c. Connect the board to your PC by USB OTG cable.

d. Plug your micro SD card to the SD card slot.

e. Power on the board

f. “HID-compliant device” will be detected on MFGtool

g. Click “Start” button to start to program the SD card on the board

Page 12: i.MX6Q/DL Piano PI Linux BSP User Guide

Copying the images to the SD card by using Linux Command

Assume the SD card plug into the USB card reader, and the device name of the USB card reader in the Linux is /dev/sdb.

Copying the u-boot.bin:

sudo dd if=u-boot.bin of=/dev/sdb bs=512 seek=2 skip=2 conv=fsync

Copying the uImage:

sudo dd if=uImage of=/dev/sdb bs=512 seek=2048 conv=fsync

Copying the rootfs:

a. Use “fdisk” command to create the partition first.

sudo fdisk /dev/sdb

b. In the fdisk, type the following parameters:

u switch the unit to sectors instead of cylinders

d repeat this until no partition is reported by the 'p'

command

n create a new partition

p create a primary partition

1 the first partition

16384 starting at offset sector #16384, i.e. 8MB, which

leaves enough space for the kernel, the boot loader

and its configuration data

<enter> using the default value will create a partition that

spans to the last sector of the medium

w this writes the partition table to the medium and

fdisk exits

c. The file system format ext3 or ext4 is a good option for removable media due to the builtin journaling. Run

the following command to format the partition:

$ sudo mkfs.ext3 /dev/sdb1

Or

$ sudo mkfs.ext4 /dev/sdb1

d. Copy the target file system to the partition:

$ mkdir /home/user/mountpoint

$ sudo mount /dev/sdb1 /home/user/mountpoint

e. Extract rootfs package to certain directory: extract rootfs.ext2.gz to /home/user/rootfs

for example:

$ gunzip rootfs.ext2.gz

$ mount -o loop -t ext2 rootfs.ext2 /home/user/rootfs

f. Assume that the root file system files are located in /home/user/rootfs as in the previous step:

$ cd /home/user/rootfs

Page 13: i.MX6Q/DL Piano PI Linux BSP User Guide

$ sudo cp -a * /home/user/mountpoint

$ sudo umount /home/user/mountpoint

Extract the Ubuntu filesystem to the SD Card

Same as the Step a. to Step d. above, then type the following:

$ cd /home/user/mountpoint

$ sudo tar --numeric-owner -xzvf /<path>/oneiric.tgz

Page 14: i.MX6Q/DL Piano PI Linux BSP User Guide

Boot up the board

Change the boot mode (SW1) before your power up the board.

Boot from EMMC

Boot from SD

1. Plug the power cable to power up the board

2. By default, the bootcmd in u-boot is boot from EMMC. If you want to boot from SD card, you can change the

bootcmd to “run bootcmd_sd”.

1 2 3 4 5 6 7 8

BOOT_MODE1 BOOT_MODE0

11 = MMC/eMMC Boot 10 = 8-bit 10 = SD3 Boot 10 = Internal boot mode

Booting protocol How many bits of data bus Boot from which device

1 2 3 4 5 6 7 8

BOOT_MODE1 BOOT_MODE0

10 = SD/eSD Boot X1 = 4-bit 11 = SD4 Boot 10 = Internal boot mode

Booting protocol How many bits of data bus Boot from which device

Page 15: i.MX6Q/DL Piano PI Linux BSP User Guide

Wifi AP6181

Driver location: linux/drivers/net/wireless/bcmdhd/

1. In Kernel Configuration, go to Device Drivers --> Network device support --> Wireless LAN -->

2. Select <M> Broadcom 4329/30 wireless cards support

After build succeeded, the module is stored in

ltib/rootfs/lib/modules/<linux_version_number>/kernel/drivers/net/wireless/bcmdhd/bcmdhd.

ko

Copy the bcmdhd.ko and the firmware files to the board and then use “Insmod” to load the wifi driver module.

This is an example:

1. Create a new folder /wifi/firmware/ in your target system.

2. Copy bcmdhd.ko to folder /wifi/.

3. Copy fw_bcm40181a2.bin and nvram_ap6181.txt to folder /wifi/firmware/.

4. Go to the folder /wifi.

5. Execute the insmod command:

insmod bcmdhd.ko "firmware_path=/wifi/firmware/fw_bcm40181a2.bin

nvram_path=/wifi/firmware/nvram_ap6181.txt"

Page 16: i.MX6Q/DL Piano PI Linux BSP User Guide

WM8960

Driver location: linux/sound/soc/codecs/wm8960.c

Machine driver location: linux/sound/soc/imx/imx-wm8960.c

1. In Kernel Configuration, go to Device Drivers --> Sound card support --> Advanced Linux Sound Architecture --> ALSA

for SoC audio support --> SoC Audio for Freescale i.MX CPUs -->

2. Select <*> SoC Audio support for IMX boards with WM8960

This is the Left Input path of WM8960:

Page 17: i.MX6Q/DL Piano PI Linux BSP User Guide

This is the Right Input path of WM8960:

This is the output path of WM8960:

In the linux, you can use ‘alsamixer’ to tune the input and output volume, and switch on/off the switches.

Page 18: i.MX6Q/DL Piano PI Linux BSP User Guide

CSI0 OV5640 and MIPI OV5645 cameras

Driver location:

linux/drivers/media/video/mxc/capture/ov5640.c

linux/drivers/media/video/mxc/capture/ov5645_mipi.c

1. In Kernel Configuration, go to Device Drivers --> Multimedia support --> Video capture adapters --> MXC

Camera/V4L2 PRP Features support -->

2. Select <M> OmniVision ov5640 camera support

3. Select <M> OmniVision ov5645 camera support using mipi

Camera test:

Type the following commands to load the camera modules:

modprobe ipu_prp_enc

modprobe ipu_bg_overlay_sdc

modprobe ipu_fg_overlay_sdc

modprobe ipu_csi_enc

modprobe ov5640_camera

modprobe ov5645_camera_mipi

modprobe mxc_v4l2_capture

echo -e "\033[9;0]" > /dev/tty0

In the linux system, the ov5640 is /dev/video0 and ov5645_mipi is /dev/video1.

Page 19: i.MX6Q/DL Piano PI Linux BSP User Guide

Here are the capture modes supported in OV5640:

ov5640_mode_VGA_640_480 = 0,

ov5640_mode_QVGA_320_240 = 1,

ov5640_mode_NTSC_720_480 = 2,

ov5640_mode_PAL_720_576 = 3,

ov5640_mode_720P_1280_720 = 4,

ov5640_mode_1080P_1920_1080 = 5,

ov5640_mode_QSXGA_2592_1944 = 6,

ov5640_mode_QCIF_176_144 = 7,

ov5640_mode_XGA_1024_768 = 8,

Here are the capture modes supported in OV5645_mipi:

ov5645_mode_VGA_640_480 = 0,

ov5645_mode_NTSC_720_480 = 2,

ov5645_mode_PAL_720_576 = 3,

ov5645_mode_720P_1280_720 = 4,

ov5645_mode_1080P_1920_1080 = 5,

ov5645_mode_QSXGA_2592_1944 = 6,

ov5645_mode_XGA_1024_768 = 8,

ov5645_mode_SXGA_1280_960 = 9,

This is a gstreamer command to test the camera capture function. You can change the capture-mode number to test

different resolution and change the fps-n for different frame rate.

gst-launch mfw_v4lsrc capture-mode=0 device=/dev/video1 fps-n=30 ! mfw_v4lsink

Page 20: i.MX6Q/DL Piano PI Linux BSP User Guide

PCA9543A

Driver location: linux/drivers/i2C/muxes/pca954x.c

1. In Kernel Configuration, go to Device Drivers --> I2C support --> I2C bus multiplexing support --> Multiplexer I2C Chip

support -->

2. Select <*> Philips PCA954x I2C Mux/switches

Page 21: i.MX6Q/DL Piano PI Linux BSP User Guide

Touch IC driver

Driver location: linux/drivers/input/touchscreen/gt9xx.c

1. In Kernel Configuration, go to Device Drivers --> Input device support --> Touchscreens -->

2. Select <*> GOODIX GT9xx touchscreen driver