[WARNING] Link timeout, no heartbeat in last 5 seconds

i cannot connect raspberry pi with apm

07-Jun-22 17:31:53 [WARNING] Link timeout, no heartbeat in last 5 seconds

07-Jun-22 17:32:18 [ERROR] Exception in MAVLink input loop
Traceback (most recent call last):
** File “/usr/local/lib/python3.9/dist-packages/dronekit/mavlink.py”, line 211, in mavlink_thread_in**
** fn(self)**
** File “/usr/local/lib/python3.9/dist-packages/dronekit/init.py”, line 1370, in listener**
** raise APIException(‘No heartbeat in %s seconds, aborting.’ %**
dronekit.APIException: No heartbeat in 30 seconds, aborting.
07-Jun-22 17:32:19 [ERROR] Timeout in initializing connection.
Traceback (most recent call last):
** File “/home/pi/Desktop/cloudapp-raspi/app.py”, line 54, in **
** drone = Drone(config)**
** File “/home/pi/Desktop/cloudapp-raspi/drone.py”, line 19, in init**
** self.vehicle = connect(rpi_ip + “:” + sim_port, wait_ready=True, baud=115200)**
** File “/usr/local/lib/python3.9/dist-packages/dronekit/init.py”, line 3166, in connect**
** vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)**
** File “/usr/local/lib/python3.9/dist-packages/dronekit/init.py”, line 2275, in initialize**
** raise APIException(‘Timeout in initializing connection.’)**
dronekit.APIException: Timeout in initializing connection.

  1. Are the baud rates set correctly on both sides?
  2. Are you using APM 2.x hardware?
  3. Which FW version are you using?
  4. Are the serial cables crossed like they should?

thank u for your reply;
1- yes
2- yes its actually 2.8
3- i donot know what do u mean ?

You are probably using ArduCopter 3.2.1 firmware from the year 2014.

It would be a good idea to update your flight controller hardware to something that supports the current ArduCopter 4.2.1 from the year 2022.

That said, I do not see any reason why dronekit does not connect to the APM 2.8 Hardware, it should just work.

i think apm donot supportt that new versions or at least i cannot upload it

Yes, we all know that the APM 2.8 hardware can not run the current firmware.