Recent

Author Topic: Serial on MACOS  (Read 4152 times)

superc

  • Sr. Member
  • ****
  • Posts: 251
Serial on MACOS
« on: March 16, 2022, 02:46:30 pm »
Hello,

I've been trying to get pl_synapseVS to work on Lazarus in a MacOs for days, much to my frustration I still haven't figured out if anyone has managed to get any type of serial to work with this operating system: my question then is to know if someone uses serial communication and if so, which library or component they are using.
With OPM I tried to install LazSerial 0.5 to my dismay I get a series of errors; with pl_synapseVS I get a total lock of the environment and I can't figure out how to configure (fault of my little experience with MacOS).

Thanks in advance.



MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: Serial on MACOS
« Reply #1 on: March 16, 2022, 02:54:29 pm »
I tested serial.pp on Linux, Solaris/SunOS and Windows (probably 2K, it was that long ago) when I last worked on it. I don't recall anybody explicitly saying they'd checked it on a Mac, but neither do I recall any reports of problems.

One particular issue is that Select() works differently on Linux and SunOS. My understanding is that both SunOS and Solaris are derived from the BSD family, which could point a finger to the cause of problems if other developers haven't explicitly tested against at least one member of that lineage.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: Serial on MACOS
« Reply #2 on: March 16, 2022, 03:22:34 pm »
On my MacOS installation, if I declare 'Serial' in the uses section I get an error .... But under windows run correctly....

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: Serial on MACOS
« Reply #3 on: March 16, 2022, 03:28:20 pm »
On my MacOS installation, if I declare 'Serial' in the uses section I get an error .... But under windows run correctly....

What do you mean "AN ERROR"?

*****WHAT***** error?

Does FPC build it for Macs? If not what happens if you copy it from the FPC source files to your project directory and compile it there?

It's a /very/ thin layer on top of the OS, and I specifically worked on it so I could use it in a background thread and capture timing info etc.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: Serial on MACOS
« Reply #4 on: March 16, 2022, 04:33:46 pm »
In windows I've added to my testing program uses serial; well, the same program on MAC inserting the uses 'serial' I receive 'Cannot find serial used by Unit1 of ....';
but if I press CTRL on serial my editor open file Serial .... keep calm, be happy  :)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: Serial on MACOS
« Reply #5 on: March 16, 2022, 05:09:17 pm »
In windows I've added to my testing program uses serial; well, the same program on MAC inserting the uses 'serial' I receive 'Cannot find serial used by Unit1 of ....';
but if I press CTRL on serial my editor open file Serial .... keep calm, be happy  :)

Right, so as I said: copy serial.pp into the directory (if Macs have such things) where the rest of your project files are.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: Serial on MACOS
« Reply #6 on: March 17, 2022, 08:28:47 am »
In windows I've added to my testing program uses serial; well, the same program on MAC inserting the uses 'serial' I receive 'Cannot find serial used by Unit1 of ....';
but if I press CTRL on serial my editor open file Serial .... keep calm, be happy  :)

Right, so as I said: copy serial.pp into the directory (if Macs have such things) where the rest of your project files are.

MarkMLl

Hello,

as you advised me, when I copied serial.pp into project program has compiled correctly; now I'm try to write and read with a serial with a example and I report result ...

Thank you MarkMLI.


MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: Serial on MACOS
« Reply #7 on: March 17, 2022, 08:53:42 am »
as you advised me, when I copied serial.pp into project program has compiled correctly; now I'm try to write and read with a serial with a example and I report result ...

Thank you MarkMLI.

I'm interested to know how you get on. I suggest not testing the two functions with timeouts until you have some confidence in the rest, since they're what relies on select().

I use it heavily myself, and have a couple of mods pending... which I'm not doing since I can't test on all platforms. The first is to address the problem that Windows locks the port but Linux (and probably SunOS) doesn't, the second is to investigate some sort of "how much is queued" function. However these can be done fairly easily at the application level, since the functions use a standard handle hence any of the unix ioctls can be used.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: Serial on MACOS
« Reply #8 on: March 17, 2022, 10:55:01 am »

To speed up the tests do you have an example of a program to read and write from the serial? I looked around quickly but found nothing.

Thanks in advance.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: Serial on MACOS
« Reply #9 on: March 17, 2022, 11:03:41 am »
In the interest of a quick response: try https://github.com/MarkMLl/ping-arduino-loader although you'll need to replace the SerReadTimeout() with something simpler initially. Having an Arduino to hand will obviously help, but in any event it's a useful starting point.

There was a much more comprehensive test program with the patch when it went to Mantis but it wasn't included with the released files. If you still have problems I'll look in more detail later.

Slightly later: I'm appending the interactive test program, but it also uses timeouts and operation is... quirky.

MarkMLl
« Last Edit: March 17, 2022, 11:14:28 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

WayneSherman

  • Sr. Member
  • ****
  • Posts: 257
Re: Serial on MACOS
« Reply #10 on: March 17, 2022, 05:32:12 pm »
To speed up the tests do you have an example of a program to read and write from the serial?

If you have a Windows computer handy, you can use realterm as a test endpoint to test basic serial communications:
https://realterm.sourceforge.io/
https://sourceforge.net/projects/realterm/

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: Serial on MACOS
« Reply #11 on: March 17, 2022, 08:58:03 pm »
To speed up the tests do you have an example of a program to read and write from the serial?

If you have a Windows computer handy, you can use realterm as a test endpoint to test basic serial communications:
https://realterm.sourceforge.io/
https://sourceforge.net/projects/realterm/


Very interesting program, Thank you

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: Serial on MACOS
« Reply #12 on: March 17, 2022, 09:39:57 pm »
Couple of simple demos attached. Echo bounces anything received on the serial line back, Term sends keyboard input to the line and vice versa.

Updated: fixed version of Term.pas now attached.

MarkMLl
« Last Edit: March 18, 2022, 11:53:07 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: Serial on MACOS
« Reply #13 on: March 18, 2022, 07:54:10 am »
Hello,

With OPM I tried to install LazSerial 0.5 to my dismay I get a series of errors;
The 0.5 version of TLazserial does'nt work under Os-X (compile errors, blocking open connect, scanports not working).
I have missed a patch from rphoover  for OS-X here because during that time, i had no github repository for TLazserial.
The patch doesn't work with my version 0.5 because not made with this version.
I have made a new version of TLazserial (0.6) with the content of the patch.
Quote
new in v0.6 version (03/2022)
 Fixes for OS-X (thanks to rphoover), SynSer(synaser) properties now persistent, v0.3 of GPS simulator
 On OS-X you must set the new property  SynSer/NonBlock to True  in the properties of TLazserial component.

it seems now OK on OS-X (see Capture of GPS Simulator (demo program of TLazserial) on OS-X in Attachment). Checked on OS-X Catalina 10.15 Lazarus 2.0.10 with FTDI USB serial adapter.

You can download the new package on my Github repository  (master is 0.6) (Code/Clone or Download Zip).
If it is OK the new version will go to the OPM.

Friendly, J.P


Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

superc

  • Sr. Member
  • ****
  • Posts: 251
Re: Serial on MACOS
« Reply #14 on: March 18, 2022, 08:33:15 am »
Hello,

I'm trying to install new component but I received an error like same my old post: always these damn libcrypto ....

I'm now using BigSur 11.6.4 on MacPro retina 13, with Lazarus 2.2.0 and Fpc 3.2.2

 

TinyPortal © 2005-2018