I’m trying to connect an onboard computer(Raspberry Pi 4B) via GPIO to use MavSDK to control a Pixhawk 6c via telem 2. I can’t get a response from the Pixhawk.
The problem appears to be with the configuration on the Pi side. I say this because I also have the Holybro Vision drone. If I plug the connector from telem2 from that drone into telem2 on the new Pixhawk 6c. When I do “minicom -D /dev/ttyUSB0”. text starts to scroll across the screen. Doing the same thing when the Raspberry Pi is connecting then “minicom -D /dev/ttyAMA0” and nothing scrolls on the screen.
I’ve gone through “sudo raspi-config” → interface options → Serial Port → No → Yes
If I connect the GPIO pins together directly and do 'minicom -D /dev/ttyAMA0". the characters I type appear on the screen. So that leads me to believe the pins are ok and working.
Not sure what else to try. Any ideas?
I’m using MAVSDK C++ to control Pixhawk 5 via telem2 from RPi 4B.
I get serial connection like this example.
ConnectionResult connection_result = mavsdk.add_any_connection(argv);
In my connection argv = std::string “serial:///dev/serial0:921600”
If port is fine but no autopilot you get message “No autopilot found.\n”. If port close or bad you get error and crush app, else “Discovered autopilot\n”.
Some users have problem " Connection only works after opening QGC", maybe you have it too? soo solution here.
I’ll be happy if I helped you.
Thank you for offering to help! A few questions. What OS are you running on the RPi?
Did you use raspi-config to enable serial over GPIO?
Did you do any other config on the RPi to get the serial connection working?
OS - Raspberry PI OS (32-BIT)
Raspi-config - yes
Other config - don’t remember, but think nope )
This is very helpfull link.
My config PX4:
Ok thanks! I’m going to give it another try tonight using your settings…
Still having this issue?
I encountered a similar issue when trying to use GPIO on a Jetson. Then I reverted to using a converter to regular usb and that’s working ok.
Perhaps a little late now but I just wanted to check that you connected TX to RX and RX to TX between the RPi and Pixhawk? Looks like you’ve also connected up a common ground which is good.
I’d also look into baud rates on both the RPi and Pixhawk, just make sure they are the same else you won’t see and data being transmitted.
Final thing is to reiterate @Artem_Borisov’s point. On an earlier release of MAVSDK, you’d need to send a message to the Pixhawk before it would transmit data. Under the hood, launching QGC first does this step. Look at this thread for more details.
Hope this has added value!
I had connection problems with the Pixhawk 6c too. In my case, I was able to solve them by setting
See here for the complete description.