Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #308 > unrolled thread

Serial terminal

Started byTheo Markettos <theom+news@chiark.greenend.org.uk>
First post2011-05-18 19:27 +0100
Last post2011-05-20 16:23 +0100
Articles 10 — 6 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  Serial terminal Theo Markettos <theom+news@chiark.greenend.org.uk> - 2011-05-18 19:27 +0100
    Re: Serial terminal Alex Macfarlane Smith <nospam@archifishal.co.uk> - 2011-05-18 20:46 +0100
      Re: Serial terminal Theo Markettos <theom+news@chiark.greenend.org.uk> - 2011-05-18 21:04 +0100
        Re: Serial terminal Theo Markettos <theom+news@chiark.greenend.org.uk> - 2011-05-18 22:05 +0100
          Re: Serial terminal Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-05-20 00:59 +0200
            Re: Serial terminal "Ste (news)" <steve@revi11.plus.com> - 2011-05-20 00:43 +0100
            Re: Serial terminal James Peacock <j.peacock.news@googlemail.com> - 2011-05-20 10:35 +0100
              Re: Serial terminal Theo Markettos <theom+news@chiark.greenend.org.uk> - 2011-05-20 17:44 +0100
    Re: Serial terminal jgharston <jgh@arcade.demon.co.uk> - 2011-05-20 01:25 -0700
      Re: Serial terminal Theo Markettos <theom+news@chiark.greenend.org.uk> - 2011-05-20 16:23 +0100

#308 — Serial terminal

FromTheo Markettos <theom+news@chiark.greenend.org.uk>
Date2011-05-18 19:27 +0100
SubjectSerial terminal
Message-ID<9Oh*KpqDt@news.chiark.greenend.org.uk>
Can someone tell me how to write a simply BASIC dumb terminal?  I have a
RO3.6 A7000 board attached to a PC via a null modem cable.  The A7000 has no
hard drive, and no means to get software on it, so I need to write something
I can type in in BASIC.

I know the PC serial port and null modem cable work.  I'm sending bytes from
the A7000 to the PC OK, but nothing the other way, either with OS_SerialOp 4
or *FX2,1 or *type serial: I've just swapped it out for a Risc PC, exactly
the same results.  Both have been power-on-delete reset.  So it's not a
hardware problem.

I remember various A300 compatibility issues concerning bugs in the serial
chip which meant a specially-wired cable.  The trouble is I can't remember
what the OS defauts to - whether it is still set up for the special cable,
or defaults to 'PC' mode.  I've tried jiggling around with the values of
OS_SerialOp 0 and 1, but to no avail.

I recall writing a dumb terminal in a few lines of BASIC on a BBC Micro...
it can't be that hard can it?

Thanks
Theo

[toc] | [next] | [standalone]


#309

FromAlex Macfarlane Smith <nospam@archifishal.co.uk>
Date2011-05-18 20:46 +0100
Message-ID<4dd4222b$0$310$14726298@news.sunsite.dk>
In reply to#308
On 18/05/2011 19:27, Theo Markettos wrote:
> Can someone tell me how to write a simply BASIC dumb terminal?  I have a
> RO3.6 A7000 board attached to a PC via a null modem cable.  The A7000 has no
> hard drive, and no means to get software on it, so I need to write something
> I can type in in BASIC.
>
> I know the PC serial port and null modem cable work.  I'm sending bytes from
> the A7000 to the PC OK, but nothing the other way, either with OS_SerialOp 4
> or *FX2,1 or *type serial: I've just swapped it out for a Risc PC, exactly
> the same results.  Both have been power-on-delete reset.  So it's not a
> hardware problem.
>
> I remember various A300 compatibility issues concerning bugs in the serial
> chip which meant a specially-wired cable.  The trouble is I can't remember
> what the OS defauts to - whether it is still set up for the special cable,
> or defaults to 'PC' mode.  I've tried jiggling around with the values of
> OS_SerialOp 0 and 1, but to no avail.
>
> I recall writing a dumb terminal in a few lines of BASIC on a BBC Micro...
> it can't be that hard can it?
>
> Thanks
> Theo


http://serialportprogramming.blogspot.com/2008/05/accessing-serial-port-from-c.html

mentions that you need to turn on the serial port input using an OS_Byte 
call - don't know if that's still true, but it's worth a go. My only 
other suggestion would be checking that the receive baudrate is set 
correctly (OS_SerialOp 5 and 6 it seems)

Alex.

[toc] | [prev] | [next] | [standalone]


#310

FromTheo Markettos <theom+news@chiark.greenend.org.uk>
Date2011-05-18 21:04 +0100
Message-ID<-Oh*qMqDt@news.chiark.greenend.org.uk>
In reply to#309
Alex Macfarlane Smith <nospam@archifishal.co.uk> wrote:
> http://serialportprogramming.blogspot.com/2008/05/accessing-serial-port-from-c.html
> 
> mentions that you need to turn on the serial port input using an OS_Byte 
> call - don't know if that's still true, but it's worth a go. My only 
> other suggestion would be checking that the receive baudrate is set 
> correctly (OS_SerialOp 5 and 6 it seems)

Hmm... I've been doing:

<clean boot machine>
CMOS is set to
*Configure Data 5
*Configure Baud 8
Set baud rate to 19200 baud:
*FX7,8
*FX8,8
Enable serial tx of VDU output
*FX3,1
Enable serial rx to command line
*FX2,1

Up to the FX3,1 that produces output on the other end of the serial link. 
When I do FX2,1, the RISC OS keyboard stops responding (as it should) but
characters entered on the PC don't appear on the RISC OS screen.  The PC has
flow control turned off.

I'm pretty sure that used to work on a BBC Micro.

I did fiddle with the settings to OS_SerialOp 0 and 1 but to no avail.  I
shall have to try that again.

Theo

[toc] | [prev] | [next] | [standalone]


#311

FromTheo Markettos <theom+news@chiark.greenend.org.uk>
Date2011-05-18 22:05 +0100
Message-ID<9Oh*G0qDt@news.chiark.greenend.org.uk>
In reply to#310
Theo Markettos <theom+news@chiark.greenend.org.uk> wrote:
> I did fiddle with the settings to OS_SerialOp 0 and 1 but to no avail.  I
> shall have to try that again.

This:
http://acorn.chriswhy.co.uk/docs/Acorn/AN/234.pdf

does suggest the standard OS settings are designed to use the ancient
'Acorn' cable, and mucking with OS_SerialOp 0 is necessary to use a 'PC'
cable.  Actually, I don't care: 2-wire crossover is fine to start with
though I will need flow control later.  So I probably do need to mess with
it.

For full flow control I think I want %00100110, and for no handshaking I'll
try %10010110.

Does OS_SerialOp have sensible defaults on later OSs?  It must be a long
while since anyone wired an 'Acorn' cable.

Theo

[toc] | [prev] | [next] | [standalone]


#314

FromRick Murray <heyrickmail-usenet@yahoo.co.uk>
Date2011-05-20 00:59 +0200
Message-ID<4dd5a0ea$0$14694$ba4acef3@reader.news.orange.fr>
In reply to#311
On 18/05/2011 23:05, Theo Markettos wrote:

> Does OS_SerialOp have sensible defaults on later OSs?  It must be a long
> while since anyone wired an 'Acorn' cable.

When I wrote my little terminal prog, I loaded and used the serial 
blockdrivers. Not much help to you, I know, but I got fed up of SerialOp 
doing different things to what I expected...


Best wishes,

Rick.

[toc] | [prev] | [next] | [standalone]


#315

From"Ste (news)" <steve@revi11.plus.com>
Date2011-05-20 00:43 +0100
Message-ID<51d6104786steve@revi11.plus.com>
In reply to#314
In article <4dd5a0ea$0$14694$ba4acef3@reader.news.orange.fr>,
   Rick Murray <heyrickmail-usenet@yahoo.co.uk> wrote:
> On 18/05/2011 23:05, Theo Markettos wrote:
>
> > Does OS_SerialOp have sensible defaults on later OSs?  It must be a long
> > while since anyone wired an 'Acorn' cable.
>
> When I wrote my little terminal prog, I loaded and used the serial 
> blockdrivers. Not much help to you, I know, but I got fed up of SerialOp 
> doing different things to what I expected...

Here's my utterly untested serial terminal program. Good luck with this...

  in%  = 0
  out% = 0
  ON ERROR PROCerror
  
  *FX 7 8
  *FX 8 8
  SYS "OS_Byte", 129, 0, 255 TO , hw%
  IF hw% < &AA THEN
    REM Pre-Iyonix uses Serial module
    in%  = OPENIN"devices#baud19200;sleep:$.Serial"
    out% = OPENOUT"devices#baud19200;sleep:$.Serial"
  ELSE
    REM Iyonix and later uses DualSerial module (assume serial1 port)
    in%  = OPENIN"devices#baud19200;sleep:$.Serial1"
    out% = OPENOUT"devices#baud19200;sleep:$.Serial1"
  ENDIF
  
  DIM buf% 256
  REPEAT
    INPUT"Send: " $(buf%)
    send%      = LEN $(buf%)
    buf%?send% = 13
    SYS "OS_GBPB", 2, out%, buf%, send% + 1
    read% = EXT#in%
    IF read% THEN
      SYS "OS_GBPB", 4, in%, buf%, read%
      buf%?read% = 13
      PRINT"Recv '" $(buf%) "'"
    ENDIF
  UNTIL send% = 0
  
  IF in%  THEN CLOSE#in%
  IF out% THEN CLOSE#out%
  QUIT
  :
  DEF PROCerror
    ON ERROR OFF
    PRINT REPORT$ " at line " STR$(ERL)
    IF in%  THEN CLOSE#in%
    IF out% THEN CLOSE#out%
    QUIT
  ENDPROC
  :

Probably best to run this in a task window. Yes, there's potential for
buffer overflows, etc.

Ta,

Steve

-- 
Steve Revill @ Home
Note: All opinions expressed herein are my own.

[toc] | [prev] | [next] | [standalone]


#317

FromJames Peacock <j.peacock.news@googlemail.com>
Date2011-05-20 10:35 +0100
Message-ID<328146d651.james@iyonix.lan>
In reply to#314
Rick Murray wrote:

> On 18/05/2011 23:05, Theo Markettos wrote:
> 
>> Does OS_SerialOp have sensible defaults on later OSs?  It must be a long
>> while since anyone wired an 'Acorn' cable.
> 
> When I wrote my little terminal prog, I loaded and used the serial
> blockdrivers. Not much help to you, I know, but I got fed up of SerialOp
> doing different things to what I expected...

I've used the following to talk to a beagle board's debug terminal 
before. It worked on RISC OS 5, can't test it on anything earlier, 
you'll probably need to remove the 'sleep' in port$ and change 
'Serial1'.

James


port_in%=0
port_out%=0
ON ERROR ON ERROR OFF:PROCclose:PROCerror:END

port$="Devices#sleep;baud=115200;data=8;stop=1;noparity;nohandshake:$.Serial1"
port_in%=OPENIN(port$)
port_out%=OPENOUT(port$)

IF port_in%=0 ERROR 1,"Can't open for input"
IF port_out%=0 ERROR 1,"Can't open for output"

REPEAT
  IF EXT#port_in%=0 THEN
    k% = INKEY(1)
    IF k%>=0 BPUT#port_out%,k%
  ELSE
    PRINT CHR$(BGET#port_in%);
  ENDIF
UNTIL FALSE
END

DEF PROCclose
IF port_in%<>0 CLOSE#port_in%:port_in%=0
IF port_out%<>0 CLOSE#port_out%:port_out%=0
ENDPROC

DEF PROCerror
PRINT "Error: ";REPORT$;" at line ";ERL
ENDPROC

[toc] | [prev] | [next] | [standalone]


#319

FromTheo Markettos <theom+news@chiark.greenend.org.uk>
Date2011-05-20 17:44 +0100
Message-ID<+Oh*zAADt@news.chiark.greenend.org.uk>
In reply to#317
James Peacock <j.peacock.news@googlemail.com> wrote:
> I've used the following to talk to a beagle board's debug terminal 
> before. It worked on RISC OS 5, can't test it on anything earlier, 
> you'll probably need to remove the 'sleep' in port$ and change 
> 'Serial1'.
> 
> port$="Devices#sleep;baud=115200;data=8;stop=1;noparity;nohandshake:$.Serial1"

It looks like the special field parameters aren't supported in RO3.6: I
tried it and output came out at 1200 baud (which might have been the baud
rate the machine was previously set to, can't remember).

I didn't receive any input, but that might have been due to OS_SerialOp 0
settings (see my other post).

Theo

[toc] | [prev] | [next] | [standalone]


#316

Fromjgharston <jgh@arcade.demon.co.uk>
Date2011-05-20 01:25 -0700
Message-ID<29ee7291-a554-483b-adfa-3ec918ae894b@bl1g2000vbb.googlegroups.com>
In reply to#308
Theo Markettos wrote:
> Can someone tell me how to write a simple BASIC dumb terminal?

ON ERROR OS."FX2":OS."FX3":REPORT:P.:END
*FX2,2
REPEAT
IFADVAL(-1):OS."FX3,1":VDU GET:*FX3
IFADVAL(-2):OS."FX2,1":VDU GET:*FX2,2
UNTIL FALSE

[toc] | [prev] | [next] | [standalone]


#318

FromTheo Markettos <theom+news@chiark.greenend.org.uk>
Date2011-05-20 16:23 +0100
Message-ID<-Oh*IhADt@news.chiark.greenend.org.uk>
In reply to#316
jgharston <jgh@arcade.demon.co.uk> wrote:
> ON ERROR OS."FX2":OS."FX3":REPORT:P.:END
> *FX2,2
> REPEAT
> IFADVAL(-1):OS."FX3,1":VDU GET:*FX3
> IFADVAL(-2):OS."FX2,1":VDU GET:*FX2,2
> UNTIL FALSE

Hmm... that works, but I only ever get one character of input per run.
Output works fine.  Something is definitely up with flow control.

Ah, I got it working without flow control by doing:
SYS "OS_SerialOp",0,%110110110,&fffffe00

and with %100010110 I can get RTS/CTS flow control working for receiving,
but transmitting cannot now send anything.  I've tried various combinations
of bits 4-7 to no avail.  The other end claims to be using RTS/CTS, so I'm
not sure what's up.

Theo

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web