Spi; I2C - GARZ&FRICKE GUF-Yocto-34.0-r5756-0-VINCELL User Manual

Embedded computer systems
Table of Contents

Advertisement

GUF-Yocto-34.0-r5756-0
root@vincell:~# hwclock --show
Fri Jun
1 14:51:12 UTC 2012
The RTC time cannot be adjusted directly in one command because only the current system time can be trans-
ferred to the RTC. Thus, the system time has to be set first, using the
the RTC:
root@vincell:~# date -s "2010-09-09 16:50:00"
Thu Sep
9 16:50:00 CEST 2010
root@vincell:~# hwclock --systohc

6.5 SPI

There are two ways of controlling SPI bus devices from a Linux system:
Writing a kernel SPI device driver and accessing this driver from user space by using its interface.
Accessing the SPI bus via the Linux kernel's
Describing the process of writing a Linux SPI device driver is out of the scope of this manual. The AT25 SPI
eemprom can serve as a good and simple example for such a driver. It is located in the kernel directory under:
drivers/misc/eeprom/at25.c
The interface provided to the user space by such a kernel driver depends of the sort of this driver (e.g. character
misc driver, input subsystem device driver, etc.). A very common usecase for an SPI driver is a touchscreen
driver that uses the input event subsystem.
Accessing the SPI bus from userspace directly via spidev is described in the Linux kernel documentation and
available in the kernel directory under:
Documentation/spi/spidev
Additionally, there is an example C program available in the same location:
Documentation/spi/spidev_test.c
The header for spidev is available under:
include/linux/spi/spidev.h
Note: If spidev is used to access the SPI bus directly, the user is responible for keeping the interoper-
ability consistent with all other SPI devices that are controlled by the Linux kernel.

6.6 I2C

There are two ways of controlling I2C bus devices from a Linux system:
Writing a kernel I2C device driver and accessing this driver from user space by using its interface.
Accessing the I2C bus via the Linux kernel's
Describing the process of writing a Linux I2C device driver is out of this scope of this manual. The AT24 I2C
eemprom can serve as a good and simple example for such a driver. It is located in the kernel directory under:
drivers/misc/eeprom/at24.c
The interface provided to the user space by such a kernel driver depends of the sort of this driver (e.g. character
misc driver, input subsystem device driver, etc.). A very common usecase for an I2C driver is a touchscreen driver
that uses the input event subsystem.
Accessing the I2C bus from userspace directly via spidev is described in the Linux kernel documentation and
avauilable inside the kernel directory under:
Documentation/i2c/dev-interface
28
VINCELL
User Manual
¡
¡
spidev
i2c-dev
date
command, and can then be written to
API directly.
API directly.

Advertisement

Table of Contents
loading

Table of Contents