RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Porting RISC OS →

Using serial port on Raspberry Pi

Subscribe to Using serial port on Raspberry Pi 11 posts, 7 voices

 
Jul 7, 2016 9:08pm
Avatar Gerald Holdsworth (2084) 47 posts

Do I need any extra modules to send/receive strings down the Raspberry Pi serial pins, or is it all built into the OS?
I’ve seen mention of OS_SerialOp – does this do the job on the RPi?

Cheers,

Gerald.

 
Jul 8, 2016 4:57am
Avatar Ronald May (387) 410 posts

PiSerial blockdrivers can be found here
http://www.tankstage.co.uk/Software/PiSerial.zip

 
Jul 8, 2016 7:19pm
Avatar Gerald Holdsworth (2084) 47 posts

Cheers Ronald – I’ll give it a go.

 
Oct 10, 2016 12:42pm
Avatar Jeffrey Lee (213) 4859 posts

FYI as of today the development Pi ROMs should have working serial port support (OS_SerialOp + DeviceFS Serial1 interface). The Internal32 block driver (or similar) should work.

If people need to stick with PiSerial or other solutions then they should be able to *RMKill Serial to stop the OS’s driver from interfering with things

 
Oct 14, 2016 2:10pm
Avatar Raik (463) 1384 posts

Is a PiSerial module aviable that works on a RPi2?

 
Oct 14, 2016 5:14pm
Avatar John Williams (567) 516 posts

FYI as of today the development Pi ROMs should have working serial port support (OS_SerialOp + DeviceFS Serial1 interface). The Internal32 block driver (or similar) should work.

I have a socket with flying leads – how do I connect it, please, to use this facility? RPi2 B running 5.23 (10-Oct-16).

Could someone put a reference page up, please?

 
Dec 20, 2016 10:02pm
Avatar Gerald Holdsworth (2084) 47 posts

Following from Jeffery’s post above (10th October), I have finally got RISC OS onto my borrowed Pi3 (which has a Serial add-on card, plugging into the GPIO pins) and have knocked up the following programs:

REM>SerialReceive
PRINT"Waiting"
REM Set up the serial device
REM 8 bit word, 1 stop bit, no parity
SYS"OS_SerialOp",1,%000000
REM 9600 Baud rate
SYS"OS_SerialOp",5,0:REM RX
SYS"OS_SerialOp",6,0:REM TX
REM Read from the serial buffers
REPEAT
SYS"OS_SerialOp",4,0 TO ,c%
IF c%>31 AND c%<127 VDUc%
UNTILFALSE

and:

REM>SerialSend
REPEAT
INPUT"Text to send: “t$
REM Set up the serial device
REM 8 bit word, 1 stop bit, no parity
SYS”OS_SerialOp",1,%000000
REM 9600 Baud rate
SYS"OS_SerialOp",5,0:REM RX
SYS"OS_SerialOp",6,0:REM TX
REM Send the text to the serial buffers
FOR i%=1 TO LENt$
c%=ASCMID$(t$,i%,1)
SYS"OS_SerialOp",3,c%
NEXT
UNTILFALSE

but am unable to communicate with my Windoze 10 laptop using a USB to serial adapter and TeraTerm software. Am I missing something?
I’ve installed the October firmware update (low vector), and RISC OS 5.23 (5th December), and I’ve ensured that the serial modules are enabled.

Cheers,

Gerald.

 
Dec 20, 2016 10:47pm
Avatar Dave Higton (1515) 1599 posts

Is the cable connected correctly? If it is, you should be able to measure several volts on each of pins 2 and 3 of the 9 pin D type connector, relative to pin 5. This is general advice for checking an EIA-232 connection, so it’s worth remembering.

If the cable is not correct, the chances are that only one of pins 2 and 3 will have significant voltage; this would indicate that you’ve got two transmitters trying to transmit to each other, and two receivers listening to each other – and that ain’t going to do anything useful. If it is like that, you could fix it by swapping pins 2 and 3 in the cable at one end.

 
Dec 21, 2016 11:35am
Avatar Dave Higton (1515) 1599 posts

Another thing to try: if you connect pins 2 and 3 together and run both your apps in task windows, you should be able to type to yourself.

 
Dec 21, 2016 6:12pm
Avatar Gerald Holdsworth (2084) 47 posts

Sorry, I forgot to mention that the serial cable is one I have previously used to get my work PC to talk to various bits of kit. However, I’ll stick a voltmeter on the pin and see if it shows anything. I was going to stick an oscilloscope on it.

Never thought of connecting pins 2 and 3 together…good idea – I’ll give it a go.

 
Dec 21, 2016 6:34pm
Avatar Steve Pampling (1551) 3769 posts

Sorry, I forgot to mention that the serial cable is one I have previously used to get my work PC to talk to various bits of kit.

While PC’s are DCE presentation and require a null modem cable (cross-over) to connect to another DCE device most of the dev board serial port presentations are DTE and therefore the connections are pin-to-pin.

Never thought of connecting pins 2 and 3 together

Normally you’d need to do some hardware handshake connections too but the Pi and various other dev boards don’t pass the handshake pins through and reply on software handshake.

One trick is to connect the output of your board to the serial input on a PC and run Putty at the right baud rate. All printable characters sent will appear in the putty console window.

Reply

To post replies, please first log in.

Forums → Porting RISC OS →

Search forums

Social

Follow us on and

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

Description

Technical discussions for people porting RISC OS to new hardware.

Voices

  • Gerald Holdsworth (2084)
  • Ronald May (387)
  • Jeffrey Lee (213)
  • Raik (463)
  • John Williams (567)
  • Dave Higton (1515)
  • Steve Pampling (1551)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys