When I try to connect to flight controller using pymavlink library on Python (mavutil.mavlink_connection("/dev/ttyAMA0", baud=115200)), it simply gets timeouted. When I try to run sudo cat /dev/ttyAMA0 and see if there is any data coming from Navio 2, it is just empty. Which means Navio 2 doesn’t send serial data on /dev/ttyAMA0. I have tried another port that appears on ls /dev/tty* but then got Input/Output error.
-C corresponds to Serial 1, so you need to change the baud rate for the SERIAL1_BAUD parameter.
The UART on Navio2 matches /dev/ttyAMA0. You need to monitor this port to watch the data. I suggest checking the output on the port via the screen tool. This tool shows the data stream in real-time. Using cat may not be suitable for such a task.
I didn’t buy any telemetry radios since I am able connect and update parameters via Wi-Fi and in-flight telemetry is not a necessity for me. But I will try to connect to Mission Planner over serialport when I power up Navio2 via Type-C cable and post another comment on this thread.
But I am sure ArduPilot was running at that moment. Because I have enabled on boot when I was following this documentation.
I may not get it clearly, but why then do you have TELEM2 enabled? If you didn’t connect telemetry to the UART port, there will be no data on /dev/ttyAMA0. Am I missing something?
I think I didn’t able to tell what I am trying to do, sorry. So, in short, I am trying to get/send mavlink packets/commands from/to flight controller. So in that way, I can control the Quadcopter in Guided Mode via a programming language. But I am unable to get these packets because there is actually no data transfer on that port.
For example, in HexCube Black flight controller, all I needed to have a communication between flight controller and companion computer was getting 3 cables from HexCube Black’s telemetry port (RX, TX, GND) and connect them to flight controller’s serialport pins. For example Raspberry PI’s serialport pins. Then a new serialport would appear in ls /dev/tty* command results. But since Navio 2 is mounted on top of Raspberry PI pins, I am unable to do that. What I am asking is how can I able to connect to this serialport via programming language so I can send and receive mavlink packets?
As you’ve correctly pointed out, Navio2 works with Raspberry Pi when it’s mounted on top of the computer. They use GPIO pins for communicating. So, you can’t see one port that handles this communication as you have for Hex Cube Black flight controller.
Everything you see after running the ls /dev/tty* command is related to Navio2 and Raspberry Pi altogether. If you had connected a UART telemetry radio to Navio2, you should have seen the data coming to/from Mission Planner on /dev/ttyAMA0.
Since you’ve only set up the communication via Wi-Fi, you need to figure out how to retrieve those messages. This looks like advanced programming, so I can hardly provide you with any tips here. But I’ve found this guide from ArduPilot documentation which may give you some insights even though it doesn’t solve your task directly.