ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Connecting Teensy to VOXL 2

    Ask your questions right here!
    voxl2
    2
    3
    88
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bkim1301
      last edited by bkim1301

      I purchased a Starling 2 Max drone, and want to connect a Teensy 4.1 to the UART7 port on the M0151 B2B expansion. I followed the instructions for VOXL 2 Connecting an External Flight Controller, to get pinouts and ran a pyserial script from the home directory of the VOXL to test sending messages for the Teensy to read. Debugging with pyserial indicates that I connect to /dev/ttyHS1, but I do not read anything from the Teensy.

      #!/usr/bin/env python3
      
      import sys
      import serial
      import time
      
      class SerialPort:
          def __init__(self, port='/dev/ttyHS1', baudrate=115200):
              try:
                  self.ser = serial.Serial(port=port,
                                           baudrate=baudrate,
                                           bytesize=serial.EIGHTBITS,
                                           parity=serial.PARITY_NONE,
                                           stopbits=serial.STOPBITS_ONE,
                                           timeout=1.0
                                          )
                  print(f"Connected to {port} at {baudrate} baud")
              except serial.SerialException as e:
                  print(f"Error opening serial port: {e}")
                  sys.exit(1)
      
          def write(self, data):
              """Write data to serial port"""
              try:
                  self.ser.write(data.encode())
                  self.ser.flush()
              except serial.SerialException as e:
                  print(f"Error writing to serial port: {e}")
      
          def close(self):
              """Close serial port"""
              if self.ser.is_open:
                  self.ser.close()
      
      def main():
          # Initialize serial port
          ser = SerialPort()
      
          # Run TX/RX test (Send test messages)
          try:
              while True:
                  # Send test message
                  ser.write('Test\n')
                  print("Sent: 'Test'.")
      
                  # Wait before next test run
                  time.sleep(1)
      
          except KeyboardInterrupt:
              print("\nClosing serial port...")
          finally:
              ser.close()
      
      if __name__ == '__main__':
          main()
      

      What are possible next steps? Different changes to config files than documentation? Logic level shifter?

      TL;DR: I want to connect a Teensy to VOXL2 via UART7 port using standard Linux practices.

      Thanks!

      Eric KatzfeyE 1 Reply Last reply Reply Quote 0
      • Eric KatzfeyE
        Eric Katzfey ModalAI Team @bkim1301
        last edited by

        @bkim1301 I would start by connecting the VOXL 2 UART 7 to a PC with a serial to USB cable. Make sure you can communicate back and forth using that setup and then do the same with the Teensy before connecting the Teensy and the VOXL 2 together. It's often very helpful to use an oscilloscope on the rx / tx lines to verify that there is actually data flowing.

        B 1 Reply Last reply Reply Quote 0
        • B
          bkim1301 @Eric Katzfey
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Powered by NodeBB | Contributors