[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2016
  • Last Modified:

Serial communications

From device communication protocol:
The controller UART is configured to use the standard 4800 bps communication speed using 1 startbit, 8 databits, 1 even parity bit and 1 stopbit (lsbit first).

I am trying to talk with this device using COM terminal program (for now, unsuccessful). All COM terminals contain standard COM port parameters like speed, databits, patity, stopbit. But I don't understand two parameters from this protocol: "1 startbit" and "lsbit first". What does this mean?
0
AlexFM
Asked:
AlexFM
  • 8
  • 3
  • 2
  • +4
5 Solutions
 
ankuratvbCommented:
lsbit first means least significatnt bit first.
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi Alex,

start/stop bits are really just "timing" bits that occur in the bitstream.

SSSDDDDDDDDPsssss


In the imaginary sequence above, SSS indicates that there are three start bits, and sssss indicates that there are 5 stop bits.  (Just an example -- you wouldn't do this in real life.)  Identifying the number of start/stop bits tells the UART where in the bitstream the data lies.

lsbit is short for Least Significant Bit.


Kent
0
 
ankuratvbCommented:
the data field is flanked on either side by startbit and stopbit.

1 startbit means 1 bit will be used to demarcate the start of the frame.
0
Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

 
anupvijayCommented:
Hi AlexFM,

1 start bit means that the start of transmission is indicated by a bit '0' and similarly stop bit would be '1' which indicates stop
of data transmission.

lsbit first means that the LSB bit is transmitted first. This is similar to the little endian system I guess.
Does it make sense ? Other experts please correct me if I am wrong. If I am correct then does this point towards any
thing that tells you why your communication is not working ?
All the best.

Cheers.
0
 
AlexFMAuthor Commented:
What is interesting for me now - I am trying to talk with this device, and all terminal programs I try don't have such settings. I don't know whether I am OK or not, this may be also hardware problem which should be solved by HW engineers. For example, I run Windows Hyperterminal, and see speed, databits, patity and stopbit options. But I don't see "1 startbit" and "lsbit first" options. Can I be sure that I am OK? Are these parameters supposed to have such values in any standard COM terminal?
0
 
anupvijayCommented:
Before submitting there were no other comments.....sorry if my answer is a repetition.....
The net age :-)
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi Alex,

The UART should "hide" most of the data formatting issues from your application.  By telling the UART the number of start/stop bits, parity, etc you're pushing all of the I/O and timing related issues to the hardware, microcode, BIOs, etc levels.

I'm not familiar with a UART differentiates between LSB and MSB.  (They may well exists -- I just don't know about them.)  As long as both devices are using LSB or MSB it shouldn't matter.


As an aside, I once dealt with a device that used 1.5 stop bits.  I didn't know this when I first started coding for it and blame it for much of my hair loss.  :)


Kent
0
 
ankuratvbCommented:
Hi Alex,

I dont know how much of this would be useful for you but

http://www.beyondlogic.org/serial/serial.htm

has an excellent description of serial communicationa and its nuances.

0
 
ankuratvbCommented:
Hey Kent,

I just noticed that in hyperterminal settings as well.
Indeed surprising.
0
 
ankuratvbCommented:
I actually can understand the logic of allowing to set the length of the stop bit and not allowing to change the length of the start bit. As is the case with Hyperterminal

Either you allow both or you dont allow both.

0
 
ankuratvbCommented:
>I actually can

I actually can't.


0
 
MercantilumCommented:
Hi Alex,
Please have a look to this nice tool
http://www.experts-exchange.com/Q_20957961.html
0
 
griesshCommented:
Alex

some more info:

RS232 serial communication is an asyncronous communication, that means the receiver does not know about the number of data bits sent. But both transmitter and receiver know (through the setup) about some frame information.
- There is 1 start bit which is always 0
- There is a defined number of stop bits (1, 1 1/2, 2)
- There is a (possible) parity bit
- The LSB (least signifiacnt bit) is send first
When the receiver 'sees' a start bit it knows that a new 'word' is to be transmitted. With the baud rate the time of 1 bit is specified. Once the line is in a 'mark' state created by the stop bit the receiver can wait for a new star-bit. The time between 'words' is not defined.
That should answer your question about start bit and LSB first.

======
Werner
0
 
ankuratvbCommented:
>There is 1 start bit which is always 0

If that is the case,why is it that we can change the start bit's length using code(for some device) but not using hyperterminal.

0
 
griesshCommented:
A UART is hardware and can be configured to all kinds of settings (for example: nobody forces a UART to only support the standard transmission speeds) and has a superset of functions of what is needed for 'standard' serial communication.
RS232 communication is a defined way to communicate and specifies 1 start bit.

Check the datasheet of any 16550 derivate and you will be able to learn more about UARTS. I have no idea what UART Alex is using, but none of the 'standard' UARTS offer that startbit option.

=====
Werner
0
 
AlexFMAuthor Commented:
Thanks for the answers. Can I make conclusion from this that setting of speed, databits, patity, stopbit is enough, I don't need to care about startbit and lsbit settings, because they are always default, and if device doesn't answer, this is probably hardware program?
0
 
grg99Commented:
I've never heard of having more than one start bit, one and only one is the standard way to go.

The old 1940's teletypes needed 1.5 stop bits, as they were purely mechanical devices, with the receiving end perhaps running a few percent slower than the sending end.  The extra .5 stop bit would allow the receiver some breathing room to catch up.

When computers got into the act, the early UARTS couldnt do 1.5 stop bits, so 2 stop bits was a common option.

But I've never seen any choices in start bits!      It *may* be part of some of those new serial protocols used between chips.   See i2C and other two-wire and one-wire serial protocols.

If you're getting absolutely NOTHING, not even garbage, you probably need to do one or more of the below:

(1)  Strap the handshaking lines to their opposite friends.

(2)  Strap some lines HIGH.

(3)  Swap send and receive lines (2 and 3).

Many an afternoon I've wasted doing just the above.

Nowadays you can buy a $9.95 RS-232 "breakout box", which has nice wires and pins and LED's to indicate what's going on.
You'll probably need one of these if you're not quickly lucky just swapping 2 and 3.




0
 
griesshCommented:
Alex

The breakout box grg99 is  alife saver if you do that kind of work more often.

What type of handshake are you using? software ? hardware? none?
0
 
ankuratvbCommented:
Thanx griessh for that information.

I just checked that out on beyondlogic's site:

http://www.beyondlogic.org/serial/serial1.htm#40

This is what they say:

The RS-232 line, when idle is in the Mark State (Logic 1). A transmission starts with a start bit which is (Logic 0). Then each bit is sent down the line, one at a time. The LSB (Least Significant Bit) is sent first.

0

Featured Post

The IT Degree for Career Advancement

Earn your B.S. in Network Operations and Security and become a network and IT security expert. This WGU degree program curriculum was designed with tech-savvy, self-motivated students in mind – allowing you to use your technical expertise, to address real-world business problems.

  • 8
  • 3
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now