How to access peripheral on Mercury and to use Ambedded Utility
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|
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: http://bec-systems.com/site/281/how-to-implement-an-interrupt-driven-gpio-input-in-linux
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.
And to send data.
cansend can0 -i<id> <data>
cansend can0 -i0x100 test
The Mercury has utiilty preload on Ubuntu and Android.
you can download this utility source code from this url: ftp://your_account:firstname.lastname@example.org/mercury/android/src.tar.gz
you can download this utility source code from this url: ftp://your_account:email@example.com/mercury/ubuntu/utilGUI.py