Serial standard communication (stty)


 
Thread Tools Search this Thread
Operating Systems HP-UX Serial standard communication (stty)
# 1  
Old 05-07-2015
Hammer & Screwdriver Serial standard communication (stty)

Hello friends, I am trying to communicate with a programmer memory from Unix (HP-UX) via serial port.

Well, I have some code ready stty parameters to achieve communicating the device with the computer, but I have my doubts. I would like to know if you have some code fragment where you use the stty command, something generic for a connection to the serial portSmilie.

Code:
stty 115200-parenb -parodd cs8 -cstopb -hupcl
cread clocal -loblk -crts -ignbrk
-brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr
-icrnl -iuclc -ixon -ixany -ixoff -rtsxoff -ctsxon
-ienqak -isig -icanon iexten -xcase -echo -echoe -echok
-echonl -noflsh -opost -olcuc -onlcr -ocrnl -onocr
-onlret -ofill -ofdel -tostop </dev/ttym01

# 2  
Old 05-07-2015
What options you use depends on what options you need.

What options you need depend on how the programmer talks.

In other words, what are you expecting? Does it send and receive lines of text like a modem, or does it send packets of unescaped binary data, or does it respond when you bit-bang control bits, or what?
# 3  
Old 05-07-2015
You have xon-xoff flow control turned off and rts-cts control also turned off.
You should lower the baud rate to no more than 9600, and you may get it to work.
How many wires are in the circuit? What is the pin-out?
What does the manufacturer of the device you are connecting to suggest, and what are the defaults? Is the device even RS232, or maybe RS485?
# 4  
Old 05-08-2015
device datasheet

Thank you all for your time and help. The device is a programmer NEC have a communication for the console so I want to send and receive text lines.

Serial interface (RS-232C) capable of handling communication at 9,600 (minimum) baud up to 115,200 baud. The DB-9 (female) PINOUT is configured this way:

SERIAL HOST -----------SIGNAL NAME
1------------------------------NC
2------------------------------RxD
3------------------------------TxD
4------------------------------NC
5------------------------------Vss (GND)
6------------------------------NC
7------------------------------RTS
8------------------------------CTS
9------------------------------NC

The RS-232C data transfer conditions are 9,600 baud, 8 data bits, 1 stop bit, no parity and selectable hardware handshake. The baud rate may be selected from 9,600 bps (default), 19,200 bps, 38,400 bps, 57,600 bps or 115,200 bps.

This is information about the device:
[URL="http://documentation.renesas.com/doc/DocumentServer/U15260EJ4V0UM00.pdf"]

Excuse, I'm new in UNIX, I'm trying learn.
# 5  
Old 05-08-2015
What do you want to do with it? Are you trying to talk to it on a terminal? Use minicom for that. Or are you trying to script something?
# 6  
Old 05-08-2015
CPU & Memory Terminal and script

I'm trying to do both, first gain communicate via terminal and then make a script in BT-Basic that can reliably do this automatically for a project.

Code:
sub IniRS232(Port$,Baudrate)
    global  @RS232
    dim STTY1$[512]
    STTY1$ = "stty "& val$(Baudrate) & " -parenb -parodd cs8 -cstopb -hupcl "
    STTY1$ = STTY1$ & "cread clocal -loblk -crts -ignbrk "
    STTY1$ = STTY1$ & "-brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr "
    STTY1$ = STTY1$ & "-icrnl -iuclc -ixon -ixany -ixoff -rtsxoff -ctsxon "
    STTY1$ = STTY1$ & "-ienqak -isig -icanon iexten -xcase -echo -echoe -echok "
    STTY1$ = STTY1$ & "-echonl -noflsh -opost -olcuc -onlcr -ocrnl -onocr "
    STTY1$ = STTY1$ & "-onlret -ofill -ofdel -tostop < "
    RS232_Dev$ ="/dev/" & Port$
    assign @RS232 to RS232_Dev$; read, write
    timeout @RS232, 0.8
    execute STTY1$ & RS232_Dev$; append
subend

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Redirect Standard output and standard error into spreadsheet

Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway? Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies

2. Programming

Serial communication failing

edit: never mind; mods please delete. I finally got so frustrated I figured it couldn't be the code and it must be the device on the other end. After pulling it out of its cradle, I realized it was a different model number than the one I was using before, and wasn't accepting my... (1 Reply)
Discussion started by: DreamWarrior
1 Replies

3. Ubuntu

Ubuntu 9.04 Serial application to telnet to serial device

Hello! I am working on an application which reads environmental instruments which have serial ports. The application requires a serial port to be present to talk to the device (i.e. /dev/ttyS0 ). In some instances the environmental devices will be 100's of yards away from the computer, so a... (5 Replies)
Discussion started by: mvona
5 Replies

4. Shell Programming and Scripting

standard error to standard out question

Hi there how can i get the result of a command to not give me its error. For example, on certain systems the 'zfs' command below is not available, but this is fine becaues I am testing against $? so i dont want to see the message " command not found" Ive tried outputting to /dev/null 2>&1 to no... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

5. OS X (Apple)

Serial Communication from shell Mac OS X PHP script

Hi again, I spoke with Keyspan and they assured me the USB to Serial device was working if I could use the Screen tool. I asked why I was unable to redirect stdin/stdout to and from the /dev/tty. device and was told there was no reason I shouldn't be able to do so. I have tried: ... (1 Reply)
Discussion started by: cpfogarty
1 Replies

6. Programming

problem while having a communication with serial port?????

hello, I am gettin problem while sending and recieving data through seial port... when I am sending Data then the reciever end is not able to recieve that data ..... Reciever end is running in infinite loop just polling after some time to check that there is data on the port and then again... (9 Replies)
Discussion started by: arunchaudhary19
9 Replies

7. IP Networking

ip communication through serial connection

I have serial modem connection between two computers. We have to login the remote computer through ip address. How can I get the ip address in this connection? (1 Reply)
Discussion started by: pcsaji
1 Replies

8. UNIX for Dummies Questions & Answers

serial communication

This isn't really a unix question, or even a programming question, but I hope you guys can help. I want to create a program to control the electricity on a model railway. I have created the program to that it sends characters over the serial cable, but now I need to do the switch that will... (1 Reply)
Discussion started by: KrazyGuyPaul
1 Replies

9. UNIX for Advanced & Expert Users

Serial Communication in UNIX

Hi, I am working on serial communication on Unix. Can anyone guide me through it. The steps required for RS 232 communication and can i do serial communication even if i dont have super user previledges. Thankx, Vicky (1 Reply)
Discussion started by: Vicky
1 Replies

10. UNIX for Dummies Questions & Answers

Serial port communication

We're running SCO Unix Openserver 5.05 and I'm having trouble with serial communication between the com2 serial port and a handheld device. Downloading data from Unix to the handheld works perfectly, but the other way around creates a major problem. I don't know whether it's a buffer overflow or... (1 Reply)
Discussion started by: Aretha
1 Replies
Login or Register to Ask a Question