Connecting Teensy to VOXL 2
-
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!
-
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!
@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.
-
@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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login