Difference between revisions of "iMX6 Rex Basic Accessing and Testing Peripherals"

From Voipac Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:iMX6 Rex Development kit]]
+
[[Category:iMX6 Rex Development Kit]]
 
[[Category:iMX6 Rex Basic]]
 
[[Category:iMX6 Rex Basic]]
 
[[Category:iMX6 Rex Peripherals]]
 
[[Category:iMX6 Rex Peripherals]]
Line 5: Line 5:
 
<div style="float:right">__TOC__</div>
 
<div style="float:right">__TOC__</div>
  
Elemental operations of iMX6 Rex Development kit interfaces in Basic configuration are shown on this page.
+
Elemental operations of iMX6 Rex Development Kit interfaces in Basic configuration are shown on this page.
  
 
== Prerequisites ==
 
== Prerequisites ==
Line 89: Line 89:
 
== HDMI Output ==
 
== HDMI Output ==
 
'''''Input:''''' Connect LCD monitor to base board<br />
 
'''''Input:''''' Connect LCD monitor to base board<br />
'''''Output:''''' Desktop UI is correctly displayed<br />
+
'''''Output:''''' Desktop UI is displayed correctly <br />
[[image:iMX6_TinyRex_Development_kit-HDMI_terminal.jpg|600px]]
+
[[image:iMX6_TinyRex_Development_Kit-HDMI_terminal.png|580px]]
  
 
== I2C ==
 
== I2C ==
Line 142: Line 142:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
'''''Input:''''' Write and Read data from I2C EEPROM<br />
+
'''''Input:''''' Write and read data from I2C EEPROM<br />
 
'''''Output:''''' If successful, console text 'Data are the same' should appear
 
'''''Output:''''' If successful, console text 'Data are the same' should appear
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 152: Line 152:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Altarnative test ===
+
=== Alternative test ===
 
'''''Input:''''' List I2C bus 1<br />
 
'''''Input:''''' List I2C bus 1<br />
 
'''''Output:''''' Available devices are displayed
 
'''''Output:''''' Available devices are displayed
Line 236: Line 236:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
'''''Input:''''' Write and Read data from m25p80 flash<br />
+
'''''Input:''''' Write and read data from M25P80 flash<br />
 
'''''Output:''''' If successful, console text 'Data are the same' should appear
 
'''''Output:''''' If successful, console text 'Data are the same' should appear
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 291: Line 291:
 
'''''Output:''''' Driver is successfully loaded and host PC detects a new USB serial gadget device<br /><br />
 
'''''Output:''''' Driver is successfully loaded and host PC detects a new USB serial gadget device<br /><br />
  
iMX6 Rex Development kit:
+
iMX6 Rex Development Kit:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
root@imx6-rexbasic:~# modprobe -i g_serial
 
root@imx6-rexbasic:~# modprobe -i g_serial

Latest revision as of 10:43, 24 April 2022

Elemental operations of iMX6 Rex Development Kit interfaces in Basic configuration are shown on this page.

Prerequisites

Hardware

  • DC power supply (12V, 1A)
  • iMX6 Rex Module Basic
  • iMX6 Rex Base Board

Peripherals and Accessories

  • 1x FullHD monitor with Audio output
  • 1x MicroSD card
  • 2x USB FLASH drive

Cables

  • Ethernet cable
  • HDMI cable
  • Micro USB cable
  • RS-232 cable

User button

Input: Press and hold USER button (pca9535 driver is used)
Output: GPIO register is read and displayed state of the button

root@imx6-rexbasic:~# echo 511 > /sys/class/gpio/export
root@imx6-rexbasic:~# echo in > /sys/class/gpio/gpio511/direction
root@imx6-rexbasic:~# cat /sys/class/gpio/gpio511/value
1
root@imx6-rexbasic:~# cat /sys/class/gpio/gpio511/value
0

Reset button

Input: Press the RESET button
Output: Module will execute bootloader immediately with "Reset cause: POR"
Note: Module should never freeze or hang after the reset button was pressed. Testing the operation 10 times gives a reliable result

U-Boot 2014.10-dirty (Mar 12 2016 - 11:34:54)

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
Reset cause: POR
Board: MX6 Rex - basic
I2C:   ready
DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
Hit any key to stop autoboot:  0

Ethernet

Input: None
Output: Device driver is available
Note: MAC address should be identical with the address on the sticker placed on module

root@imx6-rexbasic:~# ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0d:15:00:cc:e2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::20d:15ff:fe00:cce2/64 scope link

Input: Plug Ethernet cable into connector and issue DHCP command
Output: IPv4 address is assigned

root@imx6-rexbasic:~# dmesg | tail
...
libphy: 2188000.ethernet:03 - Link is Up - 100/Full
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
root@imx6-rexbasic:~# udhcpc -i eth0
udhcpc (v1.22.1) started
Sending discover...
Sending select for 192.168.0.178...
Lease of 192.168.0.178 obtained, lease time 600

HDMI Output

Input: Connect LCD monitor to base board
Output: Desktop UI is displayed correctly
iMX6 TinyRex Development Kit-HDMI terminal.png

I2C

Input: Scan I2C bus 1
Output: Available devices:

  • GPIO expander (0x27)
  • touchscreen TSC2007 (0x48)
  • HDMI Output EDID (0x50)
  • RTC clock (0x51)
  • EEPROM (0x57)

Note: HDMI monitor must be disconnected otherwise I2C bus 1 scanning bus might freeze.

root@imx6-rexbasic:~# i2cdetect -y 1 
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
50: UU UU -- -- -- -- -- UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Input: Trigger I2C GPIO expander detection.
Output: GPIO expander is detected

root@imx6-rexbasic:~# echo -n "1-0027" > /sys/bus/i2c/drivers/pca953x/unbind
root@imx6-rexbasic:~# echo -n "1-0027" > /sys/bus/i2c/drivers/pca953x/bind
pca953x 1-0027: interrupt support not compiled in

Input: Trigger I2C RTC detection
Output: RTC is detected

root@imx6-rexbasic:~# echo -n "1-0051" > /sys/bus/i2c/drivers/rtc-pcf8563/unbind
root@imx6-rexbasic:~# echo -n "1-0051" > /sys/bus/i2c/drivers/rtc-pcf8563/bind
rtc-pcf8563 1-0051: chip found, driver version 0.4.3
rtc-pcf8563 1-0051: low voltage detected, date/time is not reliable.
rtc-pcf8563 1-0051: low voltage detected, date/time is not reliable.
rtc rtc1: invalid alarm value: 2030-10-20 41:58:0
rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc1

Input: Trigger I2C EEPROM detection
Output: I2C EEPROM is detected

root@imx6-rexbasic:~# echo -n "1-0057" > /sys/bus/i2c/drivers/at24/unbind
root@imx6-rexbasic:~# echo -n "1-0057" > /sys/bus/i2c/drivers/at24/bind 
at24 1-0057: 256 byte 24c02 EEPROM, writable, 1 bytes/write

Input: Write and read data from I2C EEPROM
Output: If successful, console text 'Data are the same' should appear

root@imx6-rexbasic:~# echo -n "0123" > eeprom_in
root@imx6-rexbasic:~# cat eeprom_in > /sys/bus/i2c/devices/1-0057/eeprom
root@imx6-rexbasic:~# head -c 4 /sys/bus/i2c/devices/1-0057/eeprom > eeprom_out
root@imx6-rexbasic:~# diff eeprom_in eeprom_out && echo "Data are the same"
Data are the same

Alternative test

Input: List I2C bus 1
Output: Available devices are displayed

root@imx6-rexbasic:~# ls /sys/bus/i2c/devices/i2c-1 | grep ^[1]
1-0048
1-0050

User LED

Input: None
Output: Red LED assembled on module switches from ON to OFF state with heartbeat pulses afterwards

root@imx6-rexbasic:~# echo -n "none" > /sys/devices/soc0/leds*/leds/module-led/trigger 
root@imx6-rexbasic:~# echo -n "1" > /sys/devices/soc0/leds*/leds/module-led/brightness
root@imx6-rexbasic:~# echo -n "0" > /sys/devices/soc0/leds*/leds/module-led/brightness
root@imx6-rexbasic:~# echo -n "heartbeat" >  /sys/devices/soc0/leds*/leds/module-led/trigger

Input: GPIO expander PCA9535 driver
Output: Red LED assembled on the base board switches from ON to OFF state

root@imx6-rexbasic:~# echo 510 > /sys/class/gpio/export
root@imx6-rexbasic:~# echo out > /sys/class/gpio/gpio510/direction
root@imx6-rexbasic:~# echo 1 > /sys/class/gpio/gpio510/value
root@imx6-rexbasic:~# echo 0 > /sys/class/gpio/gpio510/value

DDR memory

Input: None
Output: Memory test passes without any errors

root@imx6-rexbasic:~# memtester 2G 1   
memtester version 4.1.3 (32-bit)
Copyright (C) 2010 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 2048MB (2147483648 bytes)
got  267MB (280412160 bytes), trying mlock ...locked.
Loop 1/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         

Done.


Further information about DDR3 memories and its calibration can be accessed in Memory Calibration details.

SD card

Bottom slot SD card (mmcblk2)

Input: Plug SD card with a filesystem and boot-up the module
Output: Module boots up successfully

root@imx6-rexbasic:~# dmesg | grep -i "Kernel command line"
Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk2p2 rootwait rw

SPI Flash Memory

Input: Trigger M25P80 flash detection
Output: SPI Flash sst25vf016b(sst25vf032b) is detected

root@imx6-rexbasic:~# echo -n "spi2.0" > /sys/bus/spi/drivers/m25p80/unbind
root@imx6-rexbasic:~# echo -n "spi2.0" > /sys/bus/spi/drivers/m25p80/bind 
m25p80 spi2.0: found sst25vf032b, expected m25p32
m25p80 spi2.0: sst25vf032b (4096 Kbytes)

Input: Write and read data from M25P80 flash
Output: If successful, console text 'Data are the same' should appear

root@imx6-rexbasic:~# echo -n "0123" > mtd_in
root@imx6-rexbasic:~# mtd_debug write /dev/mtd0 0 4 mtd_in 
Copied 4 bytes from mtd_in to address 0x00000000 in flash
root@imx6-rexbasic:~# mtd_debug read /dev/mtd0 0 4 mtd_out
Copied 4 bytes from address 0x00000000 in flash to mtd_out
root@imx6-rexbasic:~# diff mtd_in mtd_out && echo "Data are the same"
Data are the same

UART serial console

Input: Connect RS-232 cable into the base board connector and open serial console with baud rate 115200 8n1
Output: The board is controlled and responsive to serial terminal commands

root@imx6-rexbasic:~# uname -a
Linux imx6-rexbasic 3.14.58-yocto+g11e5ba3 #1 SMP PREEMPT Sun Mar 13 20:20:31 CET 2016 armv7l GNU/Linux

USB

Input: Plug USB flash drive with single VFAT partition into the bottom USB connector
Output: Filesystem recognises the flash drive and automatically mounts it. SMC Hub with ID 0424:2514 is mounted

root@imx6-rexbasic:~# lsusb
Bus 001 Device 003: ID 1bc7:0021 Telit HE910
Bus 001 Device 005: ID 054c:0243 Sony Corp. MicroVault Flash Drive
Bus 001 Device 004: ID 0930:6544 Toshiba Corp. Kingston DataTraveler 2.0 Stick (2GB)
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@imx6-rexbasic:~# mount | grep /run/media/sd*
/dev/sda1 on /run/media/sda1 type vfat (rw,relatime,gid=6,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

Input: Generate a dummy file and copy it into USB flash drive
Output: Generated file and copied file have the same checksum

root@imx6-rexbasic:~# rm -f file.txt /run/media/sda1/file.txt 
root@imx6-rexbasic:~# dd if=/dev/urandom of=file.txt count=1024 bs=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.435456 s, 2.4 MB/s
root@imx6-rexbasic:~# cp file.txt /run/media/sda1/
root@imx6-rexbasic:~# md5sum file.txt /run/media/sda1/file.txt
33ef96efccbbf570bfce477735ed2068  file.txt
33ef96efccbbf570bfce477735ed2068  /run/media/sda1/file.txt
root@imx6-rexbasic:~# rm file.txt /run/media/sda1/file.txt

USB OTG

Input: Load USB serial gadget driver and connect base board to host PC over micro USB cable
Output: Driver is successfully loaded and host PC detects a new USB serial gadget device

iMX6 Rex Development Kit:

root@imx6-rexbasic:~# modprobe -i g_serial
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
root@imx6-rexbasic:~# g_serial gadget: high-speed config #2: CDC ACM config

Host PC:

user@voipac:~$ lsusb 
...
Bus 001 Device 014: ID 0525:a4a7 Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
...

Touchscreen

Input: Search kernel log for TSC2007 chip
Output: TSC2007 chip is detected and bound as an input device

root@imx6-rexbasic:~# dmesg | grep -i tsc2007
input: TSC2007 Touchscreen as /devices/soc0/soc.0/2100000.aips-bus/21a4000.i2c/i2c-1/1-0048/input/input0
evbug: Connected device: input0 (TSC2007 Touchscreen at 1-0048/input0)

Input: Press the touchscreen
Output: Touchscreen events are generated

root@imx6-rexbasic:~# evtest /dev/input/by-path/platform-21a4000.i2c-event 
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "TSC2007 Touchscreen"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value   3529
      Min        0
      Max     4095
    Event code 1 (ABS_Y)
      Value    375
      Min        0
      Max     4095
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max     4095
Properties:
Testing ... (interrupt to exit)
Event: time 1457899907.959665, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1457899907.959665, type 3 (EV_ABS), code 0 (ABS_X), value 1657
Event: time 1457899907.959665, type 3 (EV_ABS), code 1 (ABS_Y), value 2486
Event: time 1457899907.959665, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 3268
Event: time 1457899907.959665, -------------- EV_SYN ------------
Event: time 1457899907.969094, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1457899907.969094, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
Event: time 1457899907.969094, -------------- EV_SYN ------------

Alternative test

Input: Press the touchscreen
Output: Touchscreen events are generated

root@imx6-rexbasic:~# hexdump -C /dev/input/event0 
00000000  79 ca e5 56 cd a3 07 00  01 00 4a 01 01 00 00 00  |y..V......J.....|
00000010  79 ca e5 56 cd a3 07 00  03 00 00 00 2f 08 00 00  |y..V......../...|
00000020  79 ca e5 56 cd a3 07 00  03 00 01 00 a7 07 00 00  |y..V............|
00000030  79 ca e5 56 cd a3 07 00  03 00 18 00 64 06 00 00  |y..V........d...|
00000040  79 ca e5 56 cd a3 07 00  00 00 00 00 00 00 00 00  |y..V............|
00000050  79 ca e5 56 a7 c4 07 00  01 00 4a 01 00 00 00 00  |y..V......J.....|
00000060  79 ca e5 56 a7 c4 07 00  03 00 18 00 00 00 00 00  |y..V............|
00000070  79 ca e5 56 a7 c4 07 00  00 00 00 00 00 00 00 00  |y..V............|