Store Logo
My Account  Cart Contents  Checkout  
  Top » Catalog » Linux Port Tutorial TQ2440 » TUT 12: Tune Serial Port Driver Log In |  Cart Contents  |  Checkout | 
Advance Search
box
 
Use keywords to find the product you are looking for.
box
Categories
box
Arduino

Arduino Kits

Arduino Shields

Breakout Board

Cables->

Cellular

Component->

Development Tools->

Ethernet

FPGA

GPS

LCD

Powerline Communication->

Programmer/Emulator

Project Case

Prototyping->

Python-On-A-Chip

Robotics

Sensor->

Services

Storage

Tools->

Tracking

Video

Wireless->

View All Products ->

All Products sorted by Categories ->

All Products sorted by Manufacturers ->
box
Specials more
box
WiFi Shield WiShield V2.0 for Arduino
WiFi Shield WiShield V2.0 for Arduino
 $55.00  $52.50 
box
Quick Find
box
 
Use keywords to find the product you are looking for.
Advanced Search
box
Latest products more
box
Arduino Ethernet Shield Version 2010
Arduino Ethernet Shield Version 2010
 $39.99 
box
Featured more
box
Arduino USB Board
Arduino USB Board
 $29.90 
box
Articles
box
New Articles (0)
All Articles (38)
Android
GPS (2)
Industry News (5)
Linux Port Tutorial TQ2440 (24)
MCU Zone (3)
PCB/SMT Assembly Service (2)
Smart Home (2)
box
TUT 12: Tune Serial Port Driver   by Patrick

12.1 Modify the source code

The kernel only support 2 serial ports, i.e., UART0 and UART1 of the S3C2440.  The driver of UART2 is for infra-red, not the serial port. Here we modify it to be for serial port.

Modify line 99 of source files of kernel "arch/arm/mach-s3c2440/mach-smdk2440.c" (line 100 of Linux-2.6.30.4):
Change it to:
.ulcon = 0x03,
Modify Linux-2.6.25.8 kernel source file"drivers/serial/s3c2410.c". Insert the red part between line 518 and line 958:


static int s3c24xx_serial_startup(struct uart_port *port)
{
    struct s3c24xx_uart_port *ourport = to_ourport(port);
    int ret;


   dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)n",
        port->mapbase, port->membase);


    if(port->line == 2)
   {
      s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_TXD2);
      s3c2410_gpio_pullup(S3C2410_GPH6, 1);
      s3c2410_gpio_cfgpin(S3C2410_GPH7, S3C2410_GPH7_RXD2);
      s3c2410_gpio_pullup(S3C2410_GPH7, 1);
    }

rx_enabled(port) = 1;
ret = request_irq(RX_IRQ(port),
s3c24xx_serial_rx_chars, 0,
s3c24xx_serial_portname(port), ourport);
if (ret != 0) {
printk(KERN_ERR "cannot get irq %dn", RX_IRQ(port));
return ret;
}

Next step is to modify serial port device name in line 958, the content is as follows:

static struct uart_driver s3c24xx_uart_drv = {
.owner = THIS_MODULE,

.dev_name = "tq2440_serial",
.nr = 3,
.cons = S3C24XX_SERIAL_CONSOLE,
.driver_name = S3C24XX_SERIAL_NAME,
.major = S3C24XX_SERIAL_MAJOR,
.minor = S3C24XX_SERIAL_MINOR,
};
Modify Linux-2.6.30.4 "drivers/serial/samsung.c", line 53 insert the following:

#include

Add the following content in line 433:
if (port->line == 2) {
s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_TXD2);
s3c2410_gpio_pullup(S3C2410_GPH6, 1);
s3c2410_gpio_cfgpin(S3C2410_GPH7, S3C2410_GPH7_RXD2);
s3c2410_gpio_pullup(S3C2410_GPH7, 1);
}

Next is to modify line 888, content is as follows:
.dev_name = "tq2440_serial",
Now we can rebuild the image and burn to the development board. We can use all there serial ports!

Note: in the preceding tutorials, we already used s3c2410_defconfig to config the serial ports.
We list the serial port config:( the following is 2.6.30.4, and 2.6.25.8 is similar)

Device Drivers --->
       Character devices --->
             Serial drivers --->
                 < > 8250/16550 and compatible serial support
                       *** Non-8250 serial port support ***
                 <*> Samsung SoC serial support
                  [*] Support for console on Samsung SoC serial port
                  <*> Samsung S3C2440/S3C2442 Serial port support

 

12.2 Test of Serial Ports

We use the simplest method to test the serial ports. There is a getty command in busybox, its function is to switch the control console.

In embedded system, normally serial port is control console. So we can use getty command to test serial port.

Test of Serial port 1:
Default serial port 1, ie, UART0 is the control console.


Test of Serial port 2:

In secureCRT, we type: $getty /dev/tq2440_serial1 115200(which will transfer control to UART1), then type root and enter.

Test of Serial port 3:

In secureCRT, we type: $getty /dev/tq2440_serial2 115200(which will transfer control to UART2), then type root and enter.

The following is the screen capture:

 

This article was published on Monday 19 April, 2010.
Current Reviews: 0 Write Review
Tell a friend
box
Tell a friend about this article:  
box
Shopping Cart more
box
0 items
box
Cards We Accept
box
BOX_INFORMATION_CARD
BOX_INFORMATION_CARD
BOX_INFORMATION_CARD
BOX_INFORMATION_CARD
box
Affiliate Info
box
Affiliate Program FAQ
Affiliate Log In
box
Information
box
Terms and Conditions
Shipping and returns
Privacy
Contact Us
box


Copyright © 2008-2010 CuteDigi Technologies, Inc
CuteDigi Technologies. Inc, Longmont, CO 80503