Porting PX4 to MAMBA Basic F405 MK3

Hi all,

I have been doing some work trying to build PX4 for unsupported hardware. Following documentation found here, as well as various other pages scattered over the internet.

I am trying to run PX4 on a Diatone MAMBA Basic F405 MK3. It originally runs Betaflight, and I can flash it with Adupilot using Q Ground Control with no problems. I have built PX4 from source for it, based off of crazyflie2, omnibusf4sd, and diatone’s basic f405 mk2. All of these have have the exact same processor (STM32F405RG), and I have been able to flash all of these successfully, both using dfu_util, make — upload, and QGroundControl. After flashing the flight controller is unresponsive and does not connect to QGroundControl anymore.

I’m not sure what logs or errors to include in this topic because I’m not sure what I’m doing wrong! Any suggestions from the community would be very much appreciated.

Cheers,
Angus.

Do you have some printf console output on some serial port where you can see what is going on at startup? You can set that in the defconfig, e.g. here for the Kakute H7:

Hi thanks for your response,

I added the following to my defconfig file

CONFIG_WATCHDOG=y
CONFIG_STM32_USART2=y
CONFIG_USART2_BAUD=57600
CONFIG_USART2_RXBUFSIZE=300
CONFIG_USART2_TXBUFSIZE=300
CONFIG_USART2_SERIAL_CONSOLE=y

and I have an FTDI connected to the usart2 port, and I do not get anything on boot other than a new line character.

Does the FTDI cable also have ground connected? Have you tried swapping Tx/Rx?

Are you sure it’s the correct U(S)ART?

Hi Julian,

Yes ground is connected and I have rx to tx and visa versa (although, have tried flipping to be sure). I am pretty sure it’s the correct uart port, but to be sure I tried 2 physical ports and all possible combinations of software ports. I still need to check this, but I plan on putting betalfight back on to confirm that the uart port works and is correct.

Is there any thing on the software side that I may be missing? Some kind of boot up process or first time connection?

Is it possible that the defconfig is being ignored and it isn’t trying to enable the console? Would there be another file I would have to add the port to?

Thanks,

Angus

Okay so I managed to get the serial console working, using the omnibus_f4sd boot loader, and modifying the board.h file to enable the usart port. I get the following on boot:

[boot] [boot] Fault Log is Armed

Googling this doesn’t result in anything, any ideas?

Thanks,
Angus

Ok, so you only get the very first part somehow.

Try adding this to the defconfig:
CONFIG_DEV_CONSOLE=y

Okay cool that worked, I get the following printout now:

[boot] [boot] Fault Log is Armed
nsh: sysinit: fopen failed: No such file or directory
nsh: ver: command not found
nsh: mount: mount failed: No such device
INFO [init] formatting /dev/mmcsd0
nsh: mkfatfs: mkfatfs failed: I/O error
ERROR [init] format failed
nsh: mft: command not found
nsh: mft: command not found
ERROR [param] importing failed (-1)
ERROR [init] param import failed
nsh: bsondump: command not found
nsh: ver: command not found
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
nsh: tone_alarm: command not found
WARN  [dataman] Could not open data manager file /fs/microsd/dataman
ERROR [dataman] dataman start failed
nsh: send_event: command not found
nsh: load_mon: command not found
nsh: rgbled: command not found
nsh: rgbled_ncp5623c: command not found
nsh: rgbled_lp5562: command not found
nsh: rgbled_is31fl3195: command not found
Board sensors: /etc/init.d/rc.board_sensors
mpu6000 #0 on SPI bus 1 rotation 6
nsh: bmp280: command not found
nsh: icm20948_i2c_passthrough: command not found
nsh: hmc5883: command not found
nsh: ist8308: command not found
nsh: ist8310: command not found
nsh: lis2mdl: command not found
nsh: lis3mdl: command not found
nsh: lis3mdl: command not found
nsh: qmc5883l: command not found
nsh: rm3100: command not found
nsh: ak09916: command not found
WARN  [health_and_arming_checks] Preflight Fail: No valid data from Accel 0
WARN  [health_and_arming_checks] Preflight Fail: barometer 0 missing
WARN  [health_and_arming_checks]No autostart ID found
 Preflight Fail: No CPU load infekf2 [232:100]
ormation
nsh: ekf2: command not found
WARN  [health_and_arming_checks] Preflight Fail: No valid data from Gyro 0
WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card
nsh: tune_control: command not found
Board extras: /etc/init.d/rc.board_extras
ERROR [param] Parameter OSD_ATXXXX_CFG not found
nsh: atxxxx: command not found
ERROR [param] Parameter SDLOG_MODE not found
ERROR [param] Parameter SDLOG_MODE not found
ERROR [param] Parameter SDLOG_MODE not found
ERROR [param] Parameter SDLOG_MODE not found
ERROR [param] Parameter SDLOG_MODE not found
nsh: logger: command not found

NuttShell (NSH) NuttX-11.0.0
nsh> e[KWARN  [health_and_arming_checks] Preflight Fail: Accel 0 uncalibrated
WARN  [health_and_arming_checks] Preflight Fail: barometer 0 missing
WARN  [health_and_arming_checks] Preflight Fail: No CPU load information
WARN  [health_and_arming_checks] Preflight Fail: Gyro 0 uncalibrated
WARN  [health_and_arming_checks] Preflight Fail: Missing FMU SD Card

I can also now access the nsh console. Is there an obvious error in there stopping the system starting?

Doesn’t look like mavlink is started anywhere which would explain why it doesn’t connect in QGC.

Thank you for that. I’m not sure what the root cause of the problem is, but enabling MAVLink on a known UART port has meant that I can connect to the flight controller from QGC using an FTDI. It seems that the USB serial port does not have a ‘/dev/…’ name associated with it, and when the FC is not in DFU mode it is not visible by my computer as a serial device so there must be some problem with setting up the USB.

There is onboard flash on the mamba board that I also am yet to configure, and px4 is complaining about there not being an sd card so I will need to sort that out too before a test flight.

Thank you for your help so far and any ideas around the usb weirdness would be appreciated.

Thanks,
Angus.

Yes that’s certainly necessary for things to work properly.