Unable to save any parameters (reset on reboot)

I am having trouble saving any parameters to my Pixhawk (none of them survive a reboot). I have been digging in the code to understand what is supposed to happen, but I am afraid I’ll need some help to solve this.

I have tried this:

Setting from QGC console:
Setting the airframe, selecting “apply”, then “apply and restart”. After boot, the parameter is still 0.

Setting from mavlink console:

nsh> param set SYS_AUTOSTART 7001
  SYS_AUTOSTART: curr: 0 -> new: 7001
nsh> param save

After restart, the value is still 0

Background:

  • I have flashed developer build from QGC (I get the same problem with other builds)
  • SD card seems to be working “ls /fs/microsd/” correctly lists the contents, and I can both create files and read them from a computer (with microsd adapter)
  • I have only the debug console connected at the moment.
  • During boot, I get an error from the parameter importer, see boot log below
  • I have got the toolchain set up and I am a fw developer myself, so please let me know if you have an idea on how to debug this from with code.
  • If I export parameters using “param save /fs/microsd/out.txt”, I only get a seemingly incomplete file containing only one line:
"                                                         _V_VOLT   "

Bootlog (over system console)

[boot] Fault Log info File No 3 Length 3257 flags:0x01 state:1

[boot] Fault Log is Armed

sercon: Registering CDC/ACM serial driver
sercon: Successfully registered the CDC/ACM serial driver
[i] microSD mounted: /fs/microsd 
[hardfault_log] Fault Log is Armed

INFO  [param] selected parameter default file /fs/mtd_params
ERROR [param] importing from '/fs/mtd_params' failed (-1)
rgbled on I2C bus 2 at 0x55 (bus: 100 KHz, max: 100 KHz)
  BAT_N_CELLS: curr: 0 -> new: 3
INFO  [dataman] Unkown restart, data manager file '/fs/microsd/dataman' size is 361560 bytes
MS5611_SPI on SPI bus 4 at 2 (20000 KHz)
WARN  [ms5611] no device on bus 4
MS5611_SPI on SPI bus 1 at 3 (20000 KHz)
WARN  [bst] no devices found
INFO  [ver] match: PX4FMU_V2
WARN  [hmc5883] no device on bus 1 (type: 2)
WARN  [lis3mdl] no device on bus 2
WARN  [hmc5883] no device on bus 2 (type: 1)
WARN  [mpu6000] no device on bus 5
WARN  [mpu9250] probe failed! 255
WARN  [mpu9250] no device on bus 4
MPU6000 on SPI bus 1 at 4 (1000 KHz)
WARN  [mpu6000] no device on bus 5
WARN  [mpu9250] probe failed! 104
WARN  [mpu9250] no device on bus 3
WARN  [mpu9250] probe failed! 255
WARN  [mpu9250] no device on bus 4
L3GD20 on SPI bus 1 at 1 (11000 KHz)
LSM303D on SPI bus 1 at 2 (11000 KHz)
ERROR [sdp3x_airspeed] reset failed
WARN  [sdp3x_airspeed] trying SDP3X 2
ERROR [sdp3x_airspeed] reset failed
WARN  [sdp3x_airspeed] SDP3X init fail
WARN  [sdp3x_airspeed] no SDP3X airspeed sensor connected
ERROR [meas_airspeed] no MS4525 airspeed sensor connected
ERROR [ets_airspeed] no ETS airspeed sensor connected
ERROR [ets_airspeed] no ETS airspeed sensor connected
INFO  [load_mon] stack check enabled
ERROR [param] Parameter UAVCAN_ENABLE not found
INFO  [px4io] default PWM output device
INFO  [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS1 @ 57600B
INFO  [mavlink] mode: OSD, data rate: 1000 B/s on /dev/ttyS2 @ 57600B
ERROR [param] Parameter UAVCAN_ENABLE not found
INFO  [ver] match: PX4FMU_V2
px4flow [156:100]
WARN  [px4flow] scanning I2C buses for device..
INFO  [mavlink] mode: Config, data rate: 800000 B/s on /dev/ttyACM0 @ 57600B
INFO  [logger] logger started (mode=all)
No autostart ID found 

NuttShell (NSH)
nsh>

This is your issue. Try param reset and then repeat what you’ve done.

Thank you for the input, I’ll try it out and update here asap! :slight_smile:

Update:

I have enabled more debugging, and inserted a few debug prints. After “param reset” (“param save”) and reboot, I get this:

INFO  [param] selected parameter default file /fs/mtd_params
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'bCT_CNT.._CURR'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'jAP_CfT_V_VOLT'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'bCT_V_D.~.'
WARN  [modules__systemlib__param] BSON error decoding parameters
ERROR [param] do_load:: params are not flash based
ERROR [param] do_load::importing from '/fs/mtd_params' failed (-1)

After another reboot i get this:
INFO  [param] selected parameter default file /fs/mtd_params
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'bCP_CfT_V_CURR'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'êCP_CfT_V_VOLT'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'bCT_N_C.lNS'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'EKF2_MAGBIA..ID'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'EKF2_IAoBIACWX'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'EKF2_IAoBIAS_Y'
WARN  [modules__systemlib__param] ignoring unrecognised parameter 'EKF2_M.oBIASGZ'
WARN  [modules__systemlib__param] end of parameters

I notice this:

  • The names of the unrecognised parameters change on every reboot
  • Sometimes the parser ends with “failed (-1)”, and sometimes it finishes with the warnings

This semi-random behaviour seems strange to me. There is obviously some kind of corruption. I tried to erase the partition as well (“mtd erase”), but the result was the same.

I guess my next step will be to figure out what kind om memory serves as the backend for mtd_params, and then either debug it or switch to a different storage (if possible with px4fmu-v2).

Do you have any other suggestions on how to debug this?

Thank you!

Did you flash with QGC or build your own firmware? I just want to rule out any potential build problems before we assume it’s the hardware.

From QGC (tried all branches), but in the last post I built it myself to enable some more debugging and start digging for the cause.

Just posting an update if anyone else encounter this problem.

I got a new pixhawk today, and it works perfectly. Using the same firmware and the same qgc I am able to save parameters that survive a reboot. I see no corruption of the parameter storage.

From experience, I am very hesitant about ruling something a “hardare problem”. 95 out of 100 times it is me not reading the data sheets correctly :slight_smile: However, in this case I am happy to throw the old hawk in the bin and blame it on some faulty component.

If anyone have any interest in debugging further I’ll open it up and poke around, just let me know.

Thanks for your input @dagar