Sunteți pe pagina 1din 9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

FAQRegisterLogin Search

Raspberry Pi to a Serial Port


Postareply 16posts bybalajivThuJun06,20134:21pm IwanttoreadtheserialportdataonadeviceusingRaspberryPi.ItmeansconnectingtheUSBPortof RaspberryPitotheserialportofadevice. Cansomeonepleaseprovidepointersforthesame?Iamseeingmorequeries/articlesrelatedforotherway roundi.econnectingtotheserialportofRaspberryPi. Posts:24 Joined:MonMay06,20136:08am bySteveSpencerThuJun06,20134:48pm YouwouldtypicallyuseaUSB/Serialconverter.Therearetwobasictypes.Thefirstoneiscommonlyusedby peopletalkingtomicrocontrollersandsimilardevices,ithasaUSBatoneend,andawiringconnector(usually4 or6pinsorsockets)attheother,andisdesignedtouseTTLlevelvoltages. Thesecondisa"true"USB/SerialconverterandhasUSBatoneendandaDB9orDB25(althoughnotoften thesedays!)connectorattheother.ThevoltagelevelsatthatendareRS232"standard"andshouldnotbe connecteddirectlytoanythingonthePi. BothkindsarefreelyavailablefromonlinestoressuchasAmazon,hereareUKlinksforthe"true"serialkind... http://www.amazon.co.uk/ABCProducts%C2...USB+serial ...andtheTTLlevelkind... http://www.amazon.co.uk/USBSerialTTL...+to+serial Whenpluggedin,thePiwillseethecableasaserialport,althoughI'mnotentirelysurewhatnamethedevice wouldhave,exceptitwon'tbe/dev/ttyAMA0 Usinglsusbordmesgafterpluggingitinshouldbeenlighteningthough. Posts:24 Joined:ThuMar28,20139:19am Location:Nottingham,UK byklricksFriJun07,20134:11am

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

1/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

balajivwrote:Iwanttoreadtheserialportdataonadeviceusing RaspberryPi.ItmeansconnectingtheUSBPortofRaspberryPito theserialportofadevice. Cansomeonepleaseprovidepointersforthesame?Iamseeing morequeries/articlesrelatedforotherwayroundi.econnectingto theserialportofRaspberryPi.

IsyourdeviceserialTTLorRS232? Thereisnoreasonyoucan'tusetheserialportoftheRPi.Eitherofthesewillworkandyourserialdevicewon't knowthedifference: 1)Connecta3.3VTTLtoRS232adaptertotheserialport(GPIO)ontheRPi. (IfyourdeviceisserialTTL,thenyoucanconnectthedevicesdirectlyaslongasbothsystemsareusing3.3V levels). Or 2)ConnectaUSBtoserialadaptertoaUSBportontheRPi. (IfyourdeviceisserialTTLthenuseaUSBtoTTLserialconverter) Ipreferthe1stwayasIdon'twanttotieupaUSBport. ThisishowIconnectedtomyserial(RS232)weatherstation. http://64.13.91.137:86/Comp/RPi/Serial.html GohereformyRPiwriteup.Basicconfig,SerialPortaddonetc: http://64.13.91.137:86/Comp/RPi/Rpi.html Posts:308 Joined:SatJan12,20133:01am Location:GrantsPass,OR,USA bybalajivFriJun07,201310:26am SteveSpencerwrote:YouwouldtypicallyuseaUSB/Serial converter.Therearetwobasictypes.Thefirstoneiscommonly usedbypeopletalkingtomicrocontrollersandsimilardevices,it hasaUSBatoneend,andawiringconnector(usually4or6pins orsockets)attheother,andisdesignedtouseTTLlevelvoltages. Thesecondisa"true"USB/SerialconverterandhasUSBatone endandaDB9orDB25(althoughnotoftenthesedays!)connector attheother.ThevoltagelevelsatthatendareRS232"standard" andshouldnotbeconnecteddirectlytoanythingonthePi. BothkindsarefreelyavailablefromonlinestoressuchasAmazon,

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

2/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

hereareUKlinksforthe"true"serialkind... http://www.amazon.co.uk/ABCProducts%C2...USB+serial ...andtheTTLlevelkind... http://www.amazon.co.uk/USBSerialTTL...+to+serial Whenpluggedin,thePiwillseethecableasaserialport,although I'mnotentirelysurewhatnamethedevicewouldhave,exceptit won'tbe/dev/ttyAMA0 Usinglsusbordmesgafterpluggingitinshouldbeenlightening though.

Thanks,Steve.Mostlikely,IwouldhavetouseUSBtoSerial"true"connector.So,Iwouldhavetoconnectthe USBendtoRPiandtheSerialendtothedevice,say,aPC.Isitpossible? Ifyes,doIneedanydriversforthesame? Oncetheconnectionissuccessful,Ineedtouselsusbordmesg. Pleasecorrectme,ifmyunderstandingiswrong. Posts:24 Joined:MonMay06,20136:08am bySteveSpencerFriJun07,201311:05am balajivwrote:[Thanks,Steve.Mostlikely,IwouldhavetouseUSB toSerial"true"connector.So,IwouldhavetoconnecttheUSBend toRPiandtheSerialendtothedevice,say,aPC.Isitpossible? Ifyes,doIneedanydriversforthesame? Oncetheconnectionissuccessful,Ineedtouselsusbordmesg. Pleasecorrectme,ifmyunderstandingiswrong.

IfyouareconnectingtoaPCwithaserialport,yes.However,mostUSBSerialcableswithDB9connectorsare wiredthesamewayastheportonaPC,soyouwillalsoneedanullmodemcablewhichallowsyoutoconnect thetwotogether.ThisisafemalefemalecablewiththeTx/RxsignalsswitchedfromoneendtotheothersoTx atoneendgoestoRxattheotherandviceversa. ForthePi,youshouldn'tneedanydrivers,astheyareautodetected. Ifyouissueanlsusbcommand,itwilllisttheUSBdevicesconnected,andconfirmthatthedeviceis

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

3/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

recognised. Usingdmesgwillletyouseethekernelmessages,andwillprobablyincludetheconnectionoftheUSBdevice, andshouldtellyouthedevicename,whichwillbe/dev/SOMETHING Steve Posts:24 Joined:ThuMar28,20139:19am Location:Nottingham,UK bybalajivFriJun07,20131:00pm SteveSpencerwrote: balajivwrote:[Thanks, Steve.Mostlikely,I wouldhavetouseUSB toSerial"true" connector.So,Iwould havetoconnectthe USBendtoRPiand theSerialendtothe device,say,aPC.Isit possible? Ifyes,doIneedany driversforthesame? Oncetheconnectionis successful,Ineedto uselsusbordmesg. Pleasecorrectme,if myunderstandingis wrong.

IfyouareconnectingtoaPCwithaserialport,yes.However,most USBSerialcableswithDB9connectorsarewiredthesamewayas theportonaPC,soyouwillalsoneedanullmodemcablewhich allowsyoutoconnectthetwotogether.Thisisafemalefemale cablewiththeTx/Rxsignalsswitchedfromoneendtotheotherso TxatoneendgoestoRxattheotherandviceversa. ForthePi,youshouldn'tneedanydrivers,astheyareauto

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

4/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

detected. Ifyouissueanlsusbcommand,itwilllisttheUSBdevices connected,andconfirmthatthedeviceisrecognised. Usingdmesgwillletyouseethekernelmessages,andwill probablyincludetheconnectionoftheUSBdevice,andshouldtell youthedevicename,whichwillbe/dev/SOMETHING Steve

Thanksalot,Steve.Willtryandletyouknowtheresult. Posts:24 Joined:MonMay06,20136:08am byFTrevorGowenFriJun07,20132:33pm FWIWhereisanexampleofaUSBSerialdeviceconnectingaPitoanoldRS232printer/terminal(backinNov. 2012):http://www.cpmspectrepi.webspace.virgin...apter.html Trev. Mainlyrunning"WheezyRaspbian"onfourPi's(anA,B1&2xB2).Notesaboutthembeginat http://www.cpmspectrepi.webspace.virginmedia.com/raspberry_pi/raspiidx.htm

Posts:306 Joined:MonMar04,20136:12pm Location:Bristol,U.K.

bybalajivMonJun10,20131:26pm IconnectedtheUSBendoftrueUSBtoserialconnectorcabletoRaspberryPiusedagenderchangercableto connecttheotherserialendofthecabletotheCPUofPC. TurnedontheCPUaswellastheRaspberryPi. Ongivingthelsusbcommand,Iseetheresultas: pi@raspberrypi~$lsusb Bus001Device002:ID0424:9512StandardMicrosystemsCorp. Bus001Device001:ID1d6b:0002LinuxFoundation2.0roothub

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

5/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

Bus001Device003:ID0424:ec00StandardMicrosystemsCorp. Bus001Device006:ID067b:2303ProlificTechnology,Inc.PL2303SerialPort Bus001Device005:ID413c:2003DellComputerCorp.Keyboard Onusingthedmesgcommand: pi@raspberrypi~$dmesg|greptty [0.000000]Kernelcommandline:dma.dmachans=0x7f35bcm2708_fb.fbwidth=1360bcm2708_fb.fbheight=768 bcm2708.boardrev=0xebcm2708.serial=0xdfe8d5basmsc95xx.macaddr=B8:27:EB:E8:D5:BAsdhci bcm2708.emmc_clock_freq=100000000vc_mem.mem_base=0x1ec00000vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0console=ttyAMA0,115200kgdboc=ttyAMA0,115200console=tty1root=/dev/mmcblk0p2 rootfstype=ext4elevator=deadlinerootwait [0.000000]console[tty1]enabled [0.584216]dev:f1:ttyAMA0atMMIO0x20201000(irq=83)isaPL011rev3 [0.908140]console[ttyAMA0]enabled [31328.703340]usb11.2:pl2303converternowattachedtottyUSB0 Canyoupleaseletmeknowitisfine?Ifnot,whatistheissue? Thanks. Posts:24 Joined:MonMay06,20136:08am bySteveSpencerMonJun10,20131:53pm Bus001Device006:ID067b:2303ProlificTechnology,Inc. PL2303SerialPort

[31328.703340]usb11.2:pl2303converternowattachedto ttyUSB0

Looksfine Yournew"serialport"onthePiis/dev/ttyUSB0,fromthelookofthat.Now,whetherornotyouhaveyour cablingcorrectbetweentheUSBserialendandtheotherdeviceisnotsomethingthiswilltellyou. WhatsoftwareareyouplanningtouseonthePitosend/receivedataonthenewserialport? Steve

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

6/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

Posts:24 Joined:ThuMar28,20139:19am Location:Nottingham,UK bybalajivMonJun10,20132:02pm Steve, Iamplanningtouseminicom.Isitfine? AlsoIwasexpectingsomethinglikettyS*astheserialportdevice.Isitnottherightexpectation? Posts:24 Joined:MonMay06,20136:08am bybalajivMonJun10,20132:59pm Iamreadingliketheoutputofdmesgcommandmustbelike: $dmesg|greptty Output: [37.531286]serial8250:ttyS0atI/O0x3f8(irq=4)isa16550A [37.531841]00:0b:ttyS0atI/O0x3f8(irq=4)isa16550A [37.532138]0000:04:00.3:ttyS1atI/O0x1020(irq=18)isa16550A Posts:24 Joined:MonMay06,20136:08am byExcalMonJun10,20133:51pm Ihavebadexperienceswithusbtoserial. Iorderedhttp://www.ebay.com/itm/NewMAX3232RS232SerialPortToTTLConverterModuleDB9Connector 335VInput/170883124088?pt=LH_DefaultDomain_0&hash=item27c96d8b78for2euro,stillinshippingthough, illletyouknowtheresults. LasteditedbyExcalonTueJun11,201310:15am,edited1timeintotal. Posts:3 Joined:MonJun10,20133:43pm bySteveSpencerMonJun10,20133:54pm Minicomshouldbefineforaterminalemulationprogram. OnthePi,yourserialport(fromtheUSB/Serial)is/dev/ttyUSB0.Theoutputyoujustquotedhas,Iguess,come fromadifferentmachine,whichisequippedwithwhatappeartobetwogenuineUARTchips(16550Achips,to beexact),andtheyresultinportswithdifferentnamesonthatmachine.

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

7/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

AtsomepointintheDebiansoftware,someonedecidedthat/dev/ttyS???wouldbegoodnamesfor"proper" serialports,and/dev/ttyUSB???wouldbegoodnamesforserialportswhichwereUSB/Serialconverters. Steve Posts:24 Joined:ThuMar28,20139:19am Location:Nottingham,UK bybalajivWedJun12,201312:49pm Itriedscreenprogram.Itseemstobehelpful. Cantherebesomethingbetter? Posts:24 Joined:MonMay06,20136:08am byjujubeeThuJun13,20137:39pm Heyguys, IamalsousingausbtoserialadapterontheRaspberryPiandIamhavingsomeissues.TheRaspberryPi (usbend)isconnectedtoaRoomba/iRobotCreate(serialend).IhaveusedscreenandminicomandIcannot sendcommandstotheroomba,eventhoughIcanseethereisaconnection....andwhenIpoweronthe Roombaitsendsdatatothescreen.Ihavetriedmessingwiththesetupinminicomandplayedwiththevarious settingsandnoluck.IamreceivingdataformtheRoombabutIcannotgetthePitosenddatatoit.Anyhelpor advicewouldbeappreciated.Thanks! Posts:1 Joined:WedJun12,20136:17pm bybalajivTueJun18,20134:46pm Thankseveryonefortheguidance. IwasabletoconnecttheRPitoanotherdevicethroughserialtoUSBconverter.Iamabletoconnecttothe deviceusingthecommand: screen/dev/ttyUSB0115200 Ongivingthecommand,Ireachablankscreenontypingenter,IgetCFEpromptwhichhashelpcommands. WhenItrythesamewithanotherdevice,IamnotgettinganypromptatthesametimeIamseeingsomejunk characterwhatcouldbetheissuehere? Thanksinadvance

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

8/9

6/26/13

Raspberry Pi View topic - Raspberry Pi to a Serial Port

Posts:24 Joined:MonMay06,20136:08am SearchThisTopic

Postareply 16posts ReturntoNetworkingandservers Jumpto: Networkingandservers Go

Whoisonline Usersbrowsingthisforum:Noregisteredusersand9guests

Boardindex Theteam Deleteallboardcookies AlltimesareUTC

www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=46321

9/9

S-ar putea să vă placă și