PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.55k stars 13.53k forks source link

[Bug] USB connection unstable with QGC whenever a SD card is not present (uploading FW from master) #22272

Closed TOTON95 closed 7 months ago

TOTON95 commented 1 year ago

Describe the bug

I was checking how master (on commit 12b291b82f4dcc2a8b1c59b86fddeee0b675abe2) was doing for these targets:

*All above were using an Ardupilot ChibiOS bootloader

It runs successfully and gets connected to QGC (4.2.9) if an SD card is present, if not, it keeps skipping every auto-connect attempt, and manual ones as well.

Occasionally, it will "connect" but also will display a "Connection lost" banner and at the same time give access to the usual setup menu, every attempt to order a sensor calibration for example, is rejected and the AP's buzzer throws an "error tone".

At first, it may look like that the issue might be located in a group of boards (mRo's in this case) but I also had laying around a Holybro Pixhawk 6C (with a PX4 FMU V6C) and the undesired behavior repeats after uploading the FW and SD card is removed.

After this, I returned to v1.14.0 release for every board without any issues, and operated normally with and without an SD card.

Can someone who has the listed HW verify if this is true for you as well? Also, these verifications will be highly appreciated if anyone has other HW and some spare time.

Please, let me know if I am missing something to solve this issue. Thank you in advance.

To Reproduce

  1. Make sure to have an SD card inserted into an AP board and plug it via USB into a computer running QGC 4.2.9

  2. Upload master FW (from source/QGC) into any of the listed boards

  3. Wait until the board reboots and inspect if it works correctly

  4. Unplug the AP board and plug it back without the SD card

  5. Observe interactions with QGC

  6. Insert back the SD card and observe interactions with QGC

Expected behavior

The AP board should connect to QGC through USB and report back the status, sensors, shell, etc...

Screenshot / Media

No response

Flight Log

Let me know if required, although it would be hard to get logs w/o SD card, unless you suggest another way

Software Version

NOTE: All these MAVLink Shell outputs executed on master (1.15.0) were obtained with a SD Card inserted into the AP, and the latest stable release (1.14.0) without an SD card where indicated

w/ 1.15.0 and SD card

HW arch: MRO_CTRL_ZERO_H7
PX4 git-hash: 12b291b82f4dcc2a8b1c59b86fddeee0b675abe2
PX4 version: 1.15.0 40 (17760320)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: c23b72dffeb0de0d1a836ab561eb9169c4a9e58e
Build datetime: Oct 25 2023 21:07:48
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 000600000000343538303332510a0036003f
MCU: STM32H7[4|5]xxx, rev. V

w/ 1.14.0 and w/o SD card

HW arch: MRO_CTRL_ZERO_H7
PX4 git-hash: b8c541dd7277ed735139d7d1bfb829d61fbe29fb
PX4 version: Release 1.14.0 (17694975)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: de41e7feaeffaec3ce65327e9569e8fdb553ca3d
Build datetime: Oct 26 2023 01:22:22
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 000600000000343538303332510a0036003f
MCU: STM32H7[4|5]xxx, rev. V
INFO [init] formatting /dev/mmcsd0
ERROR [init] format failed
INFO  [param] selected parameter default file /fs/mtd_params
INFO  [param] importing from '/fs/mtd_params'
INFO  [parameters] BSON document size 1126 bytes, decoded 1126 bytes (INT32:15, FLOAT:35)
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
Loading airframe: /etc/init.d/airframes/4001_quad_x
WARN  [dataman] Could not open data manager file /fs/microsd/dataman
ERROR [dataman] dataman start failed
Board sensors: /etc/init.d/rc.board_sensors
icm20602 #0 on SPI bus 1 rotation 8
bmi088_accel #0 on SPI bus 5 rotation 8
bmi088_gyro #0 on SPI bus 5 rotation 8
icm20948 #0 on SPI bus 1 rotation 8
dps310 #0 on SPI bus 2
ekf2 [468:237]
Starting Main GPS on /dev/ttyS2
Starting MAVLink on /dev/ttyS0
ERROR [mavlink] DM_KEY_MISSION_STATE lock failed
WARN  [mavlink] offboard mission init failed (-1)
INFO  [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS0 @ 57600B
INFO  [logger] logger started (mode=all)
INFO  [logger] log root dir created: /fs/microsd/log
INFO  [uavcan] Node ID 1, bitrate 1000000
ERROR [uavcan] CentralizedServer init: -1
ERROR [uavcan] UavcanServers init: -1

w/ 1.15.0 and SD card

HW arch: MRO_CTRL_ZERO_H7_OEM
PX4 git-hash: 12b291b82f4dcc2a8b1c59b86fddeee0b675abe2
PX4 version: 1.15.0 40 (17760320)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: c23b72dffeb0de0d1a836ab561eb9169c4a9e58e
Build datetime: Oct 25 2023 21:07:18
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 000600000000303632353432510a0028002b
MCU: STM32H7[4|5]xxx, rev. V

w/ 1.14.0 and w/o SD card

HW arch: MRO_CTRL_ZERO_H7_OEM
PX4 git-hash: b8c541dd7277ed735139d7d1bfb829d61fbe29fb
PX4 version: Release 1.14.0 (17694975)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: de41e7feaeffaec3ce65327e9569e8fdb553ca3d
Build datetime: Oct 26 2023 01:51:25
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 000600000000303632353432510a0028002b
MCU: STM32H7[4|5]xxx, rev. V
INFO [init] formatting /dev/mmcsd0
ERROR [init] format failed
INFO  [param] selected parameter default file /fs/mtd_params
INFO  [param] importing from '/fs/mtd_params'
INFO  [parameters] BSON document size 1149 bytes, decoded 1149 bytes (INT32:15, FLOAT:36)
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
Loading airframe: /etc/init.d/airframes/4001_quad_x
WARN  [dataman] Could not open data manager file /fs/microsd/dataman
ERROR [dataman] dataman start failed
Board sensors: /etc/init.d/rc.board_sensors
icm20602 #0 on SPI bus 1 rotation 8
bmi088_accel #0 on SPI bus 5 rotation 8
bmi088_gyro #0 on SPI bus 5 rotation 8
icm20948 #0 on SPI bus 1 rotation 8
dps310 #0 on SPI bus 2
ekf2 [534:237]
Starting Main GPS on /dev/ttyS2
Starting MAVLink on /dev/ttyS0
ERROR [mavlink] DM_KEY_MISSION_STATE lock failed
WARN  [mavlink] offboard mission init failed (-1)
INFO  [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS0 @ 57600B
INFO  [logger] logger started (mode=all)
INFO  [logger] log root dir created: /fs/microsd/log
INFO  [uavcan] Node ID 1, bitrate 1000000
ERROR [uavcan] CentralizedServer init: -1
ERROR [uavcan] UavcanServers init: -1

1.15.0 and SD card

HW arch: MRO_PIXRACERPRO
PX4 git-hash: 12b291b82f4dcc2a8b1c59b86fddeee0b675abe2
PX4 version: 1.15.0 40 (17760320)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: c23b72dffeb0de0d1a836ab561eb9169c4a9e58e
Build datetime: Oct 25 2023 21:07:52
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 000600000000343439393432510e0036003e
MCU: STM32H7[4|5]xxx, rev. V

1.14.0 w/o SD card

HW arch: MRO_PIXRACERPRO
PX4 git-hash: b8c541dd7277ed735139d7d1bfb829d61fbe29fb
PX4 version: Release 1.14.0 (17694975)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: de41e7feaeffaec3ce65327e9569e8fdb553ca3d
Build datetime: Oct 26 2023 05:22:22
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 000600000000343439393432510e0036003e
MCU: STM32H7[4|5]xxx, rev. V
INFO [init] formatting /dev/mmcsd0
ERROR [init] format failed
INFO  [param] selected parameter default file /fs/mtd_params
INFO  [param] importing from '/fs/mtd_params'
INFO  [parameters] BSON document size 1201 bytes, decoded 1201 bytes (INT32:15, FLOAT:38)
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
Loading airframe: /etc/init.d/airframes/4001_quad_x
WARN  [dataman] Could not open data manager file /fs/microsd/dataman
ERROR [dataman] dataman start failed
Board sensors: /etc/init.d/rc.board_sensors
icm20602 #0 on SPI bus 1 rotation 8
ERROR [SPI_I2C] bmi088: no instance started (no device on bus?)
bmi085_accel #0 on SPI bus 5 rotation 8
bmi085_gyro #0 on SPI bus 5 rotation 8
icm20948 #0 on SPI bus 1 rotation 8
dps310 #0 on SPI bus 2
ekf2 [470:237]
Starting Main GPS on /dev/ttyS3
Starting MAVLink on /dev/ttyS1
ERROR [mavlink] DM_KEY_MISSION_STATE lock failed
WARN  [mavlink] offboard mission init failed (-1)
INFO  [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS1 @ 57600B
Board extras: /etc/init.d/rc.board_extras
INFO  [logger] logger started (mode=all)
INFO  [logger] log root dir created: /fs/microsd/log
INFO  [uavcan] Node ID 1, bitrate 1000000
ERROR [uavcan] CentralizedServer init: -1
ERROR [uavcan] UavcanServers init: -1

1.15.0 and SD card

HW arch: PX4_FMU_V6C
HW type: V6C000000
HW version: 0x000
HW revision: 0x000
PX4 git-hash: 12b291b82f4dcc2a8b1c59b86fddeee0b675abe2
PX4 version: 1.15.0 40 (17760320)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: c23b72dffeb0de0d1a836ab561eb9169c4a9e58e
Build datetime: Oct 25 2023 15:37:24
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 0006000000003437393830315102002d0022
MCU: STM32H7[4|5]xxx, rev. V

1.14.0 w/o SD card

HW arch: PX4_FMU_V6C
HW type: V6C000000
HW version: 0x000
HW revision: 0x000
PX4 git-hash: b8c541dd7277ed735139d7d1bfb829d61fbe29fb
PX4 version: Release 1.14.0 (17694975)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: de41e7feaeffaec3ce65327e9569e8fdb553ca3d
Build datetime: Oct 19 2023 16:22:41
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 0006000000003437393830315102002d0022
MCU: STM32H7[4|5]xxx, rev. V
INFO [init] formatting /dev/mmcsd0
ERROR [init] format failed
INFO  [param] selected parameter default file /fs/mtd_params
INFO  [param] importing from '/fs/mtd_params'
INFO  [parameters] BSON document size 1676 bytes, decoded 1676 bytes (INT32:28, FLOAT:51)
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
Loading airframe: /etc/init.d/airframes/4019_x500_v2
WARN  [dataman] Could not open data manager file /fs/microsd/dataman
ERROR [dataman] dataman start failed
rgbled_ncp5623c #0 on I2C bus 1 address 0x39
INFO  [px4io] IO FW CRC match
Board sensors: /etc/init.d/rc.board_sensors
bmi055_accel #0 on SPI bus 1 rotation 4
bmi055_gyro #0 on SPI bus 1 rotation 4
icm42688p #0 on SPI bus 1 rotation 6
ms5611 #0 on I2C bus 4 (external) address 0x77
ist8310 #0 on I2C bus 4 (external) address 0xC
ist8310 #1 on I2C bus 1 (external) address 0xE rotation 10
WARN  [SPI_I2C] Already running on bus 1
ekf2 [654:237]
Starting Main GPS on /dev/ttyS0
Starting MAVLink on /dev/ttyS5
ERROR [mavlink] DM_KEY_MISSION_STATE lock failed
WARN  [mavlink] offboard mission init failed (-1)
INFO  [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS5 @ 57600B
INFO  [logger] logger started (mode=all)
INFO  [logger] log root dir created: /fs/microsd/log
INFO  [uavcan] Node ID 1, bitrate 1000000
ERROR [uavcan] CentralizedServer init: -1

ERROR [uavcan] UavcanServers init: -1
NuttShell (NSH) NuttX-11.0.0
nsh> WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card
WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card
INFO  [gps] u-blox firmware version: SPG 3.01
INFO  [gps] u-blox protocol version: 18.00
INFO  [gps] u-blox module: NEO-M8N-0
INFO  [gps] u-blox firmware version: SPG 3.01
INFO  [gps] u-blox protocol version: 18.00
INFO  [gps] u-blox module: NEO-M8N-0
WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card
WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card
WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card

Flight controller

mRo Control Zero H7, mRo Control Zero OEM H7, mRo Pixracer Pro, Holybro Pixhawk 6C

Vehicle type

None

How are the different components wired up (including port information)

No response

Additional context

No response

mrpollo commented 1 year ago

Hey @dagar would you d taking as look?

mooey5775 commented 8 months ago

This seems like it was fixed with #22778

TOTON95 commented 8 months ago

@mooey5775 Thanks for noticing it. I will take a look in the upcoming days 🙌🏼

TOTON95 commented 7 months ago

@mooey5775 I can confirm that #22778 might fixed this issue for the following boards:

I have a few more to test it. An update should be possible soon.

TOTON95 commented 7 months ago

I can add the PixRacer PRO to the list

TOTON95 commented 7 months ago

Finally, I can confirm that the fix works for Control Zero H7. Thank you @mooey5775

mrpollo commented 7 months ago

Thanks @TOTON95 🙌