Herelink Mavlink data with Companion Computer

Hello all,

I have been trying to connect my Raspberry Pi to the Herelink UART port and exchange heartbeats between the gcs and rpi using pymavlink. I am able to connect to my Cubeblack with missionplanner using the 5.8Ghz hotspot.
However with Rpi I am not able to detect any serial data or the heartbeats on the UART port of air unit.
I am using the two reference codes from mavlink.io
Code on gcs side:
#####################################################
from pymavlink import mavutil
import time
master = mavutil.mavlink_connection(‘udp:0.0.0.0:14550’)

msg = None
while True:
master.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS,mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)
try:
msg = master.recv_match()
except:
pass
print(msg)
time.sleep(1)
####################################

Code on RPi:
####################################
from pymavlink import mavutil
import time

master = mavutil.mavlink_connection(’/dev/ttyAMA0’,baud=57600)

msg = None
while True:
master.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_ONBOARD_CONTROLLER,mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)
try:
msg = master.recv_match()
except:
pass
print(msg)
time.sleep(1)

####################################

Can someone guide me on how to properly implement this?

Update:

So when I try the air unit connecting with my Cubeblack I am able to connect successfully, and if I swap the UART cable with a USB to ftdi and connect to my PC during that session I am able to see all the heartbeats or any mavlink messages being sent from the gcs python script but messages from the air unit are not being received.

@philip could you please help me out to properly implement this handshake/initialization procedure.

My end goal is to control a camera payload which has its control and command protocol (not supporting mavlink or sbus using herelink. I plan to send custom mavlink messages containing the protocol bytes which some microcontroller on the air unit can parse and send the data over to the payload. I think it’d be convenient for having payload command and control on the same device as the one displaying it.