appendix a1(2)

7
55 Appendix-A: Published and Communicated Papers A.1 Published and Presented Research Paper A.1.1 BUILDING & CUSTOMIZATION OF A KERNEL MODULE FOR TFT LCD DISPLAY FOR RASPBERRY PI Nishtha Arora Sanjay Kumar Dr. S. R. N. Reddy M.Tech (M.P.C.) Research Associate Associate Professor CSE-Dept., IGDTUW CSE-Dept., IGDTUW CSE-Dept., IGDTUW [email protected] [email protected] [email protected] Abstract- Raspberry Pi is a low cost single-board credit-card sized micro-computer. TFT interfacing with Raspberry Pi provides an easy-to-use interface for many applications like games for students, smart mobile device, office assistance and medium for various other applications. For interfacing with Raspberry Pi, various open source kernel modules are found and can be used. But interfacing of TFT LCD with Raspberry Pi requires kernel module which is not freely available with Raspberry Pi A or B or B+ model. This paper discusses about TFT LCD and building and customization of kernel module from Linux source code for TFT LCD. This paper also demonstrates an application running on the display provided by the customized kernel. Keywords- Raspberry Pi, touch screen, kernel source code. INTRODUCTION Raspberry Pi, a credit card size micro- computer, a System on chip which is an efficient computing platform for learning and building projects. It is an inexpensive computer developed in Laboratory of University of Cambridge and released by Raspberry Pi foundation in 2012 [1]. It has 700 MHz ARM 11 co-processor with Broadcom video Core IV graphics, 512 MB RAM on model B, and 256 MB on model A. It offers compatibility and interface for displays such as HDMI, TFT LCD (thin-film- transistor liquid-crystal display) etc. Figure 1: Raspberry Pi Model B, with SD card Touch screens are of various types are resistive, surface acoustic wave, capacitive, infrared, strain gauge, optical imaging, dispersive signal technology and acoustic pulse recognition [9]. Touch screen are an added advantage to not only for just an easy interface but also for making own smart phone, playing games, HD display, as an office assistance, portable kiosk etc. Building applications using

Upload: raman-kapoor

Post on 05-Sep-2015

217 views

Category:

Documents


5 download

DESCRIPTION

ds;lfka s;ldfkl;as kf'asdk f;ksad;fk ;laskf;l kaqieroi wqe[ri powqei rwqirqiw r iwqeri pwqoei rupoqweirpqwerqwerwqer qwerqwe rqw3r wqesdafj kas'kdf aksdf'ka;sk df;lsdakf;l aks;ldf ksa;lk f;lskad;lf kqwer qwe[irqwei poiwqeop iqwpor iwpo ipowe ipow ier

TRANSCRIPT

  • 55

    Appendix-A: Published and Communicated Papers

    A.1 Published and Presented Research Paper

    A.1.1 BUILDING & CUSTOMIZATION OF A KERNEL MODULE FOR TFT LCD

    DISPLAY FOR RASPBERRY PI

    Nishtha Arora Sanjay Kumar Dr. S. R. N. Reddy

    M.Tech (M.P.C.) Research Associate Associate Professor

    CSE-Dept., IGDTUW CSE-Dept., IGDTUW CSE-Dept., IGDTUW

    [email protected] [email protected] [email protected]

    Abstract- Raspberry Pi is a low cost single-board credit-card sized micro-computer. TFT

    interfacing with Raspberry Pi provides an easy-to-use interface for many applications like games

    for students, smart mobile device, office assistance and medium for various other applications.

    For interfacing with Raspberry Pi, various open source kernel modules are found and can be used.

    But interfacing of TFT LCD with Raspberry Pi requires kernel module which is not freely available

    with Raspberry Pi A or B or B+ model. This paper discusses about TFT LCD and building and

    customization of kernel module from Linux source code for TFT LCD. This paper also

    demonstrates an application running on the display provided by the customized kernel.

    Keywords- Raspberry Pi, touch screen, kernel source code.

    INTRODUCTION

    Raspberry Pi, a credit card size micro-

    computer, a System on chip which is an

    efficient computing platform for learning and

    building projects. It is an inexpensive

    computer developed in Laboratory of

    University of Cambridge and released by

    Raspberry Pi foundation in 2012 [1]. It has

    700 MHz ARM 11 co-processor with

    Broadcom video Core IV graphics, 512 MB

    RAM on model B, and 256 MB on model A.

    It offers compatibility and interface for

    displays such as HDMI, TFT LCD (thin-film-

    transistor liquid-crystal display) etc.

    Figure 1: Raspberry Pi Model B, with SD card

    Touch screens are of various types are

    resistive, surface acoustic wave, capacitive,

    infrared, strain gauge, optical imaging,

    dispersive signal technology and acoustic

    pulse recognition [9].

    Touch screen are an added advantage to not

    only for just an easy interface but also for

    making own smart phone, playing games,

    HD display, as an office assistance, portable

    kiosk etc. Building applications using

  • 56

    portable TFT LCD display is not easy since

    most displays are expensive and at comes

    with non-customizable kernel module. This

    limits the scope and features of the TFT LCD

    displays as may be required by the

    application. TFT LCD Display kernel

    module for interfacing with Raspberry Pi

    models is not freely available.

    Figure 2: 3.2 Crazy Pi TFT LCD Display for Raspberry Pi

    The display used for the project is 3.2 inch CrazyPi TFT LCD display for Raspberry Pi.

    Basic controller used in this TFT is XPT 2046

    [4]. The TFT Touch screen display used for

    the project is 5-wire resistive touch display.

    Details about the TFT are given in later

    sections.

    Device drivers are that piece of code which

    maps the standardized system calls by user

    applications to the specific operations on

    hardware [6]. In other words, they make a

    particular hardware respond to a well-defined

    internal programming interface, completely

    hiding the details of its working. Figure 3

    shows the interaction between hardware and

    user applications via specific device drivers.

    Figure 3: Interaction between user applications and

    hardware via device drivers

    Kernel modules can be divided into two

    categories Static and Dynamic/LKM

    (Loadable Kernel Modules). Linux kernel

    modules can be added to the Base kernel

    module, while, Base kernel module is

    compiled and loaded along with basic device

    drivers as a single entity [5].

    The kernel module discussed in this paper is

    of LKM type, which can be modified and

    loaded as and when required and no need for

    system reboot.

    Kernel modules can be divided into two

    categories Static and Dynamic/LKM

    (Loadable Kernel Modules). Linux kernel

    modules can be added to the Base kernel

    module, while, Base kernel module is

    compiled and loaded along with basic device

    drivers as a single entity [5].

    The kernel module discussed in this paper is

    of LKM type, which can be modified and

    loaded as and when required and no need for

    system reboot.

    Basic steps for loading and using LKM

    includes [5]:

    Say, application abc requires abc LKM module for its functioning. This module is

    loaded into kernel RAM using insmod

    command. abc user application access the required hardware by sending system calls

    which are addressed by the abc kernel module loaded in RAM memory. When the

    module is no longer needed, it can be

    removed for efficient utilization of memory

    using rmmod command. Apart from insmod

    and rmmod command, modprobe command

    can also be used, it has slightly different

    functionality.

  • 57

    I. HARDWARE DESCRIPTION

    Hardware components used for the project

    are:

    a. Raspberry Pi

    Raspberry Pi, a micro-computer is capable of

    performing various day-to day tasks such as

    office assistance, smart device, educational

    learning etc. Various functionalities of its

    various components are given below [1] [2]:

    SD Card Slot is used to store OS, long term

    storage. SD card memory of about 8 GB or

    above is good enough. Miro-USB power port

    provides 700 ma at 5A. RCA video output

    port is used for audio/ video signals in

    absence of HDMI output. Ethernet Port for

    connecting to internet via LAN connection. It

    is required for installation and updating the

    packages required, new software etc. HDMI

    OUT for accessing HDMI monitors.

    BROADCOM BCM 2835 SoC for Raspberry

    Pi is 700 MHz processor. GPU used is Video

    core IV. GPIO used for interconnection and

    interfacing with other hardware like sensors,

    TFT LCD Display, LEDs etc.

    b. CrazyPi TFT LCD Display module

    for Raspberry Pi

    Compatible with Raspberry Pi B/B+, easy to

    use. It Supports Raspbian Operating System.

    XPT 2046 touch screen controller. Display

    3.2 with 320x240 16-bit color pixels and a

    resistive touch overlay with aspect ratio 4:3.

    Uses high speed SPI interface on the Pi Helps

    in quickly connecting display to Raspberry pi

    providing easy and quick interface [12].

    II. SOFTWARE DESCRIPTION

    LKM or dynamic kernel modules are

    configured, customized in a cross-compiler

    platform environment. It requires a set of

    tools, programming platforms and certain

    sets of commands. Basic commands used for

    the programming of kernel modules are [7]:

    i. Make [13] utility to build and maintain groups of programs (and other types of files)

    from source code.

    ii. CROSS_COMPILE - For customized root file-system or to compile packages that may

    have dependencies.

    iii. ARCH - Variable used in the command for the target kernel.

    iv. Make modules_install - installs kernel modules to /lib/modules.

    v. INSTALL_MOD_PATH- To build an external module.

    vi. file.ko - Object file linked with some kernel automatically generated data structures that

    are needed by the kernel.

    vii. Insmod install loadable kernel module viii. Rmmod unload loadable modules

    ix. Modprobe high level handling of loadable modules.

    x. Lsmod list loaded modules xi. Depmod- handle dependency descriptions for

    loadable kernel modules.

    xii. Modinfo - display information about a kernel module.

    Methods to load LKM:

    1. modules.conf - This method load the modules before the rest of the services

    2. rc.local - Using this method loads the modules after all other services are started.

    Tools used in the process of cross-compiling

    Linux kernel module for touch screen display

    includes, Nano editor Editor Used, GCC compiler Compiler Used, source Code - Linux rpi.y src code/ arm-gcc-linaro-raspian,

    Toolchain used - arm bcm_2708 gcc linux,

    Linux kernel module fbtft (Frame buffer

    TFT), Host OS: 32 bit ubuntu 14.04

    III. FUNCTIONAL DESCRIPTION

    STEPS:

  • 58

    Interfacing TFT LCD to a Raspberry Pi

    requires kernel modules for running the TFT

    LCD over Raspberry Pi. Raspberry pi as if

    now does not contains supporting kernel

    modules for TFT LCD display.

    Creating and building a kernel module

    includes:

    i. Creating a source code for kernel module

    for a particular controller IC chip (of TFT

    LCD display for Raspberry Pi). The

    module is being created from the LINUX

    source code. Compilation of the created

    source code is being added to it and then

    creating the kernel again according to

    Raspberry Pi.

    ii. Building the module for Raspberry Pi.

    Next is, installing the built module on

    Raspberry Pi. Configuring the command-

    line for adjusting the frame buffer for

    display and its properties.

    iii. Finally running the Raspberry

    Pi OS with newly built and installed

    kernel module for TFT LCD display. This

    will enable us to control and customize

    the Raspberry Pi kernel for TFT LCD

    display.

    Figure 4: Flow diagram of the TFT LCD

    IV. INTERFACING TFT WITH

    RASPBERRY PI

    Serial interfacing of crazy pi TFT LCD

    Display, 3.2 inch with Raspberry Pi uses

    hardware SPI pins (SCK, MOSI, MISO,

    CE0, CE1) as well as GPIO #25 and #24. SPI

    is a bidirectional protocol, with two separate

    data lines. Only one line, MOSI (Master-out,

    Slave-in) is needed to send data from the Pi

    to the display.

    Connection between TFT and Raspberry Pi

    (RPi) will be done as per given table below.

    Rpi Pin RPi GPIO TFT

    1 3.3V 3.3V

    18 GPIO24 RS

    19 GPIO10/MOSI MOSI/DIN

    24 GPIO8/CE0 CS

    23 GPIO11/CLK SCLK/DCLK

    22 GPIO25 RST

    6 GND GND

    21 GPIO9/MISO DOUT

    29 GPIO5 Touch Screen PENIRQ

    26 GPIO7/CE1 Touch Screen CS

    12 GPIO18 Touch Screen BL

    Table 1: Interfacing of TFT LCD display with

    Raspberry Pi

    V. IMPLEMENTATION

    This project is to build a customized kernel

    module for the TFT LCD Display to be

    interfaced with Raspberry Pi. The TFT LCD

    Display module used is fbtft (frame buffer tft)

    driver module. The kernel module which will

    be modified is bcm2708.c platform profile

    [3]. Cross- compiling the Raspberry Pi kernel

    for pi boot on the TFT display requires

    general steps as [8]:

    i. File stored at location given below need modification: nano $HOME/linux/arch/arm/mach-

    bcm2708/bcm2708.c

    ii. Add the following line to the top of the file with the other #include

    statements #include

    iii. Replace the following section (nano $HOME/linux/arch/arm/mach-

    bcm2708/bcm2708.c)

  • 59

    #ifdef CONFIG_BCM2708_SPIDEV

    static struct spi_board_info

    bcm2708_spi_devices[] = {

    #ifdef CONFIG_SPI_SPIDEV

    {

    .modalias = "spidev",

    .max_speed_hz = 500000,

    .bus_num = 0,

    .chip_select = 0,

    .mode = SPI_MODE_0,

    }, {

    .modalias = "spidev",

    .max_speed_hz = 500000,

    .bus_num = 0,

    .chip_select = 1,

    .mode = SPI_MODE_0,

    #endif

    }

    With this code:

    #ifdef CONFIG_BCM2708_SPIDEV

    static struct spi_board_info

    bcm2708_spi_devices[] = {

    #ifdef CONFIG_SPI_SPIDEV

    {

    .modalias = "fb_ili9346",

    .max_speed_hz = 128000000,

    .mode = SPI_MODE_3,

    .platform_data = & (struct fbtft_platform_data) {

    .display = {

    .buswidth = 8,

    .backlight = 1,

    },

    .bgr = true,

    .gpios = (const struct fbtft_gpio []) {

    { "reset", 15 },

    { "dc", 25 },

    { "led", 18 },

    {},

    },

    }

    }, {

    .modalias = "spidev",

    .max_speed_hz = 500000,

    .bus_num = 0,

    .chip_select = 1,

    .mode = SPI_MODE_0,

    }

    #endif

    };

    #endif

    iv. Now is the time for kernel compilation, which takes around 20-

    30 minutes.

    v. Next we need the current configuration from Raspberry Pi that

    can be generated by running the

    following command on Raspberry

    Pi: zcat /proc/config.gz > .config vi. Move to kernel source directory run

    the following commands cd $HOME/linux

    make mrproper make ARCH=arm

    CROSS_COMPILE=${CCPREFIX}

    bcmrpitft_defconfig

    vii. Configuration files mentioned below are to be written in

    bcmrpitft_defconfig.

    CONFIG_FB=y

    CONFIG_FB_CFB_FILLRECT=y

    CONFIG_FB_CFB_COPYAREA=y

    CONFIG_FB_CFB_IMAGEBLIT=y

    CONFIG_FB_SYS_FILLRECT=y

    CONFIG_FB_SYS_COPYAREA=y

    CONFIG_FB_SYS_IMAGEBLIT=y

    CONFIG_FB_SYS_FOPS=y

    CONFIG_FB_DEFERRED_IO=y

    CONFIG_FB_BACKLIGHT=y

    # Frame buffer hardware drivers

    CONFIG_FB_BCM2708=y

    CONFIG_FB_TFT=y

    CONFIG_FB_TFT_HX8340BN=y

    CONFIG_FB_TFT_HX8347D=y

    CONFIG_FB_TFT_ILI9320=y

    CONFIG_FB_TFT_ILI9325=y

    CONFIG_FB_TFT_ILI9340=y

    CONFIG_FB_TFT_ILI9341=y

    CONFIG_FB_TFT_PCD8544=y

    CONFIG_FB_TFT_S6D1121=y

    CONFIG_FB_TFT_SSD1289=y

    CONFIG_FB_TFT_SSD1306=y

    CONFIG_FB_TFT_SSD1331=y

    CONFIG_FB_TFT_SSD1351=y

    CONFIG_FB_TFT_ST7735R=y

    CONFIG_FB_TFT_TINYLCD=y

    CONFIG_FB_TFT_WATTEROTT=y

    CONFIG_FB_FLEX=y

    CONFIG_FB_TFT_FBTFT_DEVICE=y

    CONFIG_BACKLIGHT_LCD_SUPPORT=y

    CONFIG_LCD_CLASS_DEVICE=m

    CONFIG_BACKLIGHT_CLASS_DEVICE=y

    viii. Next commands: make ARCH=arm

    CROSS_COMPILE=${CCPREFIX}

    ix. After run this command it take 20-30 minutes. make modules_install ARCH=arm

    CROSS_COMPILE=${CCPREFIX}

    INSTALL_MOD_PATH=/home/

    x. Copy the kernel and their modules to memory card like modules and firmware. The process depicted in

  • 60

    figure 5 describes the steps of process

    flow of the kernel module

    customization.

    VI. RESULTS

    After adding modules in kernel source code,

    we get our new compiled kernel. Replace the

    previous kernel with the newer one and their

    modules run on Raspberry Pi with TFT

    touchscreen on SPI pin. Customized

    kernel.img size will be reduced by 100 Kb.

    After that we get our own customized frame

    buffer screen shown in results.

    Figure 6 depicts the customized display of

    TFT LCD on Raspberry Pi.

    Figure 6: TFT LCD customized display on Raspberry

    Pi

    VII. CONCLUSIONS

    In this paper we made the kernel module for

    3.2 inch Crazy Pi TFT LCD for customized

    display. TFT LCD is interfaced with

    Raspberry Pi over SPI pins. Customized

    display screen is obtained by developing

    source code, building and compiling the

    kernel module. Also, we can change it for

    different screen sizes.

    VIII. REFERENCES

    [1] Raspberry Pi general description [online]

    Available at:

    http://en.wikipedia.org/wiki/Raspberry_Pi Figure 5: Process Flow

  • 61

    [2] Sanjana Prasad, P. Mahalakshmi, A. John and

    Clement Sunder Smart Surveillance Monitoring System Using Raspberry PI and PIR Sensor (IJCSIT) International Journal of Computer

    Science and Information Technologies, Vol. 5

    (6), 7107-7109, 2014

    [3] Daves Tech Musings, Cross Compile

    Raspberry Pi Kernel to support,Tontec 3.5 Inch

    480320 LCD, December 1, 2014 davidamcgrath

    cross compile, Raspberry Pi cross compile, fbtft,

    kernel, Raspberry pi, tft

    [4] Crazy pi TFT LCD for Raspberry Pi [online].

    Available at: https://www.crazypi.com/32-

    TOUCH-DISPLAY-RASPBERRY-PI

    [5] Linux kernel driver module, Building and Compiling Kernel modules by Tech Pathi, part-1 to 5 [online]. Available at:

    https://www.youtube.com/watch?v=U7QFcpVh

    248

    [6]Linux device drivers [online]. Available at:

    http://en.wikipedia.org/wiki/Device_driver

    [7] General Linux commands for Raspberry Pi

    [online]. Available at:

    http://edoceo.com/howto/kernel-modules

    [8] Peter Jay Salzman, Michael Burian and Ori

    Pomerantz, The Linux Kernel Module

    Programming Guide, 2.6.4 version,

    20070518. E-book] 2001. Available at: [9] Pooja Gandhi and Rajvi Shah, Embedded System Development I-II Project Report, 2014.

    [10] Waqas Anwaar, Munam Ali Shah, Energy Efficient Computing: A Comparison of

    Raspberry Pi with Modern Devices International Journal of Computer and

    Information Technology, vol. 04, no. 02, March

    2015.

    [11] Kernel Customization [online]. Available

    at: https://wiki.gentoo.org/wiki/Kernel/Upgrade

    [12]Make command description [online].

    Available at:

    http://www.computerhope.com/unix/umake.htm