COM iMX6ULL Linux: Difference between revisions
(7 intermediate revisions by the same user not shown) | |||
Line 19: | Line 19: | ||
| | | | ||
1. Start the Console on Linux<br/> | 1. Start the Console on Linux<br/> | ||
2. <tt>''git clone https://github.com/dh-electronics/linux-imx6qdl.git --branch dev/4.19. | 2. <tt>''git clone https://github.com/dh-electronics/linux-imx6qdl.git --branch dev/4.19.135_dhsom''</tt><br/> | ||
3. <tt>''cd linux-imx6qdl''</tt> | 3. <tt>''cd linux-imx6qdl''</tt> | ||
|} | |} | ||
Line 30: | Line 30: | ||
7. <tt>''ARCH=arm CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- make zImage</tt> | 7. <tt>''ARCH=arm CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- make zImage</tt> | ||
|} | |} | ||
*The built <tt>imx6ull-dhcom-BOARD.dtb</tt> / <tt>imx6ull-dhcor-BOARD.dtb</tt> devicetree files are available in <tt>arch/arm/boot/dts</tt> | |||
*The built <tt>zImage</tt> kernel file will you find in <tt>arch/arm/boot</tt> | |||
|} | |} | ||
Line 99: | Line 101: | ||
== Kernel Userspace Interfaces to Access Hardware == | == Kernel Userspace Interfaces to Access Hardware == | ||
=== Ethernet Interfaces === | |||
:{| class="wikitable" style="width: 400px" | |||
||DHCOM ENET 1||<tt>ethsom0</tt> | |||
|- | |||
||DHCOM ENET 2||<tt>ethsom1</tt> | |||
|} | |||
=== Serial (UART) Interfaces === | === Serial (UART) Interfaces === | ||
Line 104: | Line 113: | ||
||DHCOM UART 1||<tt>/dev/ttymxc0</tt> | ||DHCOM UART 1||<tt>/dev/ttymxc0</tt> | ||
|- | |- | ||
||DHCOM UART 2 ||<tt>/dev/ttymxc1</tt> | ||DHCOM UART 2 <sup>[1]</sup>||<tt>/dev/ttymxc1</tt> | ||
|- | |- | ||
||DHCOM UART 3 ||<tt><n/a></tt> | ||DHCOM UART 3||<tt><n/a></tt> | ||
|} | |} | ||
:<sup>[1]</sup> If DHCOM UART2 is used for Bluetooth it is possible to have it on a modified module hardware on <tt>/dev/ttymxc5</tt> by losing GPIOs J/K/L/M. | |||
=== I2C Interfaces === | === I2C Interfaces === | ||
Line 143: | Line 153: | ||
:See which gpio is already used by the system | :See which gpio is already used by the system | ||
:{| class="wikitable" | :{| class="wikitable" | ||
|<tt>''cat /sys/kernel/debug/gpio | grep -v "gpio-... ( "''</tt> | |<tt>''cat /sys/kernel/debug/gpio | grep -v "gpio-... ( "''</tt> <br>or<br> <tt>''gpioinfo | grep -v unnamed''</tt> | ||
|} | |} | ||
:{|class="wikitable" style="text-align: center; width: | :{|class="wikitable" style="text-align: center; width: 1000px" | ||
|- | |- | ||
! DHCOM Name | ! DHCOM Name: !! alt. DHCOM Name: !! SO-DIMM Pin# !! CPU Pad Name !! Linux <GPIO#> * !! gpiod label (deprecated): !! gpiod label: | ||
|- | |- | ||
| GPIO | | GPIO A || || 154 || PAD_SNVS_TAMPER0 || 128 || A || DHCOM-A | ||
|- | |- | ||
| GPIO | | GPIO B || || 156 || PAD_SNVS_TAMPER1 || 129 || B || DHCOM-B | ||
|- | |- | ||
| GPIO | | GPIO C || || 162 || PAD_SNVS_TAMPER2 || 130 || C || DHCOM-C | ||
|- | |- | ||
| GPIO | | GPIO D || || 163 || PAD_SNVS_TAMPER3 || 131 || D || DHCOM-D | ||
|- | |- | ||
| GPIO | | GPIO E || || 164 || PAD_SNVS_TAMPER4 || 132 || E || DHCOM-E | ||
|- | |- | ||
| GPIO | | GPIO F || || 165 || PAD_SNVS_TAMPER7 || 135 || F || DHCOM-F | ||
|- | |- | ||
| GPIO | | GPIO G || || 167 || PAD_SNVS_TAMPER8 || 136 || G || DHCOM-G | ||
|- | |- | ||
| GPIO | | GPIO H || || 173 || PAD_SNVS_TAMPER9 || 137 || H || DHCOM-H | ||
|- | |- | ||
| GPIO | | GPIO I || || 175 || PAD_UART1_CTS_B || 18 || I || DHCOM-I | ||
|- | |- | ||
| GPIO | | GPIO J || CIF HSYNC || 74 || PAD_CSI_HSYNC || 116 || J || DHCOM-J | ||
|- | |- | ||
| GPIO | | GPIO K || CIF PCLK || 72 || PAD_CSI_PIXCLK || 114 || K || DHCOM-K | ||
|- | |- | ||
| GPIO | | GPIO L || CIF MCLK || 70 || PAD_CSI_MCLK || 113 || L || DHCOM-L | ||
|- | |- | ||
| GPIO | | GPIO M || CIF VSYNC || 68 || PAD_CSI_VSYNC || 115 || M || DHCOM-M | ||
|- | |- | ||
| GPIO | | GPIO N || CIF D9 || 66 || PAD_CSI_DATA07 || 124 || N || DHCOM-N | ||
|- | |- | ||
| GPIO | | GPIO O || CIF D8 || 64 || PAD_CSI_DATA06 || 123 || O || DHCOM-O | ||
|- | |- | ||
| GPIO | | GPIO P || CIF D7 || 62 || PAD_CSI_DATA05 || 122 || P || DHCOM-P | ||
|- | |- | ||
| GPIO | | GPIO Q || CIF D6 || 60 || PAD_CSI_DATA04 || 121 || Q || DHCOM-Q | ||
|- | |- | ||
| GPIO | | GPIO R || CIF D5 || 58 || PAD_CSI_DATA03 || 120 || R || DHCOM-R | ||
|- | |- | ||
| GPIO | | GPIO S || CIF D4 || 56 || PAD_CSI_DATA02 || 119 || S || DHCOM-S | ||
|- | |- | ||
| GPIO | | GPIO T || CIF D3 || 54 || PAD_CSI_DATA01 || 118 || T || DHCOM-T | ||
|- | |- | ||
| GPIO | | GPIO U || CIF D2 || 52 || PAD_CSI_DATA00 || 117 || U || DHCOM-U | ||
|- | |- | ||
| GPIO V | | GPIO V || CIF D1 || 50 || <n/a> || <n/a> || <n/a> || <n/a> | ||
|- | |- | ||
| GPIO W | | GPIO W || CIF D0 || 48 || <n/a> || <n/a> || <n/a> || <n/a> | ||
|- | |- | ||
| INT HIGHEST PRIORITY | | INT HIGHEST PRIORITY || || 151 || PAD_KEY_COL0|| 11 || INT || DHCOM-INT | ||
|} | |} | ||
:: * = Valid if you didn't change the CONFIG_ARCH_NR_GPIO value in kernel config '''AND''' if your kernel doesn't probe another GPIO controller before the imx6 GPIO controller | :: * = Valid if you didn't change the CONFIG_ARCH_NR_GPIO value in kernel config '''AND''' if your kernel doesn't probe another GPIO controller before the imx6 GPIO controller | ||
Line 241: | Line 251: | ||
|<tt>''gpioget $(gpiofind GPIO_LABEL)''</tt> | |<tt>''gpioget $(gpiofind GPIO_LABEL)''</tt> | ||
|} | |} | ||
:: '''Remark:''' GPIO_LABEL could be A, B, C, ... see table above | :: '''Remark:''' GPIO_LABEL could be DHCOM-A, DHCOM-B, DHCOM-C, ... see table above | ||
:'''Controlled by sysfs (since Kernel v4.8 deprecated)''' | :'''Controlled by sysfs (since Kernel v4.8 deprecated)''' |
Latest revision as of 10:52, 21 September 2021
Storage Layout
Linux virtual machine for development
- Please have a look at: Virtual Machine for Application Development
Linux Kernel
Sources: Look at page i.MX6ULL BSP Sources
How to build a Kernel
Get sources from Github
Configure and build the Device Tree + Kernel
|
Update the Kernel and Device Tree with U-Boot
- Please refere to the DHCOM Update Mechanism for i.MX6.
Update Kernel and Device Tree on a running Linux
Kernel
Device Tree
Reboot System
|
Make your own Device Tree for your board
- The recommended proceeding for making your our Device Tree should be the following:
- 1. Clone the DH Device Tree Board file and change it to fit for your board
imx6ull-dhcom-pdk2.dts --> imx6ull-dhcom-BOARDNAME.dts
- 2. Add your new main Device Tree file to
Makefile
(located in the same folder)
Debian Rootfilesystem
Available Rootfilesystems
- Please have a look at the iMX6ULL Images section.
Login
dhcom login: root
Password: foo
Reboot
# reboot
- or
# shutdown -r now
Shutdown
# poweroff
- or
# shutdown -h now
- Note: If the watchdog is active, the system will be reset.
Kernel Userspace Interfaces to Access Hardware
Ethernet Interfaces
DHCOM ENET 1 ethsom0 DHCOM ENET 2 ethsom1
Serial (UART) Interfaces
DHCOM UART 1 /dev/ttymxc0 DHCOM UART 2 [1] /dev/ttymxc1 DHCOM UART 3 <n/a>
- [1] If DHCOM UART2 is used for Bluetooth it is possible to have it on a modified module hardware on /dev/ttymxc5 by losing GPIOs J/K/L/M.
I2C Interfaces
DHCOM I2C 1 /dev/i2c-1 DHCOM I2C 2 /dev/i2c-0
SPI Interfaces
DHCOM SPI 1 /dev/spidev0.0 DHCOM SPI 2 [1] /dev/spidev1.0
- [1] DHCOM SPI2 is only available, if the second ethernet is not mounted.
MMC/SD/eMMC Interfaces
DHCOM SD-Interface /dev/mmcblk1pX on module µSD Card on module eMMC /dev/mmcblk2pX
- 'X' has to be replaced with the partition number
Control the display brightness
- Coming soon
Control GPIOs
- See which gpio is already used by the system
cat /sys/kernel/debug/gpio | grep -v "gpio-... ( "
or
gpioinfo | grep -v unnamed
DHCOM Name: alt. DHCOM Name: SO-DIMM Pin# CPU Pad Name Linux <GPIO#> * gpiod label (deprecated): gpiod label: GPIO A 154 PAD_SNVS_TAMPER0 128 A DHCOM-A GPIO B 156 PAD_SNVS_TAMPER1 129 B DHCOM-B GPIO C 162 PAD_SNVS_TAMPER2 130 C DHCOM-C GPIO D 163 PAD_SNVS_TAMPER3 131 D DHCOM-D GPIO E 164 PAD_SNVS_TAMPER4 132 E DHCOM-E GPIO F 165 PAD_SNVS_TAMPER7 135 F DHCOM-F GPIO G 167 PAD_SNVS_TAMPER8 136 G DHCOM-G GPIO H 173 PAD_SNVS_TAMPER9 137 H DHCOM-H GPIO I 175 PAD_UART1_CTS_B 18 I DHCOM-I GPIO J CIF HSYNC 74 PAD_CSI_HSYNC 116 J DHCOM-J GPIO K CIF PCLK 72 PAD_CSI_PIXCLK 114 K DHCOM-K GPIO L CIF MCLK 70 PAD_CSI_MCLK 113 L DHCOM-L GPIO M CIF VSYNC 68 PAD_CSI_VSYNC 115 M DHCOM-M GPIO N CIF D9 66 PAD_CSI_DATA07 124 N DHCOM-N GPIO O CIF D8 64 PAD_CSI_DATA06 123 O DHCOM-O GPIO P CIF D7 62 PAD_CSI_DATA05 122 P DHCOM-P GPIO Q CIF D6 60 PAD_CSI_DATA04 121 Q DHCOM-Q GPIO R CIF D5 58 PAD_CSI_DATA03 120 R DHCOM-R GPIO S CIF D4 56 PAD_CSI_DATA02 119 S DHCOM-S GPIO T CIF D3 54 PAD_CSI_DATA01 118 T DHCOM-T GPIO U CIF D2 52 PAD_CSI_DATA00 117 U DHCOM-U GPIO V CIF D1 50 <n/a> <n/a> <n/a> <n/a> GPIO W CIF D0 48 <n/a> <n/a> <n/a> <n/a> INT HIGHEST PRIORITY 151 PAD_KEY_COL0 11 INT DHCOM-INT
- * = Valid if you didn't change the CONFIG_ARCH_NR_GPIO value in kernel config AND if your kernel doesn't probe another GPIO controller before the imx6 GPIO controller
- Remark: Depending on your board configuration some of the additional gpios shared with the camera interface are not available on your system.
- GPIO pin configuration
- The default Linux Device Tree pin configurarion of the DHCOM GPIOs A - W is
0x400120b0
- The default Linux Device Tree pin configurarion of the DHCOM GPIOs A - W is
Pad Mux Register (0x020E_xxxx) = 0x0000_0015 SION: 1 Enabled (Force input path of pad) MUX_MODE: 0101 ALT5 Pad Control Register (0x020E_xxxx) = 0x0001_20B0 HYS: 1 Hysteresis enabled (Schmitt trigger input) ============== PUS: 00 100k Pull Down PUE: 1 PULL (Pull enabled) PKE: 0 Disable (Pull/Keeper disabled) ODE: 0 Disable (Output is CMOS) RESERVED: 000 -------------- SPEED: 10 imx6: 100MHz (medium) imx6ull: 100MHz (medium) DSE: 110 Drive strength imx6: 40 Ohm imx6ull: 43 Ohm @ 3.3V RESERVED 00 SRE: 0 SLOW (Slow Slew Rate)
- Controlled by gpiod tools (need Kernel v4.7 or higher)
- Set state
gpioset $(gpiofind GPIO_LABEL)=0 gpioset $(gpiofind GPIO_LABEL)=1
- Get state
gpioget $(gpiofind GPIO_LABEL) gpioget $(gpiofind GPIO_LABEL)
- Remark: GPIO_LABEL could be DHCOM-A, DHCOM-B, DHCOM-C, ... see table above
- Controlled by sysfs (since Kernel v4.8 deprecated)
- Export
echo <GPIO#> >/sys/class/gpio/export
- Remark: Have a look into /sys/class/gpio/ for already configured gpios.
- Set direction
echo in >/sys/class/gpio/gpio<GPIO#>/direction echo out >/sys/class/gpio/gpio<GPIO#>/direction
- Set state
echo 0 >/sys/class/gpio/gpio<GPIO#>/value echo 1 >/sys/class/gpio/gpio<GPIO#>/value
Initialize and Test CAN Interface
- Initialize:
ip link set can0 up type can bitrate 500000
- Send test message via cansend (part of can-utils):
cansend can0 100#11.2233.44556677.88
- Receive can messages (part of can-utils):
candump can0
- Get can-utils:
apt-get install can-utils
Parallel Address- / Databus
- To use the 16-bit address / databus from Linux userspace you can use the UIO driver interface. To enable and configure the interface it is necessary to setup the WEIM controller with the device tree. See the documentation of the device tree bindings of weim here.
- Here is an example code which demonstrates how to do enable and configure the WEIM interface (parallel address- / databus):
&weim { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_dhcom_weim &pinctrl_dhcom_weim_cs0 &pinctrl_dhcom_weim_cs1>; #address-cells = <2>; #size-cells = <1>; /* it is necessary to setup 2x 64MB otherwise setting gpr fails */ ranges = <0 0 0x08000000 0x04000000>, // Chip select 0 == DHCOM CS A <1 0 0x0c000000 0x04000000>; // Chip select 1 == DHCOM CS B fsl,weim-cs-gpr = <&gpr>; status = "okay"; uiomap_cs0@0,0 { compatible = "generic-uio"; reg = <0 0x00000000 0x04000000>; reg-names = "uio_cs0"; interrupt-parent = <&gpio1>; interrupts = <2 2>; // Add gpio A == interrupt #address-cells = <1>; #size-cells = <1>; fsl,weim-cs-timing = <0x00610089 0x00001002 0x0F011061 0x00000000 0x0F068A31 0x00000000>; status = "okay"; }; uiomap_cs1@0,1 { compatible = "generic-uio"; reg = <1 0x00000000 0x04000000>; reg-names = "uio_cs1"; interrupt-parent = <&gpio1>; interrupts = <4 2>; // Add gpio B == interrupt #address-cells = <1>; #size-cells = <1>; fsl,weim-cs-timing = <0x00610089 0x00001002 0x0F011061 0x00000000 0x0F068A31 0x00000000>; status = "disabled"; }; };
- To use the generic uio driver it has to be enabled in the kernel configuration (
make menuconfig
)- Device Drivers -> Userspace I/O Drivers -> Userspace I/O platform driver with generic IRQ handling
- The device-tree of_id of the uio driver has to be set via kernel command line
- Add "optargs='uio_pdrv_genirq.of_id=generic-uio'" to uLinuxEnv.txt
- Example for a UIO userspace driver:
- uio_access.cpp
- for further information have a look at the paper Userspace I/O drivers in a realtime context
Configure your own display
- Coming soon