COM AM335x Linux: Difference between revisions
Created page with "== Linux virtual machine for development == * Please have a look at: '''Virtual Machine for Application Development''' ==Building your own Kernel == ==== Sources for the DH..." |
|||
Line 29: | Line 29: | ||
|} | |} | ||
* Your new <tt>zImage</tt> file is available in <tt>../build/arch/arm/boot</tt> | * Your new <tt>zImage</tt> file is available in <tt>../build/arch/arm/boot</tt> | ||
* The Devicetree <tt>am335x-dheva01.dtb</tt> | * The Devicetree file <tt>am335x-dheva01.dtb</tt> is available in <tt>../build/arch/arm/boot/dts</tt> | ||
==Update the kernel with U-Boot == | ==Update the kernel with U-Boot == |
Revision as of 12:15, 22 March 2016
Linux virtual machine for development
- Please have a look at: Virtual Machine for Application Development
Building your own Kernel
Sources for the DHCOM AM335x Linux Kernel v4.1.x
- The latest Linux Kernel source code is available on GitHub: https://github.com/dh-electronics/linux-am33x
How to build a kernel
Get sources from Github and build the linux kernel using 5 threads and a build directory
1. Start a terminal on Linux |
2. # git clone https://github.com/dh-electronics/linux-am33x.git |
3. # mkdir build |
4. # cd linux-am33x |
5. # git checkout release/20160219 # checkout latest/required release branch |
6. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make O=../build/ am335x_dhcom_defconfig |
7. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make O=../build/ menuconfig (optional: If you want to add/remove Kernel features) |
8. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make -j5 O=../build/ zImage |
9. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make -j5 O=../build/ dtbs |
- Your new zImage file is available in ../build/arch/arm/boot
- The Devicetree file am335x-dheva01.dtb is available in ../build/arch/arm/boot/dts
Update the kernel with U-Boot
Please refere to the DHCOM Update Mechanism for i.MX6.
Update the kernel in running Linux
1. Copy the kernel zImage file to the path /boot |
Debian Rootfilesystem
Available Rootfilesystems
Please have a look at the iMX6 Downloads section.
External Documentation
- The Debian Administrator's Handbook: A reference book presenting the Debian distribution, from initial installation to configuration of services. The administration and configuration chapters apply to our Debian based root filesystems.
- Debian Documentation
Login
Debian GNU/Linux 8 dhcom ttymxc0 dhcom login: root |
Shutdown
# shutdown -h now |
Calibrating the touchscreen (only on Debian 6.0)
# ts_calibrate |
- Check the enviroment variable "TSLIB_TSDEVICE=/dev/input/event0" with printenv if an error occurs.
How to create a microSD-card with a rootfilesystem on it
1. Format a microSD card like following (in linux e.g. gparted, palimpsest) with Master Boot Record partition scheme
P1 ext3, name="boot" (Primary partition: 100MiB) |
2. Untar the root file system to the "rootfs" partition of the microSD card (Don't copy the tar archive directly to the microSD card)
Start the Console on Linux |
Remark: If you got a *.tar.gz file so type tar xfzv ... to extract the rootfilesystem.
Kernel Userspace Interfaces to Access Hardware
Serial (UART) Interfaces
DHCOM (FF) UART 1 /dev/ttymxc0
DHCOM (BT) UART 2 /dev/ttymxc4
DHCOM (STD) UART 3 /dev/ttymxc3
I2C Interfaces
- dhcom3B = Hardware revision 300
DHCOM I2C 1 /dev/i2c-1
DHCOM I2C 2 /dev/i2c-0
On Module Devices /dev/i2c-2
- old: dhcom2B = Hardware revision 200
DHCOM I2C 1 /dev/i2c-0
DHCOM I2C 2 /dev/i2c-1
On Module Devices /dev/i2c-2
SPI Interfaces
DHCOM SPI 1 /dev/spidev0.2
DHCOM SPI 2 /dev/spidev1.0
- Remark: DHCOM SPI1 interface doesn‘t work with DHCOM Premium Developer Kit (HD00013).
- Reason: At DHCOM Premium Developer Kit SPI 1 isn‘t connected, because otherwise i.MX6 doesn‘t boot with the current schematic.
MMC/SD/eMMC Interfaces
DHCOM SD-Interface /dev/mmcblk0pX
on module µSD Card /dev/mmcblk1pX
on module eMMC /dev/mmcblk2pX
- 'X' has to be replaced with the partition number
Control the display brightness
- Coming soon
Control GPIOs
DHCOM Name: alt. DHCOM Name: SO-DIMM Pin# Linux <GPIO#> GPIO A 154 2 GPIO B 156 4 GPIO C 162 5 GPIO D 163 163 GPIO E 164 101 GPIO F 165 116 GPIO G 167 91 GPIO H 173 103 GPIO I 175 104 CIF HSYNC GPIO J 74 174 CIF PCLK GPIO K 72 175 CIF MCLK GPIO L 70 105 CIF VSYNC GPIO M 68 192 CIF D9 GPIO N 66 193 CIF D8 GPIO O 64 149 CIF D7 GPIO P 62 205 CIF D6 GPIO Q 60 18 CIF D5 GPIO R 58 16 CIF D4 GPIO S 56 17 CIF D3 GPIO T 54 19 CIF D2 GPIO U 52 20 CIF D1 GPIO V 50 146 CIF D0 GPIO W 48 147
- Remark: Depending on your board configuration some of the additional gpios shared with the camera interface are not available on your system.
- Export
echo <GPIO#> >/sys/class/gpio/export
- Remark: Have a look into
/sys/class/gpio/
for already configured gpios.
- Remark: Have a look into
- 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:
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 i.MX6 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"; }; };
- We have already written some demo code at /arch/arm/boot/dts/imx6qdl-dhcom_cfg-weim.dtsi. It is easy to enable in the matching device-tree file:
- // #include "imx6qdl-dhcom_cfg-weim.dtsi + #include "imx6qdl-dhcom_cfg-weim.dtsi
- 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
- To configure your own display you have to do the following steps:
- 1. Type in the display values into the device tree file
/arch/arm/boot/dts/imx6qdl-dheva01.dtsi
- Where in the file?
Parallel display: display@di0
LVDS display: &ldb
Remarks: If you don't want to use both interfaces comment the unwanted out! The frame buffer resolution depends on the higher display resolution of both displays
- How?
- Here is an example:
display-timings { DataImage_7inch_FG0700G3DSSW { clock-frequency = <33260000>; hactive = <800>; vactive = <480>; hback-porch = <86>; hfront-porch = <42>; vback-porch = <33>; vfront-porch = <10>; hsync-len = <128>; vsync-len = <2>; hsync-active = <0>; vsync-active = <0>; de-active = <1>; pixelclk-active = <1>; }; };
- 2. Build the device tree dtb files
ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make dtbs
- 3. Copy the dtb files onto your boot partition
/dtbs
(SD, µSD or eMMC) - The built
imx6xx-dheva01.dtb
device tree files will you find inarch/arm/boot/dts