Recent

Author Topic: [SOLVED] TLazSerial - RTS/DTR  (Read 561 times)

DelphiDinosaur

  • New Member
  • *
  • Posts: 15
[SOLVED] TLazSerial - RTS/DTR
« on: April 18, 2023, 04:12:09 pm »
Is there any active development of the TLazSerial/SynaSer component?
I'm using LazSerial v0.6 with SynaSer.pas with version 007.005.002.

The problem I'm having is that when the component is created the RTS/DTR lines are being toggled before the hand-shaking settings applied to the component take effect (TLazSerial.Flowcontrol := fcNone).

Normally this isn't a problem, but I've got some legacy hardware (which I can do nothing about) which uses the control lines to put it into an engineering mode resulting in all kind of related issues. The serial link is via USB so I can't just cut the control lines. ALL hardware issues have been considered!

Short of delving into the  LazSerial & SynaSer code, is there a way of avoiding the RTS/DTR lines being activated before I've told the control how I want it to behave?

Haven't seen anything like this with the AsyncPro controls I used with Delphi 6 & XE3.

Are there any other cross-platform serial components that are worth considering for Lazarus?

DelphiDino.

Lazarus 2.2.2
FPC 3.2.2
« Last Edit: April 20, 2023, 02:37:48 pm by DelphiDinosaur »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLazSerial - RTS/DTR
« Reply #1 on: April 18, 2023, 04:46:23 pm »
Hello,
Have you code to show what is the problem ?
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

tetrastes

  • Sr. Member
  • ****
  • Posts: 483
Re: TLazSerial - RTS/DTR
« Reply #2 on: April 19, 2023, 10:56:44 pm »
In synaser.pas in TBlockSerial.Config find
Code: Pascal  [Select][+][-]
  1.   if hardflow then
  2.     dcb.Flags := dcb.Flags or dcb_OutxCtsFlow or dcb_RtsControlHandshake
  3.   else
  4.     dcb.Flags := dcb.Flags or dcb_RtsControlEnable;
  5.   dcb.Flags := dcb.Flags or dcb_DtrControlEnable;
  6.  

and change it to
Code: Pascal  [Select][+][-]
  1.   if hardflow then
  2.     dcb.Flags := dcb.Flags or dcb_OutxCtsFlow or dcb_RtsControlHandshake;
  3.   //else
  4.   //  dcb.Flags := dcb.Flags or dcb_RtsControlEnable;
  5.   //dcb.Flags := dcb.Flags or dcb_DtrControlEnable;
  6.  

DelphiDinosaur

  • New Member
  • *
  • Posts: 15
Re: TLazSerial - RTS/DTR
« Reply #3 on: April 20, 2023, 02:37:20 pm »
In synaser.pas in TBlockSerial.Config find
---------8<---------

Thanks tetrastes the change to TBlockSerial.Config worked. I've expanded it to include a new setting allowing me to revert to the original behaviour.

TBlockSerial.Connect also needed modifying to prevent the RTS and DTR lines being set when the port is opened.


DelphiDino.

 

TinyPortal © 2005-2018