wiki:gateworks_linux_test_commands

Gateworks Linux Example Test Commands

Following is a list of commands that are available in the BSP from Gateworks that can be used in order to test the functionality of the product. Users can use these commands to further the functionality of there application.

PCI

See also:

Find available devices on the PCI Bus

lspci -v

USB

Find available devices on the USB Bus

lsusb -v

RTC

Read Time from RTC

hwclock -r

Write current Time to RTC

hwclock -w

HWMON

Read Voltage

Different voltages can be read from the board, just change in0 to any of in0 - in12
The voltages read are current voltage * 1000

cat /sys/class/hwmon/hwmon0/device/in0_label
cat /sys/class/hwmon/hwmon0/device/in0_input

Read Temperature

The temp read is current temp * 10

cat /sys/class/hwmon/hwmon0/device/temp0_input

Set Fan Setpoint

The fan controller has 5 setpoints ranging from 50% on to 100% on, corresponding with fan0_point0 (50%) to fan0_poing5 (100%)

Read Current Setpoint

The setpoint read is current setpoint * 10

cat /sys/class/hwmon/hwmon0/device/fan0_point0

Write new Setpoint

Value to write is new temperatore * 10

echo 450 > /sys/class/hwmon/hwmon0/device/fan0_point0

GPIO

See also:

Read GPIO

See a list of currentl used GPIO's:

cat /sys/kernel/debug/gpio

Export A GPIO for user control

echo 8 > /sys/class/gpio/export # export gpio 8 which will get configured as an input

Set Direction of GPIO

echo out > /sys/class/gpio/gpio8/value # make gpio8 an output
echo in > /sys/class/gpio/gpio8/value # make gpio8 an input

Set Output of GPIO

echo 0 > /sys/class/gpio/gpio8/value # set gpio8 to logic low
echo 1 > /sys/class/gpio/gpio8/value # set gpio8 to logic high

Check GPIO

cat /sys/kernel/debug/gpio # see all gpio's
cat /sys/class/gpio/gpio8/value # see state of gpio8

I2C

See also:

Detect all available i2c devices

i2cdetect -f -y 0

Read i2c address

Where "x" is the device id, and "y" is the wanted address

i2cget -f -y 0 x y

Write i2c Address

Where "x" is the device id, and "y" is the wanted address to write and "z" is the value to write

i2cset -f -y 0 x y z

Kernel Modules

See also:

Find modules loaded by kernel

lsmod
Last modified 3 months ago Last modified on 02/27/2018 08:22:16 AM