How to access peripheral on Mercury and to use Ambedded Utility

From Ambedded
Revision as of 16:14, 9 January 2015 by Desmond (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The Mercury has 8 external GPIOs (4 for input ,the other for output),Ignition control ,can bus and to set VGA resolution .

IMX6 pins set in GPIO mode

On the Mercury the external GPIOs correspond to the following IMX6 pins

iMX6 GPIO (bank, number) sysfs name Notes
GPIO(3, 18) gpio82 In
GPIO(3, 19) gpio83 In
GPIO(3, 29) gpio84 In
GPIO(3, 24) gpio88 Out
GPIO(3, 25) gpio89 Out
GPIO(3, 27) gpio91 Out
GPIO(3, 28) gpio92 Out
GPIO(5, 7) gpio130 In

Accessing GPIOs from userspace

The external GPIOs should appear under the /sys/class/gpio folder in Linux sysfs.

The number of a GPIO is determined by (bank-1) * 32 + number, so for instance GPIO(3,18) is located in the folder gpio82.

To set the a GPIO to input mode, that is that the CPU is reading the value of the GPIO, one can do a

# echo in > /sys/class/gpio/gpio82/direction

After this, the file


contains the signal read (0 or 1).

To set a GPIO into output mode (that is the board provides the signal), do a :

# echo out > /sys/class/gpio/gpio92/direction

and then set the value high by

# echo 1 > /sys/class/gpio/gpio92/value

or low by

# echo 0 > /sys/class/gpio/gpio92/value.

GPIO driven interrupts

It is possible to have interrupts to occur when a GPIO goes high or low. This can be done for instance by using the GPIO key driver.

An overview/tutorial:

How to configure and use CAN bus

The Mercury provide one channel CAN bus,you can follow below step to use it.

Set the bit rate (default is 500000, maximum is 1000000)

ip link set can0 down
ip link set can0 up type can bitrate 500000

If you want to receive data ,you can do as below.

candump can0

And to send data.

cansend can0 -i<id> <data>


cansend can0 -i0x100 test

Ambedded Utility

The Mercury has utiilty preload on Ubuntu and Android.

  • Android

you can download this utility source code from this url: Ambedded android utility.png

  • Ubuntu

you can download this utility source code from this url: Ambedded ubuntu utility.png

Personal tools