This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TI DM365 3.0 release,don't find the RS485(ttyS1)

hi,  I want to use the RS485 port in the DM365 3.0 release; but , i scan the boot message  ,find only have one Serial port for console :

[ 0.200000] serial8250.0: ttyS0 at MMIO map 0x1d06000 mem 0xfbd06000 (irq = 41) is a 16550A

while,it's not happened in the 2.6 release,it have  two serial port : ttyS0 and ttyS1(RS485).

this is the difference between 2.6 and 3.0  release about configuration :

Relative to the 2.6 release, anything to be change about RS485 in the 3.0 release ?

Anything I'm missing?  What to try next?

Regards,
yun
  • hi jingguang,

    do you solve this problem? can you teach me how to solve it? thanks!

    i also want to have two serial port. i modify the kernel configuration,and rebuild the kernel, but it does not works. 

    bojiang

  • hi bojiang,

    this problem has  be solved;

    1) change the configure from "1" to "2";(In the above picture:  ti-davinci/arch/arm/configs/davinci_dm365_ipnc_defconfig_nand  and  davinci_dm365_ipnc_defconfig_nfs)

    then boot the DM365  :  cat /proc/tty/driver/serial 

    you can see two serial like this :

    0: uart:16550A mmio:0x01D06000 irq:41 membase 0xFBD06000 tx:11064 rx:95 RTS|CTS|DTR|DSR
    1: uart:unknown port:00000000 irq:0

    2)compare  the file :board-dm365-ipnc.c between 2.6 and 3.0 ,change:

    (1) add UART0 in the struct

    static struct plat_serial8250_port serial_platform_data[] = {
         {
             .membase = (char *) IO_ADDRESS(DAVINCI_UART0_BASE),
             .mapbase = (unsigned long) DAVINCI_UART0_BASE,
             .irq = IRQ_UARTINT0,
             .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
             .iotype = UPIO_MEM,
             .regshift = 2,
             .uartclk = 24000000,
         },
         {
             .membase = (char *) IO_ADDRESS(DM365_UART1_BASE),
             .mapbase = (unsigned long) DM365_UART1_BASE,
             .irq = IRQ_UARTINT1,
             .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
             .iotype = UPIO_MEM,
             .regshift = 2,
             .uartclk = 121500000,
         },
         {
             .flags = 0
         },
     };

    (2)modify the UART1 init initialization (Because of the add a  UART0)

    serial_platform_data[0].uartclk= pll1_commonrate;   =》    serial_platform_data[1].uartclk= pll1_commonrate;

    3) modify the console login port from ttyS0 to ttyS1  in the fs.

    DM365 : /etc/inittab

    2.6:con:2345:respawn:/sbin/getty console
    
    3.0:1:2345:respawn:/sbin/mingetty --autologin root ttyS0  change to   1:2345:respawn:/sbin/mingetty --autologin root console
    

    4) modify the console login port from ttyS0 to ttyS1  in the U-boot.

    like this :setenv bootargs 'console=ttyS1,115200n8 ......

    that's all

    yun

  • hi yun,

    thanks very much!

    according to what you said, i have solved this problem.

    in addition, i have another question want to ask you. i did "make menuconfig" to configuration the kernel, but the ".config" file did not update. why?

    do i must modify "davinci_dm365_ipnc_defconfig_nand" file?

    thanks a lot!

    bojiang

  • hi bojiang,

    about problem 1: sorry !  i don't kown;

    the problem 2: when you build the DM365 , the davinci_dm365_ipnc_defconfig_nand  or davinci_dm365_ipnc_defconfig_nfs will be overlap the davinci_dm365_ipnc_defconfig ,

    i guess you boot DM365 in the NFS now,  when you boot it  use the nand , you must be modify  the file :davinci_dm365_ipnc_defconfig_nand

    yun

  • hi yun,

    thanks very much!

    according to what you said, i have changed.but when i use

    open("/dev/tts/0", O_RDWR | O_NOCTTY | O_NDELAY);

    it returns -1?

    can you help me ?

    thanks a lot!

     

  • hi ling:

    boot the DM365, Run this command :dmesg | grep tty    or   dmesg | grep tts

    say the real name of the UART0 and UART1;

    like this :    dmesg | grep tty

    serial8250: ttyS0 at I/O 0xf9830000 (irq = 9) is a 16550A........
    serial8250: ttyS1 at I/O 0xf9840000 (irq = 10) is a 16550A.............

    the right  api  :  open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);    or   open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NDELAY);

    Best Regards,
    yun


  • hi yun,

    thanks very much!

    i got it ! 

    as you say

    open("/dev/tts/0", O_RDWR | O_NOCTTY | O_NDELAY);   is wrong.

    thanks a lot!

  • hi yun,

    thanks very much!

    I have another problem,can you help me?

    when i read from /dev/ttyS0 ,it returns 0.

    This is my program.

    int OpenTrigCtrlPort()
    {
     struct termios options;
     
     fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NONBLOCK);
     if (fd < 0){
          printf("error");
      return -1;
     }

     bzero(&options,sizeof(options));
     /*raw output mode*/
     options.c_oflag = 0;
     /*raw input mode*/
     options.c_iflag = 0;

     options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); 
     options.c_cflag = B9600|CRTSCTS|CS8|CLOCAL|CREAD;
     tcflush(fd,TCIFLUSH);
     tcsetattr(fd, TCSANOW, &options);

     return 1;
    }

    int *TransCtrlThread(void *arg)
    {
     int nread;
     char buff[1000];

     memset(buff, 0, 1000);

     while (1)
     {
      nread = read(fd, buff, 80);
      printf("nread = %d\n", nread);

      if (nread > 0)
      {

       buff[nread+1] = '\0';
       printf("buff = %s\n", buff);
      }

      sleep(30);

     }

     close(fd);

     printf("Thread exit\n");
     return 0;
    }

    thanks a lot!