[Oberon] Oberon RS232 - file exchange with Linux / OLR for RPI

Peter Matthias PeterMatthias at web.de
Fri Apr 15 22:07:48 CEST 2016


Current version added possibility to execute Linux commands. Your 
command should look like this:

PROCEDURE Do2*;
VAR pid, res: LONGINT; argv: ARRAY 13 OF LONGINT;

BEGIN

	argv[0]:=SYSTEM.ADR("/bin/stty");
	argv[1]:=SYSTEM.ADR("-F");
	argv[2]:=SYSTEM.ADR("/dev/ttyUSB1");
	argv[3]:=SYSTEM.ADR("19200");
	argv[4]:=SYSTEM.ADR("cs8");
	argv[5]:=SYSTEM.ADR("-cstopb");
	argv[6]:=SYSTEM.ADR("-parenb");
	argv[7]:=SYSTEM.ADR("-crtscts");
	argv[8]:=SYSTEM.ADR("-clocal");
	argv[9]:=SYSTEM.ADR("-cread");
	argv[10]:=SYSTEM.ADR("-echo");
	argv[11]:=0;
	pid:=Linux0.Fork0();
	IF pid=0 THEN res:=Linux0.Execve0(argv[0], SYSTEM.ADR(argv[0]), 
SYSTEM.ADR(argv[12]));
	ELSIF pid<0 THEN Out.String("Error"); Out.Int(pid, 6); Out.Ln;
	END;
END Do2;

More info is in the changelog page.

Regards,
	Peter

Am 12.04.2016 um 19:19 schrieb thomas.kral at email.cz:
> Peter, thank you, Linux exec command would be ideal.
> I was also recommended to use LEO as it has got some facility to execute linux commands through Oberon commands, but is currently x86 platform.
> Many thanks
> Tomas
>
> ---------- Původní zpráva ----------
> Od: Peter Matthias
> Komu: oberon at lists.inf.ethz.ch
> Datum: 12. 4. 2016 18:12:51
> Předmět: Re: [Oberon] Oberon RS232 - file exchange with Linux / OLR for RPI
>
> Am 07.04.2016 um 23:03 schrieb thomas.kral at email.cz:
>> Hi Peter,
>>
>> I found the reason, I had tty "echo" options enabled, now with these settings and "echo" disabled,
>> ORC.Send and ORC Receive works.
>>
>> stty -F /dev/ttyUSB1 19200 cs8 -cstopb -parenb -crtscts -clocal -cread -echo
>>
>> Can you please help in passing the parameters in OLR.V24.Mod?
>
> This would require ioctl banging on the device without that I could test
> it and without that I need it. Sorry, no interest to do that. But I will
> try to implement the ability to execute linux commands within OLR e.g.
> by a proceure like Linux0.Execute( command: ARRAY OF CHAR)
>
> Regards,
> 	Peter
>
>
>
>>
>> ---------- Původní zpráva ----------
>> Od: Peter Matthias
>> Komu: oberon at lists.inf.ethz.ch
>> Datum: 7. 4. 2016 22:40:10
>> Předmět: Re: [Oberon] Oberon RS232 - file exchange with Linux / OLR for RPI
>>
>> Please try this open procedure in V24.Open:
>>
>> PROCEDURE Open*( ttyname: ARRAY OF CHAR): LONGINT;
>> BEGIN
>> 	RETURN Linux0.Open0(SYSTEM.ADR(ttyname[0]), Linux0.RDWR+1000H , 0);
>> END Open;
>>
>> 1000H is D_SYNC flag, should be same on x86 and ARM. If this does not
>> work you would have to send me the relevant output of "strace ./ola" for
>> debugging.
>>
>> Regards,
>> 	Peter
>>
>>
>> Am 06.04.2016 um 22:08 schrieb thomas.kral at email.cz:
>>> Peter,
>>>
>>> I have compiled both OLR.V24.Mod and ORC.Mod.
>>> I modified ORC.Mod, I thought I had to ...
>>> ...
>>> VAR
>>>        portno, pno:  LONGINT;
>>> ....
>>> BEGIN Texts.OpenWriter(W);
>>>        portno := V24.Open("/dev/ttyUSB1");
>>>        pno := portno;
>>> END ORC;
>>>
>>> When receiving a file, I always get only the first block of 255 bytes.
>>>
>>> ORC.TestReq reports 16 = 10H = ACK
>>> ORC.Open reports "connection open"
>>>
>>> But I am not able to receive the whole file, only its first block.
>>>
>>> Can you please advise?
>>>
>>> Many thanks so far.
>>> Tomas
>>>
>>> ---------- Původní zpráva ----------
>>> Od: thomas.kral at email.cz
>>> Komu: Peter Matthias
>>> Datum: 3. 4. 2016 18:47:16
>>> Předmět: Re: [Oberon] Oberon RS232 - file exchange with Linux / OLR for
>>>     RPI
>>>
>>> Peter,
>>>
>>> Thanks so much, I will test and let you know.
>>>
>>> Meanwhile I managed to transfer the whole Bitmaps.Mod right from the shell,
>>>
>>> # longer files >255 could be split into blocks
>>> $ split -b255 Bitmaps.Mod
>>>
>>> # with $FF length byte inserted to the start of each
>>> $ for f in [a-z]*; do echo -ne \\xff | cat - $f > $f.1; done
>>>
>>> # length byte of the last block <255 must be adjusted by hand
>>>
>>> # send REC and file name terminated with NULL!
>>> $ echo -ne \\x21'Bitmaps.Mod'\\0 > /dev/ttyUSB1
>>>
>>> # copy all blocks in a loop
>>> for f in *.1; do echo $f; cp $f /dev/ttyUSB1; done
>>>
>>> Note after each packet sent, ACK should be waited for, this may not be easy to do in shell.
>>>
>>> Tomas
>>>
>>> ---------- Původní zpráva ----------
>>> Od: Peter Matthias
>>> Komu: thomas.kral at email.cz
>>> Datum: 3. 4. 2016 17:31:09
>>> Předmět: Fwd: Re: [Oberon] Oberon RS232 - file exchange with Linux / OLR for
>>>     RPI
>>>
>>> Hi Thomas,
>>>
>>> since default parameters seem to work for you, I made a q&d implementation.
>>> You will first have to open /dev/ttyUSB1 to get the port No.
>>>
>>> Regards,
>>> 	Peter
>>>
>>> -------- Weitergeleitete Nachricht --------
>>> Betreff: Re: [Oberon] Oberon RS232 - file exchange with Linux / OLR for RPI
>>> Datum: Sun, 3 Apr 2016 15:41:03 +0200
>>> Von: thomas.kral at email.cz
>>> Antwort an: ETH Oberon and related systems
>>> An: Peter Matthias
>>> Kopie (CC): ETH Oberon and related systems
>>>
>>> Peter,
>>>
>>> Thanks for explaining now I see.
>>>
>>> I have RISC5 (FPGA Project Oberon 2013) connected to RPI running OLR.
>>> I wanted to exchange files using PCLink1 task at RISC5 end with ORC
>>> master/client on RPI end, as ORC is part of the project.
>>>
>>> Meanwhile I managed my 1st file exchange right from Linux shell, file is
>>> <255 bytes in length = 1 block.
>>> It took me a very long time to discover that name is NULL terminated, I
>>> was putting leading length byte in front first.
>>>
>>> # send REC and file name terminated with NULL!
>>> $ echo -ne \\x21'Test.txt'\\0 > /dev/ttyUSB1
>>>
>>> # copy one block <255 over line
>>> $ cp Test.txt /dev/ttyUSB1
>>>
>>> On Oberon screen I got ..
>>> receiving Test.txt done
>>>
>>> So far so good -:)
>>>
>>> Peter, is there a way to compile in modules for OLR/RPI to support
>>>      /dev/ttyUSBn
>>> Could you please advise?
>>>
>>> This would allow to run ORC master client, which really is the way to
>>> exchange files and also boot RISC5 over RS232 as documented in the project.
>>>
>>> Many thanks so far
>>> Tomas
>>>
>>>
>>> ---------- Původní zpráva ----------
>>> Od: Peter Matthias
>>> Komu: thomas.kral at email.cz, ETH Oberon and related systems
>>> Datum: 3. 4. 2016 14:56:46
>>> Předmět: Re: [Oberon] Oberon RS232 - file exchange with Linux / OLR for RPI
>>>
>>> Hi Tomas,
>>>
>>> I was only following this thread half way.
>>>
>>> Turns out, you want to connect something via V24 to OLR.
>>>
>>> Well, V24 like Centronics and network only are dummy modules needed to
>>> compile other Modules. So you currently have to transfer files via Linux.
>>>
>>> Peter
>>>
>>> Am 03.04.2016 um 10:49 schrieb thomas.kral at email.cz:
>>>> Chris,
>>>>
>>>> Thank you, this helps.
>>>>
>>>> In V24.Mod I can see port number is defined as CONST
>>>>
>>>> portno = 1 but also as pno = 1
>>>>
>>>> I tried recompiling with other values, same thing.
>>>>
>>>> On RPI as on Pepino, serial ports are configured over USB channels.
>>>> I power Pepino from RPI using uUSB cable, it carries the data link as well.
>>>>
>>>> /dev/ttyUSB0 - configured as COM1
>>>> /dev/ttyUSB1 - configured as COM2
>>>>
>>>> Changing the port number to 2 does not help.
>>>>
>>>> Also I noticed OLR provides two modules:
>>>> V24.Mod and OLR.V24.Mod - portable, there is also ConfigV24.Mod.
>>>>
>>>> It seems ports are hooked to IRQs in nonportable version assuming x86 platform?
>>>>
>>>> I am putting Peter Matthias in cc, in hope he may be of help as far as OLR goes.
>>>> So the question might be, how to enable serial ports in OLR/RPI ports?
>>>>
>>>> Many thanks so far
>>>> Tomas
>>>>
>>>> ---------- Původní zpráva ----------
>>>> Od: Chris Burrows
>>>> Komu: ETH Oberon and related systems
>>>> Datum: 3. 4. 2016 9:52:51
>>>> Předmět: Re: [Oberon] Oberon RS232 - file exchange with Linux
>>>>
>>>>> -----Original Message-----
>>>>> From: thomas.kral at email.cz [mailto:thomas.kral at email.cz]
>>>>> Sent: Sunday, 3 April 2016 4:49 PM
>>>>> To: chris at cfbsoftware.com; ETH Oberon and related systems
>>>>> Subject: Re: [Oberon] Oberon RS232 - file exchange with Linux
>>>>>
>>>>> On LNO - OLR for RPI, I got ...
>>>>>
>>>>> OCR.Open - open V24, error=2
>>>>> OCR.Send Test.txt - connection not open
>>>>> OCR.TestReq - I got 0 (zero reply)
>>>>>
>>>>
>>>> Look up error 2 in the source code of your Linux version of V24.Mod.  In the Windows version of V24.Mod the CONST error definitions include:
>>>>
>>>>       NoSuchPort* = 2;
>>>>
>>>> If that is the same for you, check which port you are using in ORC. Make sure it corresponds to the RS232 port on your PC that you have connected to the Pepino board.
>>>>
>>>> Regards,
>>>> Chris
>>>>
>>>> CFB Software
>>>> http://www.astrobe.com/RISC5
>>>>
>>>>
>>>> --
>>>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>>>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>>>>
>>> --
>>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>>> --
>>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>>>
>> --
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>> --
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>


More information about the Oberon mailing list