]> git.leonardobizzoni.com Git - pioneer-stm32/commitdiff
reset mcu from serial adapter
authorFederica Di Lauro <federicadilauro1998@gmail.com>
Sun, 15 Mar 2020 14:14:36 +0000 (15:14 +0100)
committerFederica Di Lauro <federicadilauro1998@gmail.com>
Sun, 15 Mar 2020 14:14:36 +0000 (15:14 +0100)
utils/catkin_ws/src/serial_bridge/scripts/serial_receiver.py
utils/catkin_ws/src/serial_bridge/scripts/serial_transmitter.py

index da14e7414b941dd6875488b07e111f6188ff22d1..ef5abc057206eab5d99211a532024b6162b03e53 100755 (executable)
@@ -24,6 +24,9 @@ ser = serial.Serial(
 def serial_receiver():
     rospy.init_node('serial_receiver', anonymous=True, log_level=rospy.DEBUG)
     serial_port = rospy.get_param("serial_port")
+    #dtr is connected to RST, on opening dtr is high by default so it resets the st board
+    #after opening the serial port we set it low so the board can boot
+    ser.dtr = 0 
     while(ser.is_open == False and not rospy.is_shutdown()):
         try:
             ser.port = serial_port
index 0f919a96c81532535c7ab8455fc8f876a12cdfe2..cdd45d999cf6a8a2b507da203f0003aaa10f0f4c 100755 (executable)
@@ -9,7 +9,6 @@ from serial import SerialException
 ser = serial.Serial(
         baudrate=9600,
         parity=serial.PARITY_NONE,
-
         stopbits=serial.STOPBITS_ONE,
         bytesize=serial.EIGHTBITS,
         rtscts=True,
@@ -33,6 +32,9 @@ def listener():
     rospy.init_node('serial_transmitter', anonymous=True, log_level=rospy.DEBUG)
     
     serial_port = rospy.get_param("serial_port")
+    #dtr is connected to RST, on opening dtr is high by default so it resets the st board
+    #after opening the serial port we set it low so the board can boot
+    ser.dtr = 0 
     while(ser.is_open == False and not rospy.is_shutdown()):
         try:
             ser.port = serial_port