2 Replies Latest reply on Jan 9, 2013 2:04 AM by 983469

    How to develop rs232 program?

      I develop serial program in linux, it work fine. but when i port it to solaris, it will became more garbled characters...
      I use this sample code:

      i only modify this code in two line:

      /* real baudrate value in my device:B57600 */
      #define BAUDRATE B57600
      /* real device:/dev/cua/1 */
      #define MODEMDEVICE /dev/cua/1

      And not modify other place , but result appear more garbled characters, not normal character.
      So i want to ask this question about this difference in solaris between linux in serial port?
      And where is relational documents for reference?

      My OS is Solaris 11.1
        • 1. Re: How to develop rs232 program?

          IMHO Solaris not have big difference when forking with serial device.
          Genaraly, garbled characters mean that selected speed not correspond to device speed.

          What device connected to rs232 port ?

          /dev/cua - not loking ports, so can be used at one time by different programs with different settintg.
          try use /dev/term/1

          It can be hardware problem. Try use tip -57600 /dev/term/1 and check for garbled characters.

          Can you clear you recive garbled characters or other side recive from you garbled characters ?

          • 2. Re: How to develop rs232 program?
            Thanks for your help.

            After modify these lines, it has been worked:
            #define MODEMDEVICE "/dev/term/1"

            newtio.c_cflag = BAUDRATE|CS8|CLOCAL|CREAD;
            newtio.c_iflag = IGNPAR;
            newtio.c_oflag = 0;
            newtio.c_lflag = ICANON;
            Modify to below, reference this:

            newtio.c_cflag |= CS8;
            newtio.c_cflag &= ~PARENB;
            newtio.c_cflag &= ~CSTOPB;
            newtio.c_cflag &= ~CSIZE;
            newtio.c_cflag &= ~CRTSCTS;
            newtio.c_cc[VMIN] = 1;
            newtio.c_cc[VTIME] = 0;