Linux Peripheral Features

From ESS-WIKI
Revision as of 08:35, 11 August 2016 by Winston.huang (talk | contribs) (Backlight)
Jump to: navigation, search


ADC

analogue to digital converters

Backlight

The relevant files

/sys/class/graphics/fb0
/sys/devices/platform/mxc_sdc_fb.1/graphics/fb0
/sys/devices/platform/mxc_sdc_fb.1/graphics/fb0/power
/sys/devices/platform/mxc_sdc_fb.1
/sys/class/graphics
/sys/class/backlight
/sys/class/backlight/pwm-backlight.0

Turn off

echo 1 > /sys/class/backlight/pwm-backlight.0/bl_power

Turn on

echo 0 > /sys/class/backlight/pwm-backlight.0/bl_power

Control brightness

echo 0 > /sys/class/backlight/pwm-backlight.0/brightness echo 255 > /sys/class/backlight/pwm-backlight.0/brightness

Camera

Example

CAN Bus

Configuration/Testing

Configuration

  • Connect can0 and can1

<CAN1_D+> connect to <CAN2_D+>

<CAN1_D-> connect to <CAN2_D->

# ip link set can0 up type can bitrate 125000
# ip link set can1 up type can bitrate 125000

Testing

  • Test 1
# candump can1 &
# cansend can0 12345678#123412341234

The following shows the result

can1  12345678   [6]  12 34 12 34 12 34
  • Test 2
# cansend can0 133#ababdede

The following shows the result

can1       133   [4]  AB AB DE DE

CPU Frequency

Using available CPU frequency policies

Read CPU frequency

# cpufreq-info  | grep "current CPU frequency"
current CPU frequency is 396 MHz (asserted by call to hardware).
current CPU frequency is 396 MHz (asserted by call to hardware).
current CPU frequency is 396 MHz (asserted by call to hardware).
current CPU frequency is 396 MHz (asserted by call to hardware).

Check available CPU frequency policy

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave interactive performance

Change CPU frequency policy

# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Check CPU frequency

# cpufreq-info  | grep "current CPU frequency"
current CPU frequency is 996 MHz (asserted by call to hardware).
current CPU frequency is 996 MHz (asserted by call to hardware).
current CPU frequency is 996 MHz (asserted by call to hardware).
current CPU frequency is 996 MHz (asserted by call to hardware).
Setting the CPU frequency explicitly

Read available CPU frequenies

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
396000 792000 996000

Change CPU frequency explicitly

# echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# echo 792000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

Check CPU frequency

# cpufreq-info  | grep "current CPU frequency"
current CPU frequency is 792 MHz (asserted by call to hardware).
current CPU frequency is 792 MHz (asserted by call to hardware).
current CPU frequency is 792 MHz (asserted by call to hardware).
current CPU frequency is 792 MHz (asserted by call to hardware).

Ethernet

Example

Framebuffer

Example

GPIO

Example

I2C

Example

IR

To decode the infrared signals and provide an uniform interface

lircd -d /dev/lirc0

used parameters:

-d --device=device    read from given device
-u --uinput           generate Linux input events

Executes commands on an IR signal decoded by lircd,

irexec -d /devlirc0

Note: if show these message after running lircd

lircd: can't open or create /var/run/lirc/lircd.pid
lircd: No such file or directory

It has to add the "/var/run/lirc" folder

mkdir /var/run/lirc

How to debug:

1. To check that signals are decoded correctly

mode2 -d /dev/lirc0

It repeats to show "space" and "pulse" while clicking a control button

space 8451531
pulse 476

2. To check input events.

First, It must add the parameter,"-u", in lircd command

lircd -d /dev/lirc0 -u

It will register at inputX,

input: lircd as /devices/virtual/input/input1 

Run evtest to check events

evtest -d /dev/input/event1

One Wire

Example

RTC

Example

SATA

Example

SD/MMC

Example

SPI

Example

SPWG/JEDIA

Standard Panels Working Group (SPWG)

Japan Electronic Industry Development Association (JEIDA)

How to setting SPWG/JEIDA mode in RISC?

Modify Register GPR(IOMUXC_GPR2)value

Address : 0x020E0008(h)

BIT6 and BIT8 set "0" (SPWG)

BIT6 and BIT8 set "1" (JEIDA)

JEIDA1.png
JEIDA2.png

UART

Example

USB

Example

Watchdog

Example