How to use & access iMX6 peripherals (Examples)

Content

DDR3 Memory test

First check how much free memory you have
# free
             total         used         free       shared      buffers
Mem:        765964        28352       737612            0            0
-/+ buffers:              28352       737612
Swap:            0            0            0
#
To run the memory test use as much free memory as you can. (In this example I use 10M for demonstration, just to run the test very quickly)
# memtester 10M
memtester version 4.3.0 (32-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 10MB (10485760 bytes)
got  10MB (10485760 bytes), trying mlock ...locked.
Loop 1:
  Stuck Address       : ok
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok
  Block Sequential    : ok
  Checkerboard        : ok
  Bit Spread          : ok
  Bit Flip            : ok
  Walking Ones        : ok
  Walking Zeroes      : ok
  8-bit Writes        : ok
  16-bit Writes       : ok

Boot your board from a RAM filesystem

Rex U-Boot > tftp 0x10800000 uImage
PHY indentify @ 0x3 = 0x00221611
FEC: Link is Up 796d
Using FEC0 device
TFTP from server 192.168.0.86; our IP address is 192.168.0.150
Filename 'uImage'.
Load address: 0x10800000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         ####
done
Bytes transferred = 3868164 (3b0604 hex)
Rex U-Boot > tftp 0x11000000 uramdisk.img
FEC: Link is Up 796d
Using FEC0 device
TFTP from server 192.168.0.86; our IP address is 192.168.0.150
Filename 'uramdisk.img'.
Load address: 0x11000000
Loading: #################################################################
         #########################
done
Bytes transferred = 1309205 (13fa15 hex)
Rex U-Boot > bootm 0x10800000 0x11000000

Ethernet test

A simple ping test. You can increase the size of the packet press -s switch
# ping -s 1000 192.168.0.86
PING 192.168.0.86 (192.168.0.86): 1000 data bytes
1008 bytes from 192.168.0.86: seq=0 ttl=64 time=1.988 ms
1008 bytes from 192.168.0.86: seq=1 ttl=64 time=0.479 ms
1008 bytes from 192.168.0.86: seq=2 ttl=64 time=0.451 ms
1008 bytes from 192.168.0.86: seq=3 ttl=64 time=0.465 ms

--- 192.168.0.86 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.451/0.845/1.988 ms
#

PCI Express (a PCIE Ethernet card was used for this test)

Enable PCI Express for iMX6
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- menuconfig

Add a star to:  make menuconfig -> System Type -> Freescale MXC Implementations -> PCI Express support
Add a star to:  make menuconfig -> Bus support -> Message Signaled Interrupts (MSI and MSI-X)
Add a star to:  make menuconfig -> Bus support -> PCI Express Support
Add support for Realtek 8169 PCIE ethernet card
Add a star to:  make menuconfig -> Device Drivers -> Network Device support -> Ethernet (1000 Mbit)
Add a star to:  make menuconfig -> Device Drivers -> Network Device support -> Ethernet (1000 Mbit) -> Realtek 8169 gigabit ethernet support
Disable the on board Ethernet (FEC)
remove the star from: make menuconfig -> Device Drivers -> Network Device support -> Ethernet (10 or 100Mb)
Install iperf
#apt-get install iperf
Disconnect the onboard ethernet and run:
//start iperf server, on a local computer
fedevel@ubuntu:~$  iperf -s

//start iper client on the iMX6 Rex board
# iperf -c 192.168.0.86 -t 60 -i 10
------------------------------------------------------------
Client connecting to 192.168.0.86, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.75 port 57541 connected with 192.168.0.86 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   542 MBytes   455 Mbits/sec
[  3] 10.0-20.0 sec   544 MBytes   456 Mbits/sec
[  3] 20.0-30.0 sec   538 MBytes   452 Mbits/sec
[  3] 30.0-40.0 sec   617 MBytes   518 Mbits/sec
[  3] 40.0-50.0 sec   779 MBytes   654 Mbits/sec
[  3] 50.0-60.0 sec   774 MBytes   649 Mbits/sec
[  3]  0.0-60.0 sec  3.71 GBytes   530 Mbits/sec
root@linaro-alip:~#
Now the other direction
//start iperf server on the iMX6 Rex board
# iperf -s

//start iperf client on a local computer
iperf -c 192.168.0.75 -t 60 -i 10
------------------------------------------------------------
Client connecting to 192.168.0.75, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.86 port 56105 connected with 192.168.0.75 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.05 GBytes    901 Mbits/sec
[  3] 10.0-20.0 sec  1.06 GBytes    910 Mbits/sec
[  3] 20.0-30.0 sec  1.06 GBytes    910 Mbits/sec
[  3] 30.0-40.0 sec  1.06 GBytes    910 Mbits/sec
[  3] 40.0-50.0 sec  1.06 GBytes    910 Mbits/sec
[  3] 50.0-60.0 sec  1.06 GBytes    909 Mbits/sec
[  3]  0.0-60.0 sec  6.35 GBytes    908 Mbits/sec
fedevel@ubuntu:~$ 

USB

Plug in a USB memory stick, you will see a message like this (possible use dmesg command to see how your USB is detected).
# usb 1-1.1: device v17ef p3818 is not supported
sd 1:0:0:0: [sdb] No Caching mode page present
sd 1:0:0:0: [sdb] Assuming drive cache: write through
sd 1:0:0:0: [sdb] No Caching mode page present
sd 1:0:0:0: [sdb] Assuming drive cache: write through
sd 1:0:0:0: [sdb] No Caching mode page present
sd 1:0:0:0: [sdb] Assuming drive cache: write through

#
Mount the USB (in this example the USB is formatted as FAT)
# mount /dev/sdb1 /media
# ls -la /media
total 118084
drwxr-xr-x  4 root root        8192 Jan  1  1970 .
drwxr-xr-x 22 root linaro      4096 Dec 20 09:30 ..
-rwxr-xr-x  1 root root   120886176 Dec 22 15:11 78.avi
drwxr-xr-x  8 root root        8192 Oct 10 16:48 Pictures processed
drwxr-xr-x  2 root root        8192 Oct 10 16:44 iMX6 Rex Moduel Layout videos
#
Now, you can copy a video to /media and play it. This will perform a simple USB test.

SD

Plug the SD card and find out where the card is mapped. After typing dmesg at you will see something like this:
# dmesg | tail
mmc0: new high speed SD card at address aaaa
mmcblk1: mmc0:aaaa SU02G 1.84 GiB
 mmcblk1: p1
Your card is mapped in /dev/mmcblk1. Create a new partition on this SD card:
# fdisk /dev/mmcblk1

Command (m for help): p

Disk /dev/mmcblk0: 1977 MB, 1977614336 bytes
4 heads, 16 sectors/track, 60352 cylinders, total 3862528 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x91fc0d77

        Device Boot      Start         End      Blocks   Id  System

Command (m for help): d
Selected partition 1

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-3862527, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3862527, default 3862527):
Using default value 3862527

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
#
Format your SD card - you created partition 1 on the card which is located in /dev/mmcblk1 (or wherever the dmesg above said). The partition is then mapped in register /dev/mmcblk1p1:
# mkfs.ext3 /dev/mmcblk1p1
mke2fs 1.42.5 (29-Jul-2012)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
120720 inodes, 482815 blocks
24140 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=494927872
15 block groups
32768 blocks per group, 32768 fragments per group
8048 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

#
Mount your SD card
# mount /dev/mmcblk1p1 /media/
root@linaro-alip:~# ls -la /media/
total 24
drwxr-xr-x  3 root root    4096 Dec 28 15:04 .
drwxr-xr-x 22 root linaro  4096 Dec 20 09:30 ..
drwx------  2 root root   16384 Dec 28 15:04 lost+found
#
Now, you can copy a video to /media and play it. This will perform a simple SD test.

Preparing SD card for a filesystem

These steps described creating a new filesystem SD card on the iMX6 Rex board. Check if the link is fit on the jumper JP3. If not fit them and reset the board. Download the filesystem, the default kernel and the wifi and modem support version. Be sure, you have the latest files. Copy all these files e.g. to the USB stick. Plug the USB, insert SD card to the hinged card holder (J39). Folow these steps to prepare the SD card first. After you plug the usb find out where the USB is mapped. At the end of the list you will see sometihing like this:
# dmesg | tail
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Mode Sense: 43 00 00 00
sd 1:0:0:0: [sda] No Caching mode page present
sd 1:0:0:0: [sda] Assuming drive cache: write through
sd 1:0:0:0: [sda] No Caching mode page present
sd 1:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: [sda] No Caching mode page present
sd 1:0:0:0: [sda] Assuming drive cache: write through
sd 1:0:0:0: [sda] Attached SCSI removable disk
Your USB stick is mapped in /dev/sda1 (in this case). Mount the USB:
# mkdir /media/usbdisk
# mount /dev/sda1 /media/usbdisk
Mount the SD card:
# mkdir /media/sdcard
# mount /dev/mmcblk1p1 /media/sdcard
Unpack the filesystem:
# cd /media/sdcard
# tar -pxvzf /media/usbdisk/imx6rex-xubuntu-13-04-production-04-AUG-2014.tar
Copy kernel to the SD card:
# cp -prv /media/usbdisk/imx6rex-uImage-wifi-and-modem-no-fec-11-MAR-2014 uImage-wifi-and-modem-no-fec
# cp -prv /media/usbdisk/imx6rex-uImage-gpu-en-fec-fix-02-MAY-2014 uImage
Unmout the USB stick and the SD device:
# umount /media/usbdisk
# cd ~
# umount /media/sdcard

Listing SD card files in u-boot

You can check the content of the SD card in the u-boot with the command
> mmc dev 1; ext2ls mmc 1

Setup display outputs

To reorder your display outputs edit linux source code. Find this function at linux/arch/arm/mach-mx6/board-mx6q_sabresd.c
static struct ipuv3_fb_platform_data sabresd_fb_data[] = {
    { /*fb0*/
/*
    .disp_dev = "ldb",
    .interface_pix_fmt = IPU_PIX_FMT_RGB666,
    .mode_str = "LDB-XGA",
    .default_bpp = 16,
    .int_clk = false,
    .late_init = false,
    }, {
    .disp_dev = "ldb",
    .interface_pix_fmt = IPU_PIX_FMT_RGB666,
    .mode_str = "LDB-XGA",
    .default_bpp = 16,
    .int_clk = false,
    }, {
    .disp_dev = "lcd",
    .interface_pix_fmt = IPU_PIX_FMT_RGB565,
    .mode_str = "CLAA-WVGA",
    .default_bpp = 16,
    .int_clk = false,
    .late_init = false,
    }, {
    .disp_dev = "ldb",
    .interface_pix_fmt = IPU_PIX_FMT_RGB666,
    .mode_str = "LDB-VGA",
    .default_bpp = 16,
    .int_clk = false,
    .late_init = false,
    },*/

         .disp_dev          = "ldb",
         .interface_pix_fmt  = IPU_PIX_FMT_RGB666,
         .mode_str                  = "LDB-XGA",
         .default_bpp             = 32,
         .int_clk              = false,
         }, {
         .disp_dev          = "ldb",
         .interface_pix_fmt  = IPU_PIX_FMT_RGB666,
         .mode_str                  = "LDB-XGA",
         .default_bpp             = 16,
         .int_clk              = false,
         }, {
         .disp_dev          = "hdmi",
         .interface_pix_fmt  = IPU_PIX_FMT_RGB24,
         .mode_str                  = "1920x1080M@60",
         .default_bpp             = 32,
         .int_clk              = false,
         }, {
         .disp_dev          = "lcd",
         .interface_pix_fmt  = IPU_PIX_FMT_RGB565,
         .mode_str                  = "CLAA-WVGA",
         .default_bpp             = 16,
         .int_clk              = false,
         },
};

HDMI

To setup the HDMI monitor as a default video output (e.g. x window will be shown here) use following commands. Note: If you use Linaro filesystem, use the default kernel (both was shipped on the SD card with your board).
> setenv bootargs 'console=ttymxc0,115200'
> setenv bootcmd_mmc 'run bootargs_mmc ; mmc dev 1; ext2load mmc 1 0x10800000 uImage 3850796; bootm 0x10800000'
> setenv bootargs_mmc 'setenv bootargs ${bootargs} ip=192.168.10.86:::255.255.255.0 root=/dev/mmcblk0p1 rootwait video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB666 vmalloc=400M fbmem=28M fbcon=28M'
> setenv bootcmd 'ping 192.168.10.1; run bootcmd_mmc'
Setup the HDMI monitor as primary when the filesystem is downloaded from network server:
setenv bootargs_nfs 'setenv bootargs ${bootargs} root=/dev/nfs rootdelay=4 ip=192.168.0.85:::255.255.255.0 nfsroot=${serverip}:${nfsroot},v3,tcp video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24 vmalloc=400M fbmem=28M fbcon=28M'
Play a video on HDMI monitor. (Note: At the moment there is no audio support on our board, so I switch audio off)
# mplayer -vo fbdev2 -nosound dfs.avi
MPlayer2 UNKNOWN (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing dfs.avi.
Detected file format: AVI format (libavformat)
[lavf] stream 0: video (msvideo1), -vid 0, Image11.avi Video #1
VIDEO:  [CRAM]  320x240  16bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
Load subtitles in .
Opening video filter: [scale]
[ass] auto-open
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Asking decoder to use 4 threads if supported.
Selected video codec: [ffvideo1] vfm: ffmpeg (FFmpeg Microsoft Video 1)
==========================================================================
Audio: no sound
Starting playback...
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x2bffb980]BICUBIC scaler, from rgb555le to yuv420p using C
[swscaler @ 0x2bffb980]No accelerated colorspace conversion found from yuv420p to bgra.
VO: [fbdev2] 320x240 => 320x240 BGRA
Fontconfig warning: ignoring C.UTF-8: not a valid language tag
Fontconfig warning: ignoring C.UTF-8: not a valid language tag
Fontconfig warning: ignoring C.UTF-8: not a valid language tag
V:   6.7   0/  0  1% 23%  0.0% 0 0


Exiting... (End of file)
#
Play a video on HDMI monitor when not set as a default monitor (by u-boot). List all the mapped displays:
# cat /proc/cmdline; for fb in /sys/class/graphics/fb?; do echo "----$fb"; cat $fb/name; cat $fb/mode; cat $fb/fsl_disp_*; done
According to the listed devices, find the HDMI monitor (in this case located in fb3) and enable it (or disable):
// enable fb3 display
# echo 0 > /sys/class/graphics/fb3/blank
// disable fb3 display
# echo 1 > /sys/class/graphics/fb3/blank
The device, where the video will be played, needs to be specified (in this case /dev/fb3). Play a video in a loop on selected monitor:
# mplayer -vo fbdev2:/dev/fb3 -vf scale -zoom -loop 0 -xy 1024 dfs.avi
Start the X-session on HDMI from the console (Note: These commands may not work on every filesystem - tested with Ubuntu 13.04)
# export DISPLAY=:0.0
# startx &

LVDS

Playing a video file into the LVDS display (setup in u-boot as a default)
# mplayer -vo fbdev2 -vf scale -zoom -xy 1024 78.avi
Start the X-session on LVDS from the console (Note: These commands may not work on every filesystem - tested with Ubuntu 13.04)
# export DISPLAY=:0.0
# startx &

Adding custom LVDS display support

If you need to add a custom display support, you can specify settings (e.g. the resolution or the timing) directly in the kernel. Set these parameters in the structure ldb_modedb[] which is located in the file drivers/video/mxc/ldb.c As an example we will setup the display ETV570G6DHU.
static struct fb_videomode ldb_modedb[] = {
	// configuration of the other displays
	 {
	 "LDB-ETV570", 60, 640, 480, 
	 39714,		// pixel clock (in picoseconds),  
	 144, 16,	// left (left margin (in pixels)), right (right margin (in pixels))
	 35, 10,	// upper (upper margin (in pixel lines)), lower (lower margin (in pixel lines))
	 30, 3,		// hslen (horizontal sync length (in pixels)), vslen (vertical sync length (in pixel lines))
	 0,
	 FB_VMODE_NONINTERLACED,
	 FB_MODE_IS_DETAILED,},
};
You also need to include information about your display in the board file located in arch/arm/mach-mx6/board-mx6q_sabresd.c
static struct ipuv3_fb_platform_data sabresd_fb_data[] = {
	// other displays data
	 {
	.disp_dev = "ldb",
	.interface_pix_fmt = IPU_PIX_FMT_RGB666,
	.mode_str = "LDB-ETV570",
	.default_bpp = 16,
	.int_clk = false,
	.late_init = false,
	},
};
After you recompile the kernel, update uBoot parameters:
> setenv bootargs_mmc 'setenv bootargs ${bootargs} ip=dhcp root=/dev/mmcblk0p1 rootwait  video=mxcfb0:dev=ldb,LDB-ETV570,if=RGB666 vmalloc=400M fbmem=28M fbcon=28M'
> saveenv; reset
!!!BE AWARE: This step is important for displays with small resolution (pixelclock lower than 38.7MHz)
The default internal LVDS clock may be for some displays with lower resolution too high. This results in a loss of the part of the screen (screen goes over the edge of the display).To correct this issue you will need to change the source of the internal LVDS clock (in the file arch/arm/mach-mx6/clock.c)
// default setting clk_set_parent(&ldb_di0_clk, &pll2_pfd_352M);
clk_set_parent(&ldb_di0_clk, &pll5_video_main_clk);

Create a partition on your SATA drive

# fdisk /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Command (m for help): p

Disk /dev/sda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders, total 117231408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000986d9

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-117231407, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-117231407, default 117231407):
Using default value 117231407

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
#
Format your SATA HDD
# mkfs.ext3 /dev/sda1
mke2fs 1.42.5 (29-Jul-2012)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3670016 inodes, 14653670 blocks
732683 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
448 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

#
Mount your SATA HDD to /media
# mount /dev/sda1 /media/
# ls -la /media/
total 24
drwxr-xr-x  3 root root    4096 Dec 28 14:44 .
drwxr-xr-x 22 root linaro  4096 Dec 20 09:30 ..
drwx------  2 root root   16384 Dec 28 14:44 lost+found
#
Now, you can copy a video to /media and play it. This will perform a simple SATA test.

I2C

# i2cdetect 1 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-1. I will probe address range 0x03-0x77. Continue? [Y/n] y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- -- 30: 30 -- -- -- -- -- -- 37 -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- 4a 4b -- -- -- -- 50: UU 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- # [/code]

Testing I2C RTC

Read RTC at address 0x51 (0xA2/0xA3)
# i2cdump -r 0-0xf 1 0x51 b
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1, address 0x51, mode byte
Probe range limited to 0x00-0x0f.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 08 80 85 84 83 a8 86 12 13 88 82 90 91 84 07 00    ???????????????.
#
Set Month in the RTC to December (check datasheet for register description at http://www.nxp.com/documents/data_sheet/PCF8563.pdf )
# i2cset 1 0x51 0x07 0x12
WARNING! This program can confuse your I2C bus, cause data loss and worse!
DANGEROUS! Writing to a serial EEPROM on a memory DIMM
may render your memory USELESS and make your system UNBOOTABLE!
I will write to device file /dev/i2c-1, chip address 0x51, data address
0x07, data 0x12, mode byte.
Continue? [y/N] y
#

Testing I2C GPIO Expander

Read I2C GPIO Expander at address 0x27 (0x4E/0x4F)
# i2cdump -r 0-0x7 1 0x27 b
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1, address 0x27, mode byte
Probe range limited to 0x00-0x07.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 47 df ff ff 00 00 ff ff                            G?......
#
Example of controlling user LED connected to IO1_6 (see datasheet at http://www.nxp.com/documents/data_sheet/PCA9535_PCA9535C.pdf )
//set the GPIO expander pin IO1.6 as output
# i2cset 1 0x27 0x07 0xBF
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will write to device file /dev/i2c-1, chip address 0x27, data address
0x07, data 0xbf, mode byte.
Continue? [Y/n] y
//Set the GPIO expander pin IO.6 to LOW (This will switch OFF the LED)
# i2cset 1 0x27 0x03 0xBF
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will write to device file /dev/i2c-1, chip address 0x27, data address
0x03, data 0xbf, mode byte.
Continue? [Y/n] y
#
//Set the GPIO expander pin IO.6 to HIGH (This will switch ON the LED)
# i2cset 1 0x27 0x03 0xFF
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will write to device file /dev/i2c-1, chip address 0x27, data address
0x03, data 0xff, mode byte.
Continue? [Y/n] y
#

I2C Touchscreen TSC2007

To use this TSC2007 touchscreen we need to add few lines into the boardfile located at arch/arm/mach-mx6/board-mx6q_sabresd.c You can find all the changes in this Github commit.

First you need to include the TSC2007 header file:
#include <linux/i2c/tsc2007.h> 
Select the signal for the touchscreen interrupt (iMX6 use the pin NANDF_WP_B as gpio6_GPIO[9] - pad E15).
Note: SabreSD board use this pin for another purpose (SABRESD_AUX_3V15_EN or SABRESD_DISP0_WR_REVB). You may need to disable the definitions of these constant to avoid the collision (e.g. the direction of the GPIO).
#define SABRESD_TS_INT		IMX_GPIO_NR(6, 9)
Add the TSC2007 data structure. Setup the parameter x_plate_ohms according to your touchscreen terminal resistance:
static struct tsc2007_platform_data tsc2007_info = {
	.model			= 2007,
	.x_plate_ohms		= 500,
};
Insert the TSC 2007 into the list of available I2C devices (we are still working with board-mx6q_sabresd.c) TSC2007 is connected to I2C2 and uses 7-bit address 0x48. This address is defined in the structure mxc_i2c1_board_info[]):
static struct i2c_board_info mxc_i2c1_board_info[] __initdata = {
	// other devices
{
	I2C_BOARD_INFO("tsc2007", 0x48),
	.type = "tsc2007",
	.platform_data	= &tsc2007_info,
	.irq = gpio_to_irq(SABRESD_TS_INT),
},
};
Initialize the interrupt signal (in the mx6_sabresd_board_init() function):
	gpio_request(SABRESD_TS_INT, "tsc2007_irq");
	gpio_direction_input(SABRESD_TS_INT);
	gpio_free(SABRESD_TS_INT);
Now, we need to fix the tsc2007.c driver file located at drivers/input/touchscreen/
This is the fix: Call function init_platform_hw() only if exists (without this, kernel was crashing):
if (pdata->init_platform_hw)
	pdata->init_platform_hw();
The last thing is to Enable TSC2007 in imx6_defconfig (located in arch/arm/configs/)
CONFIG_TOUCHSCREEN_TSC2007=y
or via menuconfig
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- menuconfig

Add a star to: make menuconfig -> Device Drivers -> Input device support -> Touchscreens -> TSC2007 based touchscreens
Recompile the kernel (or use this one) and start the board with the LVDS display which supports touchscreen. Note: Check if the interrupt signal is connected to the TSC2007 chip - check if resistor R174 on Rex Development BB is fitted. Power up the board and stop the booting. Setup in u-boot:
> setenv bootcmd_mmc 'run bootargs_base bootargs_mmc; mmc dev 1; ext2load mmc 1 0x10800000 imx6rex-uImage-lvds-clock-TSC2007-support-31-JUL-2014 3916620; bootm 0x10800000'
> saveenv; reset
Touchscreen calibration
Download and install xinput_calibrator tool:
# wget https://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz
# tar -pxvzf xinput_calibrator-0.7.5.tar.gz
# cd xinput_calibrator-0.7.5
# ./configure
# make
# sudo make install
After the installation is completed open the X session first
# export DISPLAY=:0.0
# startx &
Run the calibration now (follow the steps from the screen)
# xinput_calibrator
After the calibration is successfully finished you will see the results (something like below). Note: you may need to run the calibration twice for the correct result.
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "TSC2007 Touchscreen"
        Option  "Calibration"   "77 3946 3915 143"
		Option  "SwapAxes"      "1"
EndSection
In case your touchscreen is working but inverted, run the calibration one more time and it will work correctly after that.

If you want to make this calibration settings permanent create a X-window config file and copy these information there
# mkdir /etc/X11/xorg.conf.d/
# nano /etc/X11/xorg.conf.d/99-calibration.conf
When you reset the board the touchscreen is calibrated from this config file.

Test the touchscreen
Run the X-window
# export DISPLAY=:0.0
# startx &
Start input test tool and check if the dimension on console are in match with the clicked point on the display
# xinput test "TSC2007 Touchscreen"
You will see something like this (in this example we clicked in four corners of the screen):
motion a[0]=101 a[1]=70 a[2]=884
motion a[0]=100 a[1]=72 a[2]=939
motion a[2]=0
button release 1
motion a[0]=4064 a[1]=30 a[2]=73
button press   1
motion a[0]=4056 a[1]=29 a[2]=69
motion a[0]=4057 a[1]=29 a[2]=68
motion a[0]=4058 a[1]=32
motion a[0]=4059 a[1]=31 a[2]=72
motion a[0]=4060 a[1]=35 a[2]=82
motion a[0]=4061 a[1]=50 a[2]=176
motion a[2]=0
button release 1
motion a[0]=84 a[1]=4007 a[2]=815
button press   1
motion a[0]=83 a[1]=4008 a[2]=806
motion a[0]=84 a[1]=4005 a[2]=816
motion a[0]=86 a[1]=4007 a[2]=798
motion a[0]=84 a[1]=4008 a[2]=818
motion a[0]=85 a[1]=4006 a[2]=835
motion a[0]=88 a[1]=4006 a[2]=888
motion a[2]=0
button release 1
motion a[0]=4088 a[1]=4002 a[2]=804
button press   1
motion a[0]=4088 a[1]=4001 a[2]=795
motion a[0]=4088 a[1]=4003 a[2]=794
motion a[0]=4088 a[1]=4003 a[2]=787
motion a[1]=3998 a[2]=819
motion a[0]=4085 a[1]=4000 a[2]=870
motion a[2]=0
button release 1

Audio SGTL5000

Access to audio mixer:
# alsamixer
Playing a wav file
# aplay -D hw:0,0 /home/linaro/blackbird.wav
Record audio from microphone Before recording open alsamixer and set the microphone gain to the maximum level. Connect a microphone to the PINK jack and run:
# arecord -f dat -d 10 -D hw:0,0 test.wav
Play the recorded file:
# aplay -f dat test.wav
Record audio from line in In alsamixer enable Line In function and set the Capture Mux to "Line In" option. For this test, we use a loop back cable and connect Line Out -> Line In. We play an audio file to the Line Out and record it from Line in. Run these two commands in different terminals (or use '&' at the end of the first aplay command):
# aplay -D hw:0,0 /home/ubuntu/blackbird.wav
# arecord -f dat -d 10 -D hw:0,0 test.wav
Play the recorded file:
# aplay -f dat test.wav
SGTL500.c driver changes We had to do some tweaking in the audio driver. Find this file sound/soc/codecs/sgtl500.c and fix a microphone bug:
@@ -602,7 +602,7 @@ static int mixer_vol_put(struct snd_kcontrol *kcontrol,

 	SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL,
 -			0, 4, 0, mic_gain_tlv),
 +			0, 3, 0, mic_gain_tlv),	//!mm driver mic fix - changed from 4 to 3
According to the latest SGTL5000 we provide external digital supply (VDDD). We have to disable the internal linear VDD regulator:
@@ -996,10 +996,11 @@ static int ldo_regulator_enable(struct regulator_dev *dev)

 	reg = codec->hw_read(codec, SGTL5000_CHIP_ANA_POWER);
 -	reg |= SGTL5000_LINEREG_D_POWERUP;
 +	//!mm do not enable LDO, orig: reg |= SGTL5000_LINEREG_D_POWERUP;
  	codec->write(codec, SGTL5000_CHIP_ANA_POWER, reg);
  
  	reg &= ~SGTL5000_LINREG_SIMPLE_POWERUP;
 +	reg &= ~SGTL5000_STARTUP_POWERUP;	//!mm needed if external VDDD is used
  	/* when internal ldo enabled, simple digital power can be disabled */

Read CPU Temperature

# cat /sys/devices/virtual/thermal/thermal_zone0/temp

Read CPU Frequency

# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq 
996000
# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq 
996000

GPU Test

Enable Vivante in menuconfig:
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- menuconfig

Add a star to: make menuconfig -> Device Drivers -> Graphics support -> Direct Rendering Manager (XFree86 4.1.0 and higher DRI Support)
Add a star to: make menuconfig -> Device Drivers -> Graphics support -> Direct Rendering Manager (XFree86 4.1.0 and higher DRI Support) -> Vivante GCCore
Compile new kernel and run it with the file system from here Xubuntu Raring (13.04) rootfs. Once it boots up, follow the steps here (start by number 2): I.MX6 Ubuntu 13.04 Debugging GPU Acceleration. This runs very nicely:
cd /root/gpu-viv-bin-mx6q-3.5.7-1.0.0-alpha.2-hfp/opt/viv_samples/vdk
./tutorial7

Bonie++

Install bonie++
$ cd /tmp
$ wget http://www.coker.com.au/bonnie++/bonnie++-1.03e.tgz
$ tar -zxvf bonnie++-1.03e.tgz
$ cd bonnie++-1.03e
$ ./configure
$ make
# make install

Run SATA test

$ bonnie++
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03e       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
ubuntu-imx6   1496M  7277  99 102772  99 62509  58  7981  99 170826  64  9136  85
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 16193  98 +++++ +++ 19412  99 16615 100 +++++ +++ 17947  96
ubuntu-imx6,1496M,7277,99,102772,99,62509,58,7981,99,170826,64,9135.9,85,16,16193,98,+++++,+++,19412,99,16615,100,+++++,+++,17947,96

Run SD0 test (Sandisk 16GB)

$ sudo bonnie++ -d /media/sd0/tmp_bonnie/ -u root
Using uid:0, gid:0.
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03e       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
ubuntu-imx6   1496M  3378  46  3016   2  3305   2  7123  87 25442   6  1222   6
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 16239  99 +++++ +++ 19161  99  8344  50 +++++ +++ 18723  99
ubuntu-imx6,1496M,3378,46,3016,2,3305,2,7123,87,25442,6,1222.5,6,16,16239,99,+++++,+++,19161,99,8344,50,+++++,+++,18723,99

Run SD1 test (Sandisk 8GB)

$ sudo bonnie++ -d /media/sd1/tmp_bonnie/ -u root                                                            [sudo] password for ubuntu:
Using uid:0, gid:0.
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03e       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
ubuntu-imx6   1496M  2944  40  2848   2  3018   1  7035  86 20955   5 895.0   4
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 15065  92 +++++ +++ 19361  99 16519  99 +++++ +++ 18864 100
ubuntu-imx6,1496M,2944,40,2848,2,3018,1,7035,86,20955,5,895.0,4,16,15065,92,+++++,+++,19361,99,16519,99,+++++,+++,18864,100

Wireless Modem (Telit HE910 PCIE mini)

Enable modem support in menuconfig:
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- menuconfig

Add a star to: make menuconfig -> Device Drivers -> USB support -> USB Modem (CDC ACM) support
Install serial console e.g. picocom:
sudo apt-get install picocom
Run serial console on the modem port:
picocom /dev/ttyACM3 -b 115200
Test network connection (here is a nice document with AT command examples):
AT
OK
AT+CPIN?
+CPIN: READY

OK
AT+CREG?
+CREG: 0,1

OK
AT+COPS?
+COPS: 0,0,"O2 - SK ",2

OK
Configure Audio support on the audio codec. Create a file:
# nano audio_i2c_config.sh
It is done over I2C. Write this script into audio_i2c_config.sh:
#! /bin/bash

i2cset 1 0x18 0x04 0x00
i2cset 1 0x18 0x05 0x10
i2cset 1 0x18 0x06 0x90
i2cset 1 0x18 0x07 0x00
i2cset 1 0x18 0x08 0x10
i2cset 1 0x18 0x09 0x0a
i2cset 1 0x18 0x0a 0x33
i2cset 1 0x18 0x0b 0x00
i2cset 1 0x18 0x0c 0x00
i2cset 1 0x18 0x0d 0x33
i2cset 1 0x18 0x0e 0x0c
i2cset 1 0x18 0x0f 0x0c
i2cset 1 0x18 0x10 0x09
i2cset 1 0x18 0x11 0x09
i2cset 1 0x18 0x12 0x24
i2cset 1 0x18 0x13 0x24
i2cset 1 0x18 0x14 0x40
i2cset 1 0x18 0x15 0x00
i2cset 1 0x18 0x16 0x60
i2cset 1 0x18 0x17 0x8a
Run the script (press enter until it finishes):
chmod 777 audio_i2c_config.sh
./audio_i2c_config.sh
Now configure audio support on the HE910 modem. Run these AT commands:
AT#DVI=1,2,1
OK
AT#DVIEXT=1,0,0,1,0
OK
You are ready to receive a call. Call you modem number and use "ATA" command to receive the call:
RING

RING

ATA
OK
To change speakers volume up & down, use (see MAX9876 datasheet for more settings):
i2cset 1 0x18 0x10 0x10 //volume Left -8dB
i2cset 1 0x18 0x11 0x10 //volume Right -8dB
To change microphone sensitivity:
i2cset 1 0x18 0x12 0x60 //gain left +20dB + 20dB
i2cset 1 0x18 0x13 0x60 //gain right +20dB + 20dB

Wifi PCIE mini card Intel 4965AGN

Enable WiFi support in menuconfig:
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- menuconfig
//enable PCIE support
Add a star to: make menuconfig -> System Type -> Freescale MXC Implementations -> PCI Express support
Add a star to: make menuconfig -> Bus support -> Message Signaled Interrupts (MSI and MSI-X)
Add a star to: make menuconfig -> Bus support -> PCI Express support

//enable iwl4965 support
Add a star to: make menuconfig -> Networking support -> Wireless -> Generic IEE 802.11 Netwroking Stack (mac80211)
Add a star to: make menuconfig -> Device Drivers -> Network device support -> Wireless LAN -> Intel Wireless Wifi 4965AGN (iwl4965)

//disable FEC (the on board ethernet)
Remove the star from: make menuconfig -> Device Drivers -> Network device support -> Ethernet (10 or 100Mbit)
Compile the new kernel. Now we need to provide wifi firmware to the card:
wget http://www.imx6rex.com/wp-content/uploads/2014/03/iwlwifi-4965-ucode-228.61.2.24.tar
tar -xvf iwlwifi-4965-ucode-228.61.2.24.tar
cd iwlwifi-4965-ucode-228.61.2.24
sudo cp iwlwifi-4965-2.ucode /lib/firmware/
Reboot your board, so it loads the firmware to the card:
sudo reboot
Check if you can see your wifi. It should look like this:
ubuntu@ubuntu-imx6:~/iwlwifi-4965-ucode-228.61.2.24$ lspci
00:00.0 PCI bridge: Device 16c3:abcd (rev 01)
01:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)
Configure Wifi. First create this file:
nano wpa.conf
and insert your Wifi information there (replace ssid and psk with your Wifi settings):
network={
	ssid="wifinetworkname"
        psk="wifipassword"
}
Note: My router settings are - WPA PSK, aes ccm, WPA pre-shared key Run:
wpa_supplicant -B -Dwext -iwlan0 -cwpa.conf
We will configure the card with static IP. Add IP (use IP from your network) and Route (update IP according your subnet):
ifconfig wlan0 192.168.110.120
route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.110.1
If the ping is not working, update DNS settings. Open:
sudo nano /etc/resolv.conf
and update nameserver to:
nameserver 8.8.8.8
Try to ping google:
root@ubuntu-imx6:~# ping www.google.com
PING www.google.com (62.197.198.227) 56(84) bytes of data.
64 bytes from cache.google.com (62.197.198.227): icmp_req=1 ttl=60 time=5.02 ms
64 bytes from cache.google.com (62.197.198.227): icmp_req=2 ttl=60 time=4.36 ms
64 bytes from cache.google.com (62.197.198.227): icmp_req=3 ttl=60 time=4.57 ms
This is how it should look when everything is configured properly:
ubuntu@ubuntu-imx6:~/iwlwifi-4965-ucode-228.61.2.24$ iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11abgn  ESSID:"s15as"
          Mode:Managed  Frequency:2.412 GHz  Access Point: D4:CA:6D:6B:64:57
          Bit Rate=65 Mb/s   Tx-Power=15 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=70/70  Signal level=-38 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:4684180  Invalid misc:2498   Missed beacon:0

ubuntu@ubuntu-imx6:~/iwlwifi-4965-ucode-228.61.2.24$ ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:13:e8:44:2b:51
          inet addr:192.168.110.120  Bcast:192.168.110.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2698546 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5038426 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:490905975 (490.9 MB)  TX bytes:3272449877 (3.2 GB)

ubuntu@ubuntu-imx6:~/iwlwifi-4965-ucode-228.61.2.24$
Disconnect the onboard ethernet and test network performance:
//start iperf server, on a local computer
fedevel@ubuntu:~$  iperf -s

//start iper client on the iMX6 Rex board
ubuntu@ubuntu-imx6:~$ sudo iperf -c 192.168.10.90 -t 60 -i 10
------------------------------------------------------------
Client connecting to 192.168.10.90, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.110.120 port 56353 connected with 192.168.10.90 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  57.9 MBytes  48.5 Mbits/sec
[  3] 10.0-20.0 sec  51.0 MBytes  42.8 Mbits/sec
[  3] 20.0-30.0 sec  58.1 MBytes  48.8 Mbits/sec
[  3] 30.0-40.0 sec  56.4 MBytes  47.3 Mbits/sec
[  3] 40.0-50.0 sec  53.6 MBytes  45.0 Mbits/sec
[  3] 50.0-60.0 sec  60.9 MBytes  51.1 Mbits/sec
[  3]  0.0-60.0 sec   338 MBytes  47.2 Mbits/sec
ubuntu@ubuntu-imx6:~$ 
and the other direction
//start iperf server on the iMX6 Rex board
# iperf -s

//start iperf client on a local computer
fedevel@fedevel-ubuntu:~/tmp/stressapptest-read-only$ iperf -c 192.168.110.120 -t 60 -i 10
------------------------------------------------------------
Client connecting to 192.168.110.120, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.10.90 port 38143 connected with 192.168.110.120 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  49.2 MBytes  41.3 Mbits/sec
[  3] 10.0-20.0 sec  48.1 MBytes  40.4 Mbits/sec
[  3] 20.0-30.0 sec  50.6 MBytes  42.5 Mbits/sec
[  3] 30.0-40.0 sec  49.5 MBytes  41.5 Mbits/sec
[  3] 40.0-50.0 sec  49.6 MBytes  41.6 Mbits/sec
[  3] 50.0-60.0 sec  50.3 MBytes  42.2 Mbits/sec
[  3]  0.0-60.1 sec    297 MBytes  41.5 Mbits/sec
fedevel@fedevel-ubuntu:~/tmp/stressapptest-read-only$

Add an UART port (USB to UART support)

Enable USB to UART driver in menuconfig:
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- menuconfig

Add a star to: make menuconfig -> Device Drivers -> USB Support -> USB Serial Converter Support
Add a star to: make menuconfig -> Device Drivers -> USB Support -> USB Serial Converter Support -> USB Prolific 2303 Single Port Serial Driver
*Note: For a different USB to serial port chip (e.g. FTDI), try to find it in the "make menuconfig -> Device Drivers -> USB Support -> USB Serial Converter Support ->" list Compile the new Kernel and run it. When fully booted up, plug in your USB to serial port device. We used STLAB "U-350 USB to Serial adapter 1 Port". Run "dmesg" and check what device was created (in our case "/dev/ttyUSB0"):
# dmesg | tail -f
usb 2-1: new full speed USB device number 3 using fsl-ehci
pl2303 2-1:1.0: pl2303 converter detected
usb 2-1: pl2303 converter now attached to ttyUSB0
Done. You can now access to the serial port - here is an example of running serial console on your new serial port:
picocom /dev/ttyUSB0 -b 115200

Check all the CPU clocks and frequencies

Use this script to check all the frequencies:
#!/bin/bash

if ! mount|grep -sq '/sys/kernel/debug'; then
	mount -t debugfs none /sys/kernel/debug
fi

saved_path=$PWD

printf "%-24s %-24s %3s %9s\n" "clock" "parent" "use" "rate"

for foo in $(find /sys/kernel/debug/clock -type d); do
    if [ "$foo" = '/sys/kernel/debug/clock' ]; then
        continue
    fi

    cd $foo

    use="$(cat usecount)"
    rate="$(cat rate)"

    clk="$(basename $foo)"
    cd ..
    parent="$(basename $PWD)"

    if [ "$parent" = 'clock' ]; then
        parent="   ---"
    fi

    printf "%-24s %-24s %2d %10d\n" "$clk" "$parent" "$use" "$rate"

    cd $saved_path
done
The result may look like this:
root@ubuntu-imx6:~# ./dump-clocks.sh
clock                    parent                   use      rate
ckih_clk                    ---                    0          0
ckih2_clk                   ---                    0          0
ckil_clk                    ---                    0      32768
caam_mem_clk                ---                    0          0
mlb150_clk                  ---                    0          0
anaclk_1                    ---                    0          0
anaclk_2                    ---                    0          0
osc_clk                     ---                    7   24000000
pll6_mlb150_main_clk     osc_clk                   0   24000000
pll7_usb_host_main_clk   osc_clk                   0  480000000
pll1_sys_main_clk        osc_clk                   1  996000000
pll1_sw_clk              pll1_sys_main_clk         1  996000000
cpu_clk                  pll1_sw_clk               1  996000000
twd_clk                  cpu_clk                   0  498000000
pll4_audio_main_clk      osc_clk                   0  175999998
asrc_clk                 pll4_audio_main_clk       0  175999998
gpt_clk                  osc_clk                   1    3000000
pll8_enet_main_clk       osc_clk                   2   24000000
enet_clk                 pll8_enet_main_clk        1   50000000
sata_clk                 pll8_enet_main_clk        1   24000000
clko2_clk                osc_clk                   1   24000000
pll3_usb_otg_main_clk    osc_clk                   4  480000000
pll3_pfd_720M            pll3_usb_otg_main_clk     0  720000000
pll3_pfd_508M            pll3_usb_otg_main_clk     0  508235294
ssi1_clk                 pll3_pfd_508M             0   63529411
ssi2_clk                 pll3_pfd_508M             0   63529411
ssi3_clk                 pll3_pfd_508M             0   63529411
pll3_pfd_454M            pll3_usb_otg_main_clk     0  454736842
spdif0_clk_0             pll3_pfd_454M             0   28421052
gpu2d_core_clk           pll3_usb_otg_main_clk     0  480000000
usb_phy1_clk             pll3_usb_otg_main_clk     1 1010065408
usb_phy3_clk             pll3_usb_otg_main_clk     0 1010065408
usb_phy4_clk             pll3_usb_otg_main_clk     0 1010065408
pll3_pfd_540M            pll3_usb_otg_main_clk     1  540000000
hdmi_isfr_clk            pll3_pfd_540M             1  540000000
mipi_pllref_clk          pll3_pfd_540M             0  540000000
pll3_sw_clk              pll3_usb_otg_main_clk     1  480000000
pll3_120M                pll3_sw_clk               0  120000000
esai_clk                 pll3_sw_clk               0   30000000
pll3_80M                 pll3_sw_clk               1   80000000
uart_clk                 pll3_80M                  1   80000000
ascan1_module_clk          can_clk_root              0   30000000
can2_module_clk          can_clk_root              0   30000000
ecspi0_clk               pll3_60M                  0   60000000
ecspi1_clk               pll3_60M                  0   60000000
ecspi2_clk               pll3_60M                  0   60000000
ecspi3_clk               pll3_60M                  0   60000000
ecspi4_clk               pll3_60M                  0   60000000
pll5_video_main_clk      osc_clk                   1  297000000
ipu1_di_clk_0            pll5_video_main_clk       0   99000000
ipu2_di_clk_1            pll5_video_main_clk       0   99000000
ipu1_di_clk_1            pll5_video_main_clk       1  148500000
ipu1_pixel_clk_1         ipu1_di_clk_1             1  148500000
pll2_528_bus_main_clk    osc_clk                   1  528000000
pll2_pfd_352M            pll2_528_bus_main_clk     0  452571428
ldb_di0_clk              pll2_pfd_352M             0   64653061
ipu2_di_clk_0            ldb_di0_clk               0   64653061
ldb_di1_clk              pll2_pfd_352M             0   64653061
pll2_pfd_594M            pll2_528_bus_main_clk     0  594000000
gpu3d_shader_clk         pll2_pfd_594M             0  594000000
pll2_pfd_400M            pll2_528_bus_main_clk     0  396000000
pll2_200M                pll2_pfd_400M             0  198000000
mmdc_ch1_axi_clk         pll2_pfd_400M             0  396000000
usdhc1_clk               pll2_pfd_400M             0  198000000
usdhc2_clk               pll2_pfd_400M             0  198000000
emi_clk                  pll2_pfd_400M             0  198000000
hsi_tx_clk               pll2_pfd_400M             0  198000000
enfc_clk                 pll2_pfd_400M             0   19800000
gpmi_io_clk              enfc_clk                  0   19800000
usdhc4_clk               pll2_pfd_400M             0  198000000
gpmi_bch_clk             usdhc4_clk                0  198000000
usdhc3_clk               pll2_pfd_400M             0  198000000
apbh_dma_clk             usdhc3_clk                0  198000000
rc_serial_clk          pll3_sw_clk               0    7500000
pll3_60M                 pll3_sw_clk               0   60000000
can_clk_root             pll3_60M                  0   30000000
can1_module_clk          can_clk_root              0   30000000
can2_module_clk          can_clk_root              0   30000000
ecspi0_clk               pll3_60M                  0   60000000
ecspi1_clk               pll3_60M                  0   60000000
ecspi2_clk               pll3_60M                  0   60000000
ecspi3_clk               pll3_60M                  0   60000000
ecspi4_clk               pll3_60M                  0   60000000
pll5_video_main_clk      osc_clk                   1  297000000
ipu1_di_clk_0            pll5_video_main_clk       0   99000000
ipu2_di_clk_1            pll5_video_main_clk       0   99000000
ipu1_di_clk_1            pll5_video_main_clk       1  148500000
ipu1_pixel_clk_1         ipu1_di_clk_1             1  148500000
pll2_528_bus_main_clk    osc_clk                   1  528000000
pll2_pfd_352M            pll2_528_bus_main_clk     0  452571428
ldb_di0_clk              pll2_pfd_352M             0   64653061
ipu2_di_clk_0            ldb_di0_clk               0   64653061
ldb_di1_clk              pll2_pfd_352M             0   64653061
pll2_pfd_594M            pll2_528_bus_main_clk     0  594000000
gpu3d_shader_clk         pll2_pfd_594M             0  594000000
pll2_pfd_400M            pll2_528_bus_main_clk     0  396000000
pll2_200M                pll2_pfd_400M             0  198000000
mmdc_ch1_axi_clk         pll2_pfd_400M             0  396000000
usdhc1_clk               pll2_pfd_400M             0  198000000
usdhc2_clk               pll2_pfd_400M             0  198000000
emi_clk                  pll2_pfd_400M             0  198000000
hsi_tx_clk               pll2_pfd_400M             0  198000000
enfc_clk                 pll2_pfd_400M             0   19800000
gpmi_io_clk              enfc_clk                  0   19800000
usdhc4_clk               pll2_pfd_400M             0  198000000
gpmi_bch_clk             usdhc4_clk                0  198000000
usdhc3_clk               pll2_pfd_400M             0  198000000
apbh_dma_clk             usdhc3_clk                0  198000000
gpmi_apb_clk             usdhc3_clk                0  198000000
gpmi_bch_apb_clk         usdhc3_clk                0  198000000
periph_clk               pll2_528_bus_main_clk     4  528000000
axi_clk                  periph_clk                1  264000000
gpu3d_axi_clk            axi_clk                   0  264000000
vpu_clk                  axi_clk                   0  264000000
emi_slow_clk             axi_clk                   0  132000000
gpu2d_axi_clk            axi_clk                   0  264000000
openvg_axi_clk           gpu2d_axi_clk             0  264000000
pcie_axi_clk             axi_clk                   0  264000000
pcie_clk                 pcie_axi_clk              0  264000000
pcie_ep_clk              pcie_axi_clk              0  264000000
vdo_axi_clk              axi_clk                   0  264000000
vdoa_clk                 vdo_axi_clk               0  264000000
ahb_clk                  periph_clk                6  132000000
sdma_clk                 ahb_clk                   0  132000000
mx6per1_clk              ahb_clk                   3  132000000
pl301_mx6qperl_bch       mx6per1_clk               0  132000000
ipg_clk                  ahb_clk                   5   66000000
spba_clk                 ipg_clk                   0   66000000
iim_clk                  ipg_clk                   1   66000000
ipg_perclk               ipg_clk                   1   22000000
i2c_clk_0                ipg_perclk                0   22000000
i2c_clk_1                ipg_perclk                0   22000000
i2c_clk_2                ipg_perclk                0   22000000
pwm_clk_0                ipg_perclk                1   22000000
pwm_clk_1                ipg_perclk                0   22000000
pwm_clk_2                ipg_perclk                0   22000000
pwm_clk_3                ipg_perclk                0   22000000
enet_mdc_clk             ipg_clk                   0   66000000
usboh3_clk               ahb_clk                   1  132000000
hdmi_iahb_clk            ahb_clk                   1  132000000
aips_tz2_clk             ahb_clk                   0  132000000
aips_tz1_clk             ahb_clk                   0  132000000
clko_clk                 ahb_clk                   1   16500000
mmdc_ch0_axi_clk         periph_clk                5  528000000
gpu3d_core_clk           mmdc_ch0_axi_clk          0  528000000
perfmon0_clk             mmdc_ch0_axi_clk          0  528000000
perfmon2_clk             mmdc_ch0_axi_clk          0  528000000
ipu1_clk                 mmdc_ch0_axi_clk          1  264000000
perfmon1_clk             ipu1_clk                  0  264000000
ipu1_pixel_clk_0         ipu1_clk                  0          0
ipu2_clk                 mmdc_ch0_axi_clk          0  264000000
ipu2_pixel_clk_0         ipu2_clk                  0          0
ipu2_pixel_clk_1         ipu2_clk                  0          0
root@ubuntu-imx6:~#
  • Ronaldo Nunez

    Thanks for this valuable examples!

    • http://www.fedevel.com Robert Feranec

      Thank you very much for leaving your feedback, so we see our work makes sense and helps others :)

  • Javier Marto

    thanks, really REALLY usefull!

    • http://www.fedevel.com Robert Feranec

      Thank you very much Javier :) Do you use a different iMX6 board or you have Rex?

      • Javier Marto

        Yeah, we are usign a sabre board from freescale as a development board in order to test some of the SW (we bougth the board a long time ago, before we know about the Rex), but usign a lot for references the imx6 Rex and the baseboard. Regards

        • http://www.fedevel.com Robert Feranec

          It’s very nice to see, that this website also helps users of Sabre SD. Thats why we created it (also we created it because we are HW developers and I keep forgetting some things from Linux and it would take me a long time to find them again, so we write everything down on our blog – so we can use it next time ;)

  • Ashwin Kirpalani

    what does it mean for duplicate rows in the output of dump_clocks.sh. For example, ipu_di_clk_0 has at least two entries. Another example is ecspi0_clk

  • kgdpewfn@520

    where can I buy your borad? I come from fujian

  • kgdpewfn@520

    where can I buy your board? I come from fujian, china

  • kgdpewfn@520

    I would like to ask a question,I can’nt find in the bottom of PCB file where to download?

    • http://www.fedevel.com Robert Feranec

      Please, can you clarify your question? All the files can be downloaded at Download section.

  • http://blog.melroy.org/ Melroy van den Berg

    This really helps me alot creating an open-source hardware board myself :D ! I really appreciate your time & work. As well as good open-source SOURCE project files from Altium. Woww. Finally someone get’s it.

    • http://www.fedevel.com Robert Feranec

      :) Thank you very much Melroy :)

  • Eduardo Borges

    Hello Robert, I need to put one full HD panel 1920×1080 to work with sabre kit.
    My LCD panel has 2 chanel LVDS. I dont have a clue of how to bring them together…

    • http://www.fedevel.com Robert Feranec

      Hello Eduardo. Try to search Freescale (NXP) forum. I usually find there what I need – or try to ask there. We are hardware guys … and I know exactly what you are talking about when you say “I do not have a clue …” :(

  • comme

    Hello,
    Is android driver/firmware available for HE910?

    thanks