• Lives at the controller design based on the ARM intelligence with to realize - en.51rd.net

    Abstract: How family in a relatively independent device attachment system, thus facilitates carries on this locality and the remote control? This article through uses the ARM constitution intelligence to live at the controller to achieve this goal. The intelligence lives at the controller to use parts and so on S3C2410, SIM100-E to compose the hardware platform, transplants again the Linux system to the hardware platform, then designs the good corresponding driver and the application procedure, finally downloads the software to the hardware platform comes to the electrical appliances to carry on this locality and the remote control.
    Key word: ARM; GPRS; Embedded

    0 forewords

        Along with does the digitized domestic electric appliances’ swift development, how the relatively independent domestic electric appliances carry on the intellectualized management and the operation to the family in? This is a question which the people cared. The intelligence lives at the controllers to be able to constitute many relatively independent domestic electric appliances a unified system, thus facilitates to the domestic electric appliances carries on local operates, may also through the Internet or the GPRS system to the domestic electric appliances realizes remote control and so on. This article main discussion intelligence lives at the control the design and realizes.

    1 intelligence lives at controller’s hardware design

        When the design intelligence lives at the controller, considers system’s stability and the extension, therefore controller hardware design coring core and control panel 2 parts. The nuclear core mainly uses for to constitute an embedded computer system, the control panel is mainly some periphery connection. System hardware as shown in Figure 1.

    Figure 1 the intelligence lives at the hardware structure drawing

        The nuclear core uses the S3C2410 microprocessor which Tristar Corporation produces. ROM uses SAMSUNG the K9F1208 chip to constitute 64M NAND FLASH, connects system’s nGCS0 the FLASH chip, therefore its start address is: 0×00000000. RAM uses 2 piece of HY57V561620AT-H to constitute 64M, connects system nGCS6 it, therefore its start address is: 0×03000000. In order to let the system start from NAND FLASH, must earths S3C2410 OM0 and the OM1 pin. Finally the S3C2410 processor’s serial port control signal, the USB main engine control signal, the LCD control signal, the touchscreen signal, the data bus, the address bus, the control bus, the external interrupt equisignal connects completely in the nuclear core’s 200 core plug.

        The GPRS module uses the SIM100-E chip which SIMCOM Corporation produces. Connect through third serial port holding wire TXD2 and RXD2 and the processor.

        LCD controls directly by CPU, but must increase the driving circuit.

        The touchscreen uses 4 resistance types, directly it and CPU nYPON, YMON, nXPON, XMON is connected.

        The sensor connection’s output signal connects CPU on the EINT9 external interrupt pin, when the sensor receives some signal, may through the external interrupt pin to the CPU application service.

         The electrical appliances control interface’s input control signal connects CPU the GPIO port, when must carry on the control to some electrical appliances, only need to the port which assigns read in 0 or 1, then sends the remote control signal by the electrical appliances control interface to control the corresponding electrical appliances again.

    2 intelligences live at the controller operating system’s transplant and cutting out

        Considers the cost, as well as system to timely request not higher factor, therefore decided that selects the Linux operating system. At present distributes the Linux operating system can support the ARM machine architecture, so long as therefore carries on the transplant according to the platform concrete structure. The transplant mainly includes the establishment cross compiling environment, the revision essence sound code, essence cutting out and the essence translates 4 and so on a link.

    2.1 establishment cross compiling environment

        The cross compiling is refers to the use movement to translate some source program production on some computer’s compiler the target code process which moves on another kind of structure computer. Compiler’s production relies on the corresponding function storehouse, but these function storehouse depends upon the compiler to translate. The establishment cross compiling environment is the ARM use compiler (for example: arm-linux-gcc) and function storehouse (for example: glibc) installs assigns the table of contents, and uses configure to dispose the good Makefile document.

    2.2 revision essence source code

        The revision essence source code mainly includes the start code the revision, the essence link and loads, the parameter transmission and the essence guides several parts. The Linux essence divides into the architecture relevant portion and the architecture irrelevant part. The first stage which starts in Linux, the essence and the architecture relevant portion first carries out, it will complete the hardware register establishment, initialization work and so on memory mapping. Then forwards to the essence the domination the part which has nothing to do with the system architecture. The code which must revise in the transplant work mainly concentrates and the architecture related part. ARM chip architecture under the arch/arm table of contents. First revises boot/init according to the chip handbook. In S document: Selects patches or strips of land as worth saving for seed the group base register, the DRAM memory layout register, DRAM to select patches or strips of land as worth saving for seed the register, the interrupt mask register and so on. Then the revision essence’s link and loads ELF. Finally the system in the available page’s number, information and so on filing system size passes to by the parametric form from the start code the essence, completes the establishment trap, the initialization interrupt, the initialization timer, the initialization control bench and so on a series of operations makes the essence to start normally.

    2.3 essence cutting out and translation

        Essence cutting out was the module which will not need according to control system’s request has cut out from the essence, Linux essence’s cutting out had several editions, might use orders make menuconfig to carry on cutting out to the system.

        After essence cutting out, finally must carry on cross compiling production essence reflection document zImage. The concrete order is as follows:

    make clean   // cleans up the translation environment

    make dep    // translates the dependent document

    make zImage // translation essence

    3 driver design

        The intelligence lives at the controller to want many device driver, some driver may use the standard the driver, some must design specially. Chip SIM100-E is connected through the third serial port and S3C2410, therefore may use the standard directly the serial port driver. The sensor connection and the electrical appliances control interface must design the special-purpose driver. Controller’s processor examines the sensor through the external interrupt, controls the electrical appliances through the GPIO port, although their principle of work differs from, but driver design method not very wide difference, because the device driver has a standard frame in the embedded Linux system, the design driver’s majority of work are come “filling in” according to the hardware architecture in the frame function. Main functions including open(), read(), write(), ioctl(), release(), module_init() and module_exit() and so on.

        Below take the sensor connection driver design as the example, the synopsis driver “filling in” the process.

    3.1 equipment initialization module and withdrawal module

        The equipment initialization module’s major function is: Establishment and application interrupt, to essence registration equipment and so on. The equipment withdraws from the module the major function is: The releasing arrangement takes resources. The concrete function is as follows:

    int __init s3c2410_int_init(void)

    {┅

           set_external_irq (IRQ_EINT9, ┅); // establishes the external interrupt

           request_irq (IRQ_EINT9, demo_int_handler, ┅); // applies for the external interrupt

           ret = register_chrdev (0, DEVICE_NAME, &s3c2410_exio_fops); // applies for the main equipment number

           devfs_int_demo= devfs_register (NULL, “int_demo”, ┅); // registration equipment document

    ┅}

    void __exit s3c2410_int_exit(void)

    {┅

           free_irq(IRQ_EINT9, NULL); // release interrupt

           devfs_unregister(devfs_int_demo); // deletion equipment document

           unregister_chrdev (exioMajor, DEVICE_NAME); // releases the main equipment number

    ┅}

    3.2 open the module and the release module

        Opens the module the major function is: Initialization some variables. Realizes the function to be as follows specifically:

    static int s3c2410_int_open (struct inode *inode, struct file *filp)

    {     init_MUTEX (&demodev.lock); // initialization spinning lock

           init_waitqueue_head (& (demodev.wait)); Initialization formation

           MOD_INC_USE_COUNT; // use counting adds 1

    ┅}

    static int s3c2410_int_release (struct inode *inode, struct file *filp)

    {     MOD_DEC_USE_COUNT; // uses the counting to reduce 1

    ┅}

    3.3 read the data module

        Reads the data module the major function is: Causes the thread to rest the eye, then the waiting interrupt awakens. Realizes the function to be as follows specifically:

    static int s3c2410_int_read (struct file *filp, char *buffer, size_t count, loff_t *ppos)

    {┅

           copy_to_user (buffer, (char *) &bak, sizeof(bak)); // essence condition to user condition

           interruptible_sleep_on (&demodev.wait); // enters the dormancy

    ┅}

    3.4 interrupt processing module

        The interrupt processing module’s major function is: Awakens is resting the eye the thread. Realizes the function to be as follows specifically:

    static void s3c2410_int_handler (int irq, void *dev_id, struct pt_regs *reg)

    {wake_up (&demodev.wait); // interrupt awakens

    ┅}

        After the driver design completes, then compiles the Makefile document, through make order production object file, finally using the insmod order to essence load driver.

    4 application procedure design

        In order to enhance the application procedure the running rate, as well as program run stability, therefore the application programming multithreading structure, as shown in Figure 2. The application procedure is composed of 7 threads and shared data structures.

    Like Figure 2 application program structure diagram

        The shared data mainly uses in depositing electrical appliances opening and the closing hour, transmission information and so on short note telephone number and short note content. The shared data is revises through 2 establishment threads. The electrical appliances control thread is mainly according to the control data, the examination short note thread content and the operation thread content carries on the operation. The transmission short note thread is mainly according to the control data, the examination sensor thread content and the operation thread content carries on the operation. The application procedure’s actual content is as follows.

    #include<pthread.h>    // thread storehouse document

    int main()

    {┅

      pthread_creat(&th_a, NULL, send_msg,0); // founds the transmission short note thread

    pthread_creat(&th_b, NULL, control_driver,0); // foundation electrical appliances control thread

      pthread_join(th_b,&retval); // waiting electrical appliances control thread ended

    pthread_join(th_a,&retval); // waited for that the transmission short note thread ended

    ┅}

    /* transmission short note thread */

    int send_msg()

    {┅

           tty_init();   // initialization serial port

           gprs_init();  // initialization GPRS module

           tty_writecmd (”at”, strlen (”at”));  // transmits at order

           tty_writecmd (”at cmgf=1″, strlen (”at cmgf=1″)); // transmission revision character repertoire order

           tty_write (”at cmgs=”, strlen (”at cmgs=”));     // transmission short note order

           tty_writecmd (msg.send_tel, strlen (msg.send_tel)); // transmission telephone number

    tty_writecmd (msg.send_text, strlen (msg.send_text)); // transmission short note content

          tty_end(); 

          return 0;

    }

        Other thread’s design method has many similarities. After the application programming completes, undergoes the cross compiling to be possible again to produce the object file.

    5 concluding remark

        Will transplant the good system, the driver and the application procedure downloads to the intelligence lives at on the controller. After the test, the system has the ease of operation, the reliability to be high and antijamming ability strong and so on merits. This article innovation spot is: Lives at the controller through the intelligence the electrical appliances, the sensor, the handset and so on a many independent device attachment into system, thus facilitates local and the remote control.

    Reference:

    [1] Zhu Washington, Hu Kelly. Based on Linux system’s HHARM9 motor-driven programming [J]. Nanchang Engineering college journal .2005,4:51-53.

    [2] severe even. The embedded intelligent family gateway’s research and designs the [J]. micro computer information .2005,2:14-16.

    [3] Zhu Washington, Liu Wenjun. Based on Linux under real-time data backup research [J]. Nanchang water special journal .2004,4:57-58.

    [4] Zhu Washington, Han Yuzhen. Computer breakdown analyzer’s design [J]. Nanchang water special journal .2003,2:34-36

    Share/Save/Bookmark

    Tuesday, September 23rd, 2008 at 00:37
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TOP
Copyright © 51 Research and Design, Electronic Engineers website - Embedded Systems, MCU, DSP, EDA, Test and Measurement, Components, Communications, Power, Microelectronics, Semiconductors
Powered by WordPress | Theme by mg12 | Valid XHTML 1.1 and CSS 3