COM iMX25 Linux: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Christoph (talk | contribs)
Christoph (talk | contribs)
Line 80: Line 80:


==<br/>How to control the GPIOs ==
==<br/>How to control the GPIOs ==
$ echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness
:{|class="wikitable" style="text-align: center; width: 400px"
|-
value range: 0..255
! DHCOM Name: !! Port: !! Pin: !! Linux GPIO #
|-
| GPIO A || 2 || 12 || 44
|-
| GPIO B || 3 || 21 || 85
|-
| GPIO C || 2 || 4 || 36
|-
| GPIO D || 2 || 5 || 37
|-
| GPIO E || 2 || 6 || 38
|-
| GPIO F || 2 || 7 || 39
|-
| GPIO G || 2 || 8 || 40
|-
| GPIO H || 2 || 9 || 41
|-
| GPIO K || 2 || 10 || 42
|}
 
:Export
:{| class="wikitable"
|<code>''echo <GPIO#> >/sys/class/gpio/export''</code>
|}
:Set direction
:{| class="wikitable"
|<code>''echo in >/sys/class/gpio/gpioXX/direction''</code>
|-
|<code>''echo out >/sys/class/gpio/gpioXX/direction''</code>
|}
:Set value
:{| class="wikitable"
|<code>''echo 0 >/sys/class/gpio/gpioXX/value''</code>
|-
|<code>''echo 1 >/sys/class/gpio/gpioXX/value''</code>
|}
:Get value
:{| class="wikitable"
|<code>''cat /sys/class/gpio/gpioXX/value''</code>
|}
 
:unexport
:{| class="wikitable"
|<code>''echo <GPIO#> >/sys/class/gpio/unexport''</code>
|}
 
==<br/>Debian system ==
==<br/>Debian system ==
=== Calibrating the touchscreen ===
=== Calibrating the touchscreen ===

Revision as of 15:20, 11 July 2012


FAQ


Linux virtual machine for development

Get the Virtual machine

Version: File: Changes:
v1.3 Debian Squeeze v1.3.zipx - Mono 2.10<br\>- mtd-utils<br\>- System updates
v1.2 Debian Squeeze v1.2.zipx - Emdebian Toolchain gcc 4.3 / g++ 4.3 (arm-linux-gnueabi-...)<br\>- TortoiseHg + TortoiseHg for Nautilus<br\>- Add Plugin "REST Client" in Iceweasel
v1.1 Debian Squeeze v1.1.zipx - Update Eclipse Indigo with CDT 8.0<br\>- Add demo project "crosshelloworld"
v1.0 Debian Squeeze.zipx - First Release<br\>- CodeSourcery Toolchain (arm-none-linux-gnueabi-...)<br\>- Eclipse Helios & Indigo

Setting up a Eclipse Cross Executable Project:

  • Use Eclipse Indigo (version 3.7.1) for your project.
  • Create a new C++ Project and choose as Executable Project type Cross-Compile Project and as Toolchains Cross GCC
  • Click the Button "Next" and specify under Tool command path the Toolchain path. For Codesourcery it is the folder "/opt/CodeSourcery/Sourcery_G++_Lite/bin". Under Prefix type "arm-none-linux-gnueabi-".


Building your own Kernel

Sources for the iMX25 Kernel:

How to build a kernel:

1. Start the Console on Linux
2. $ tar xfjv linux-2.6.38.tar.bz2 (in work_path)
3. $ cd /work_path/linux-2.6.38
4. $ patch -p1 <linux-2.6.38_DHCOM_iMX25.patch
5. $ cp .config /work_path/linux-2.6.38
6. $ ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage

The uImage file will you find in ../build-linux/arch/arm/boot


Update the kernel with U-Boot

You can update the linux kernel with U-Boot flash update.

1. Copy the "uImage" and "uImage.env" file onto a microSD card with a FAT file system (you can use the 1st partition on the microSD card)
2. Insert the microSD card and start the system
3. Go to the U-Boot console by pressing DEL on a RS232 terminal (during startup)
4. $ update linux


How to use/update our root file system

Login data for the Debian system
1. Format a microSD card like following (in linux e.g. you can use palimpsest) with "Master Boot Record" partition scheme
   P1 FAT  (Primary partition: 100MB)
   P2 ext3 (Primary partition: Residual space)
2. Untar the root file system to the ext3 partition of the microSD card (Don't copy the tar archive directly to the microSD card)
   Start the Console on Linux
   $ su
   $ chmod 755 /path/of/the/microSD_card
   $ cd /path/of/the/microSD_card
   $ tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2


How to control the display brightness

echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness
value range: 0..255


How to control the GPIOs

DHCOM Name: Port: Pin: Linux GPIO #
GPIO A 2 12 44
GPIO B 3 21 85
GPIO C 2 4 36
GPIO D 2 5 37
GPIO E 2 6 38
GPIO F 2 7 39
GPIO G 2 8 40
GPIO H 2 9 41
GPIO K 2 10 42
Export
echo <GPIO#> >/sys/class/gpio/export
Set direction
echo in >/sys/class/gpio/gpioXX/direction
echo out >/sys/class/gpio/gpioXX/direction
Set value
echo 0 >/sys/class/gpio/gpioXX/value
echo 1 >/sys/class/gpio/gpioXX/value
Get value
cat /sys/class/gpio/gpioXX/value
unexport
echo <GPIO#> >/sys/class/gpio/unexport


Debian system

Calibrating the touchscreen

$ TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Running example Qt Apps

$ QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws
For the Qt-Browser change demoname to browser

Login/Shutdown system

Login:
  Name:     root
  password: foo

Shutdown:
  $ shutdown -h now

Initialize and test CAN

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


Busybox system

Calibrating the touchscreen

$ TSLIB_TSDEVICE=/dev/event0 ts_calibrate

Running example Qt Apps

$ QWS_MOUSE_PROTO=Tslib:/dev/event0 /usr/qt/demos/demoname/demoname -qws
For the Qt-Browser change demoname to browser

Login/Shutdown system

Login:
  Name:     root
  password: n/a

Shutdown:
  $ halt