Recent

Author Topic: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?  (Read 3543 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
I am little confused when it comes to Serial Communication. So, I wrote a program that is supposed to communicate through ttyAMA0 port non-stop every 50 milliseconds with an external device. My program is able to send the data to the device, but it doesn't see the data coming back from the device. I dug a little deeper into the issue and found out that Request To Send (RTS) line is not toggled at all. So, RTS is always high and doesn't drop to read data. So, is this is a known issue with Lazarus or Raspberry pi? Is there a workaround?

I am using TLazSerial for this and have set RTS to toggle EnableRTSToggle(true), but it is not toggling the RTS line... Any help or hints will be greatly appreciated.
« Last Edit: April 13, 2016, 10:36:32 pm by reltek »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?
« Reply #1 on: April 14, 2016, 02:13:15 am »
hello reltek,

read this

What model of raspberry pi, have you ?

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

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
Re: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?
« Reply #2 on: April 15, 2016, 04:32:33 pm »
Thank you Jurassic Pork.

After reading your reply and going through the link you provided, I realized something wasn't right with my Raspberry PI setup.

I will provide more details and it might help others.

Because Raspberry PI output is 3.3V and the device it talks to uses 5V, I use what's called Db9 Level Shifter. I assumed that Raspberry PI's RTS line or PIN was connected to the Db9 Level Shifter. So, I can toggle the RTS line. Unfortunately, it wasn't even connected though Db9 Level Shifter has a port for you to connect your Raspberry PI's RTS pin directly. That's why my program never worked.

Thanks... :)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
Re: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?
« Reply #3 on: May 03, 2016, 08:33:06 pm »
Hi JP,

I got more questions related to this RTS Line.

Finally, I got access to RTS line on Raspberry PI for my program to use with serial communication. I followed that link you posted and made all the changes as instructed on that webpage successfully. However, TLazserial doesn't toggle the RTS Line even though I told it to toggle RTS line. I am assuming that TLazSerial is looking at predefined pin for RTS on the DB9 comport. Am I correct? If so, RTS toggling on Raspberry PI by TLazSerial won't work. Is there away to Tell TLazSerial which pin to toggle for RTS on Raspberry PI?

Thank you for your help.


Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?
« Reply #4 on: May 04, 2016, 03:07:35 am »
hello,
sorry, i can't help you, may be someone from synapse team can help you. The synaser unit (used in Tlazserial) come from synapse project.

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

mas steindorff

  • Hero Member
  • *****
  • Posts: 532
Re: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?
« Reply #5 on: May 04, 2016, 03:28:57 am »
I use synaser but I do not use lazserial (it was not around when I created my interface).
if what JP say's is true, they may be the same thing. 
if so, you can have the RTS line run automatically by setting the last parameter of the obj.config() to true (hardware handshaking).  if you don't, then you can  control it yourself just by setting the obj.RTS := state.

FYI: I believe data flows when the line is positive voltage or high on most 3.3 systems.  low = hold
windows 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
Re: Can you toggle or control RTS line on Raspberry PI's ttysA0M0?
« Reply #6 on: May 04, 2016, 02:37:35 pm »
Hi Steindorff,

Yes, that's what you do using Standard DB9 connection which is located in back of your computer. Those DB9 pins on your computer is already predefined as a standard. So, when someone writes a component or control, they use those pins as defined. In other word, it is universal when you say just set obj.RTS := true. The component already knows which pin to toggle on your DB9 connection. You can't change that (Correct me if I am wrong). As far as Raspberry PI goes, you can tell PI to assign any usable PINS on the board as RTS line. So, this information has be applied to the component or in this case Synaser that you are using. Otherwise, it won't work. That's what I am stuck on. I will have to do some more research.

Thanks JP for your help and steindorff thank you for your input.

 

TinyPortal © 2005-2018