Вы находитесь на странице: 1из 3

5/10/2016 communicationUSART,UART,RS232,USB,SPI,I2C,TTL,etc.whatarealloftheseandhowdotheyrelatetoeachother?

ElectricalEngineerin

ElectricalEngineeringStackExchange
isaquestionandanswersitefor
electronicsandelectricalengineering
professionals,students,and
enthusiasts.Jointhemitonlytakesa
minute:

signup

login

tour

Here'showitworks:

Anybodycanask
aquestion

help

Anybodycan
answer

Thebestanswersarevoted
upandrisetothetop

Signup

USART,UART,RS232,USB,SPI,I2C,TTL,etc.whatarealloftheseandhowdotheyrelatetoeach
other?
Asanoviceelectronicshobbyist,Ihaveheardthesetermsandmorebeingthrownaroundeverywhere.Atitsroot,I
understandthattheyareallbasedoncommunicationbetweendevices,computers,peripherals,etc.
Ihaveabasicunderstandingofhowallofthemwork,butIgetconfusedwhenIseesomanyofthemandamhaving
difficultyunderstandinghowtheyrelatetoeachother.Forexample,isUARTasubsetofUSART?Whatisthedifference
betweenRS232andSerial?Whatarethecoredifferencesbetweenallofthesecommunicationmethods:reliability,cost,
application,speed,hardwarerequirements?
Ifyoucanimagine,Ihaveallofthesetermswrittenoncards,scatteredonthecoffeetable,andIneedsomeonetojusthelp
meorganizemyunderstanding.Forgivemeifthisquestionisalittlevague,butIreallyfeelthatisthenatureofthisquestion
alltogether.
communication

editedFeb19'13at13:18

askedAug13'12at18:14

CamilStaps
8,047

10

capcom
41

94

2,265

32

53

relatedquestion:DifferencebetweenUARTandRS232? NickAlexeev Feb7at20:42

4Answers

Serialisanumbrellawordforallthatis"TimeDivisionMultiplexed",tousean
expensiveterm.Itmeansthatthedataissentspreadovertime,mostoftenone
singlebitafteranother.Alltheprotocolsyou'renamingareserialprotocols.
UART,forUniversalAsynchronousReceiverTransmitter,isoneofthemostused
serialprotocols.It'salmostasoldasIam,andverysimple.Mostcontrollershavea
hardwareUARTonboard.Itusesasingledatalinefortransmittingandonefor
receivingdata.Mostoften8bitdataistransferred,asfollows:1startbit(lowlevel),
8databitsand1stopbit(highlevel).Thelowlevelstartbitandhighlevelstopbit
meanthatthere'salwaysahightolowtransitiontostartthecommunication.That's
whatdescribesUART.Novoltagelevel,soyoucanhaveitat3.3Vor5V,
whicheveryourmicrocontrolleruses.Notethatthemicrocontrollerswhichwantto
communicateviaUARThavetoagreeonthetransmissionspeed,thebitrate,as
theyonlyhavethestartbit'sfallingedgetosynchronize.That'scalledasynchronous
communication.
Forlongdistancecommunication(Thatdoesn'thavetobehundredsofmeters)the
5VUARTisnotveryreliable,that'swhyit'sconvertedtoahighervoltage,typically
+12Vfora"0"and12Vfora"1".Thedataformatremainsthesame.Thenyou
haveRS232(whichyouactuallyshouldcallEIA232,butnobodydoes.)
ThetimingdependencyisoneofthebigdrawbacksofUART,andthesolutionis
USART,forUniversalSynchronous/AsynchronousReceiverTransmitter.Thiscando
UART,butalsoasynchronousprotocol.Insynchronousthere'snotonlydata,but
alsoaclocktransmitted.Witheachbitaclockpulsetellsthereceiveritshouldlatch
thatbit.Synchronousprotocolseitherneedahigherbandwidth,likeinthecaseof
Manchesterencoding,oranextrawirefortheclock,likeSPIandI2C.
SPI(SerialPeripheralInterface)isanotherverysimpleserialprotocol.Amaster
sendsaclocksignal,anduponeachclockpulseitshiftsonebitouttotheslave,and
onebitin,comingfromtheslave.SignalnamesarethereforeSCKforclock,MOSI
forMasterOutSlaveIn,andMISOforMasterInSlaveOut.ByusingSS(Slave
Select)signalsthemastercancontrolmorethan1slaveonthebus.Therearetwo
waystoconnectmultipleslavedevicestoonemaster,oneismentionedabovei.e.
usingslaveselect,andotherisdaisychaining,ituseslesshardwarepins(select
lines),butsoftwaregetscomplicated.

http://electronics.stackexchange.com/questions/37814/usartuartrs232usbspii2cttletcwhatarealloftheseandhowdoth

1/3

5/10/2016 communicationUSART,UART,RS232,USB,SPI,I2C,TTL,etc.whatarealloftheseandhowdotheyrelatetoeachother?ElectricalEngineerin
I2C(InterIntegratedCircuit,pronounced"IsquaredC")isalsoasynchronous
protocol,andit'sthefirstweseewhichhassome"intelligence"inittheotherones
dumblyshiftedbitsinandout,andthatwasthat.I2Cusesonly2wires,oneforthe
clock(SCL)andoneforthedata(SDA).Thatmeansthatmasterandslavesend
dataoverthesamewire,againcontrolledbythemasterwhocreatestheclock
signal.I2Cdoesn'tuseseparateSlaveSelectstoselectaparticulardevice,buthas
addressing.Thefirstbytesentbythemasterholdsa7bitaddress(sothatyoucan
use127devicesonthebus)andaread/writebit,indicatingwhetherthenext
byte(s)willalsocomefromthemasterofshouldcomefromtheslave.Aftereach
bytereceivermustsenda"0"toacknowledgethereceptionofthebyte,whichthe
masterlatcheswitha9thclockpulse.Ifthemasterwantstowriteabytethesame
processrepeats:themasterputsbitafterbitonthebusandeachtimegivesa
clockpulsetosignalthatthedataisreadytoberead.Ifthemasterwantsto
receivedataitonlygeneratestheclockpulses.Theslavehastotakecarethatthe
nextbitisreadywhentheclockpulseisgiven.Thisprotocolispatentedby
NXP(formerlyPhillips),tosavelicensingcost,AtmelusingthewordTWI(2wire
interface)whichexactlysameasI2C,soanyAVRdevicewillnothaveI2Cbutitwill
haveTWI.
Twoormoresignalsonthesamewiremaycauseconflicts,andyouwouldhavea
problemifonedevicesendsa"1"whiletheothersendsa"0".Thereforethebusis
wiredOR'd:tworesistorspullthebustoahighlevel,andthedevicesonlysendlow
levels.Iftheywanttosendahighleveltheysimplyreleasethebus.
TTL(TransistorTransistorLogic)isnotaprotocol.It'sanoldertechnologyfordigital
logic,butthenameisoftenusedtorefertothe5Vsupplyvoltage,oftenincorrectly
referringtowhatshouldbecalledUART.

Abouteachoftheseyoucanwriteabook,anditlooksI'mwellonmyway.Thisis
justaverybriefoverview,letusknowifsomethingsneedclarification.
editedJun30'14at12:39

Myanju
163

answeredAug13'12at18:51

stevenvh
7

120k

12

373

588

+1onlyonTTL,I'mguessingthattheOPmeansSerialTTLwhichinmyexperiencedescribestheUART
signalsbeforetheRS232transceiver/busdriver.kennyAug13'12at19:29

2 @Kennybutthereain'tsuchathingas"serialTTL".That'sUART.Whatifthevoltageis3.3V?The
TTLonlyreferstothe5V.stevenvhAug13'12at20:01
that'swhatImtalkingabout,UART'sI/OareoftencalledinmyexperienceTTLSerial.kennyAug13'12
at20:46
Amazingresponse!Iwillreaditafewmoretimes,andletyouknowifIhavequestions.Thanks,
Steven. capcom Aug16'12at2:58

6 AbetterbetwouldbetofishforUartagethen:)VaibhavGargAug22'12at2:37

Thisisveryneartheterritoryofsomethingwhereyouwouldbebetterreading
articlesthanaskingquestionsforcustomresponses,buttoaddressonemajorpoint
whichmanufacturer'ssometimesblur:
Therearetwobasictypesofserialinterfaces:synchronousandasynchronous.
Synchronousinterfaceshavethedatatransmittedwithitstimingrelativetoan
explicitclock,whichisalsoprovided.TheclassicexampleofthisisSPI,butthere
arealsospecialformssuchasI2Sforaudioconverters,JTAG,FPGAconfiguration
interfaces,etc.Manyparallelcommunicationschannelsarejustthisideaextended
tomovingmorebitsatonce.Oftenbutnotalwaysthesesendthemostsignificant
bitfirst.
Asynchronousinterfaceshavethetimingencodedinthedatastreamitself.For
"serialports"andrelatedstandardssuchasRS232,thetimingofthewordis
relativetothestartbit,andthereceivermerelysamplesthelineattheright
intervalsthereafter.Otherinterfacescanbeabitmorecomplicatedandrequire
fancierclockrecoveryusingphaselockedloopsandalgorithms.AUARTisa
"UniversalAsynchronousReceiverTransmitter"reallythenameforafunctional
blockoftenusedtoimplementa"serialport"withsomeflexiblitytowordlength,
rate,andstart/endconditions.ThingssuchasRS232,RS422,etcarestandardsfor
offboardelectricalsignallingofthedatayouwouldgetfromthesevoltage,single
endedordifferential,ifa1ishighorlow,etc.TraditionallyUARTssendtheleast
significantbitfirst.
The"USART"canbeasourceoflegitimateconfusion,asitisasortofhybriddevice,
a"UnversalSynchronous/AsynchronousReceiverTransmitter"Essentially,thisis
andismostcommonlyusedasaUART,butitcanalsobeconfiguredtogenerate(or
consider)aseparateclocksynchronizedtothedata,andmaybeabletoreversethe
bitorder.ItisusuallyconfigurabletointeroperatewithSPI,butitmaynotbeable
toremovethetimededicatedtostart/stopbitssomaynotbeabletooperatewith
somethinglikeI2Swhichcanexpecttohavedataflowingcontinuouslywithoutgaps
betweenwords.

http://electronics.stackexchange.com/questions/37814/usartuartrs232usbspii2cttletcwhatarealloftheseandhowdoth

2/3

5/10/2016 communicationUSART,UART,RS232,USB,SPI,I2C,TTL,etc.whatarealloftheseandhowdotheyrelatetoeachother?ElectricalEngineerin
answeredAug13'12at18:52

ChrisStratton
15.7k

20

50

RS232 isaverysimpleserialprotocolthatwasoriginallyusedformodemsand
teletypes.Itiswhatiscommonlycalledaserialport(oraCOMportinMS
Windows).Onthelineitnominallyuses12Vlevels,buttheymayvarywidelyas
thedetectionisspecifiedat3V.Thereisalwaysalinedriver(nowadaysusually
fromtheMAX232family)thatconvertstheselevelstoandfromtheinternaldigital
signallevelsofacomputerormicrocontroller.
TTLmeanTransistorTransistorLogicandhasitslevelforlogicalzeronear0Vand
forlogicalonenear5V.Oftenany5VlogiciscalledTTL,althoughmostcircuits
nowadaysarebuiltasCMOS.Todaytherearealsomanycircuitsthatworkat3.3V,
whichisnolongerTTL.
WithrespecttotheinternallevelsthelevelsontheRS232lineareinverted,+12V
correspondstologicallowand12Vcorrespondstologicalhigh,whichcanbe
confusing.
Fordescribingthedataformatoneusuallyshowsthelogicalsignal.Whenthelineis
idleitishigh.Atransmissionstartswithalowstartbit,thedatabits,anoptional
paritybitandonetotwostopbits(logical1).Thisiscalledasynchronous
transmission,becausethestartbitsynchronizesthedataforeachbyteseparately.
AUART(UniversalAsynchronousReceiverTransmitter)isadeviceinacomputeror
microcontrollerthatdoesthiskindofasynchronouscommunication.
AUSART(UniversalAsynchronousSynchronousReceiverTransmitter)isadevice
thatcaninadditiondosomekind(s)ofsynchronoustransmission,hencethe
additionalS.Whichkindvaries,youneedtolookitupinthedatasheet.
SPI,IC,andUSBaredifferent(andinthecaseofUSBverylong)stories.
answeredAug14'12at6:19

starblue
5,417

13

24

IagreewithwhathavebeenmentionedaboutSPIandCANprotocols.Toimprove
betterperformance,CANprotocolhasbeendesigned.InthisArbitrationconceptis
usedinwhichtwodevicesarereadytocommunicate,thendependingontheir
prioritythetransmissionorreceptiontakesplace.CANiswidelyusedinmany
industries.
answeredFeb19'13at10:38

user19166
21

protectedbyCommunity Nov18'14at7:30
Thankyouforyourinterestinthisquestion.Becauseithasattractedlowqualityorspamanswersthathadtoberemoved,postingananswernowrequires10reputation
onthissite(theassociationbonusdoesnotcount).
Wouldyouliketoansweroneoftheseunansweredquestions instead?

http://electronics.stackexchange.com/questions/37814/usartuartrs232usbspii2cttletcwhatarealloftheseandhowdoth

3/3

Вам также может понравиться