Python Forum
Understanding Raspberry PI RTS/CTS flow control
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Understanding Raspberry PI RTS/CTS flow control
#1
Hello. I am trying to get modbus working on my Raspberry PI but I cannot fully understand how to implement flow control. I have found and read these two articles:
https://ethertubes.com/raspberry-pi-rts-...w-control/
https://github.com/mholling/rpirtscts

But still I am confused about RTS/CTS flow control. Does it happen automatically on the raspberry PI? if I set the GPIO 16,17 pin modes to RTS/CTS as per this guide: https://ethertubes.com/raspberry-pi-rts-...w-control/
Would that mean that I enable the automatic flow control? I can now connect RTS pin to direction pin of RS485 IC and that should work? Or I still need to toggle these pins in program.

Could someone help me understand
Reply
#2
I have configured the RTS/CTS pins for hardware flow control as per described guide. Now its acting weird:

import serial
import RPi.GPIO as GPIO
import time
sendSerial = serial.Serial ("/dev/serial0", 9600)

#sendSerial.write (str.encode("hello"))
sendSerial.write (100)

 
print("done")
 
 
sendSerial.close()
I have connected RTS(GPIO17) to DIR pin of my RS485 Driver
and RX/TX accordingly

I am running code above and using logic analyzer to capture what comes out of RS485 chip pin A. I do not tink hardware flow control is working properly as I am always getting some garbage even when I am not trying to serial write anything it still the same result see the image below:
https://ibb.co/jVJkgS9


Hoever, when I add some code to manually toggle direction pin, I can see the message go through properly:
the code:
# \x02 - trigger scanning
# \x03 after scanning is done
import serial
import RPi.GPIO as GPIO
import time
sendSerial = serial.Serial ("/dev/serial0", 9600)
#GPIO.setmode(GPIO.BOARD) # Use physical pin numbering
#GPIO.setup(11, GPIO.OUT) # Set pin 10 to be an input pie to be pulled low (off)
 
#GPIO.output(11,1)
#sendSerial.write (str.encode("hello"))
sendSerial.write (100)
#sendSerial.flush()
#GPIO.output(11,0)
 
print("done")
 
 
sendSerial.close()
Now I can read the data that I am writing :
https://ibb.co/c6S4H3W

But the direction pin is holding for too long because the hardware flow control is not working
Reply
#3
After activating flow control using this guide I have checked the gpio tree and it does not appear to have any affect:
https://ibb.co/6NsKZPT
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Alicat Flow Meter data acquisition marenr 0 333 Sep-29-2023, 10:59 PM
Last Post: marenr
  Node Flow Generation in Python Linenloid 0 630 Feb-21-2023, 07:09 PM
Last Post: Linenloid
  Flow Control Help RoadToSensei 5 1,638 Feb-14-2022, 08:21 PM
Last Post: deanhystad
  python 3 raspberry pi 4 dual control motor programming problem yome 0 1,938 Mar-21-2021, 05:17 PM
Last Post: yome
  Understanding Raspberry PI RTS/CTS flow control zazas321 0 1,471 Oct-30-2020, 08:02 AM
Last Post: zazas321
  Creating a Web Browser to control Raspberry Pi shallanq 2 1,870 Apr-11-2020, 03:17 PM
Last Post: ndc85430
  Reproducing assignment with min cost flow in networkx mntfr 0 2,100 Jun-13-2019, 04:06 PM
Last Post: mntfr
  Find Maximum Flow for graph with infinite capacities Dav 6 4,195 Apr-16-2019, 02:08 PM
Last Post: Dav
  program flow advice sampazzer 2 3,076 Aug-05-2017, 09:34 PM
Last Post: sampazzer
  Trouble with general code flow JCN 1 3,362 May-26-2017, 01:27 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020