in
Creating Smarter Networks

Unwanted RS-232 echo and carriage return

Last post 02-23-2010 6:16 AM by Sven Ruin. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-26-2010 2:31 PM

    • Sven Ruin
    • Top 25 Contributor
    • Joined on 12-17-2008
    • Posts 9
    • Points 120

    Unwanted RS-232 echo and carriage return

    Hi,

    We are developing a RS-232 driver for communication with an inverter. When testing our FPM, the RS.232 port on the SmartServer seems to be in a text mode, because it does the following without our intention:

    • It echos the characters sent to it
    • If a byte with value 10 (line feed) is sent from the FPM, we find that a byte with value 13 (carriage return) is added before

    Does anyone know how to select "binary mode" instead (with no echo and no addition of carriage return)?

    Sven

    • Post Points: 5
  • 02-10-2010 2:07 AM In reply to

    • Sven Ruin
    • Top 25 Contributor
    • Joined on 12-17-2008
    • Posts 9
    • Points 120

    Re: Unwanted RS-232 echo and carriage return

    Hi again,

    Here is some additional information about the problem I described before. Hope this makes it possible for someone to understand what is wrong and give us advice.

    The SmartServer communicates via RS-232 with a PC, where a communication simulation program is running. This simulation program uses raw communication with the serial port and the setting there is 8 bits. However, the SmartServer seems to interpret it as 7 bits ASCII, despite that we have tried to set it to 8 bits.

    Below you can see the lines in Initialize() routine of the FPM where we open and initialize the RS-232 port on the SmartServer:   fd=rs232_open(9600);   res=rs232_ioctl(fd, IOCTL_SIO_HW_OPTS_SET, ( CS8 | CREAD | CLOCAL));  

    Sven

    • Post Points: 20
  • 02-11-2010 3:06 AM In reply to

    • Victor
    • Top 50 Contributor
    • Joined on 06-02-2009
    • Posts 4
    • Points 80

    Re: Unwanted RS-232 echo and carriage return

      Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

    The VxWorks serial device can be switched to raw mode with:

     

      fd=rs232_open(9600);

      res=rs232_ioctl(fd, FIOSETOPTIONS, OPT_RAW);

     

    This should disable echo and other options

    • Post Points: 20
  • 02-18-2010 6:44 AM In reply to

    • Tuvok
    • Top 75 Contributor
    • Joined on 03-30-2009
    • Posts 1
    • Points 20

    Re: Unwanted RS-232 echo and carriage return

    FIOSETOPTIONS doen't work for rs232_ioctl

    better use

    ...
    res=ioctl(fd, FIOSETOPTIONS, OPT_RAW);

    ...

    Thomas

    • Post Points: 20
  • 02-23-2010 6:16 AM In reply to

    • Sven Ruin
    • Top 25 Contributor
    • Joined on 12-17-2008
    • Posts 9
    • Points 120

    Re: Unwanted RS-232 echo and carriage return

    Thank you

    who have provided help here at the forum and Paul Robinson at Echelon support in the UK. You gave use the clues so we could solve the problem.

    This is how we finally managed to get the SmartServer to communicate via RS-232 using 38400 bps, 1 start bit, 8 data bits, 1 parity bit, even parity and 1 stop bit:

    fd=rs232_open( 38400 );
    res=ioctl( fd, FIOSETOPTIONS, OPT_RAW );
    res=ioctl( fd, SIO_HW_OPTS_SET, CLOCAL | CS8 | PARENB );

    After this it seems necessary to reset the SmartServer to make some of the changes work.

    Sven

    • Post Points: 5
Page 1 of 1 (5 items)
©2008 Echelon Corporation