Hard Fault in file:armv7-m/up_hardfault.c at line: 171 running task: sensors

Hi all, I have a Pixhawk v2. I have modified the PX source, but successfully compiled and uploaded to Pixhawk. However, after uploading, the both B/E leds (FMU on the left, IO on the right side) are always on with orange color. Both pwr leds are green. ACT led is blinking blue. There is always no led under ADC 3.3V.

I have plugged a FTDI cable to connect USB port (from my computer) to Serial 4/5 port (of the Pixhawk). By launching cutecom (in Ubuntu 14.04, of my computer), I observed during starting Pixhawk in Cutecom window, the following

0x20005ad7 0x00000020
User sp memory region, stack pointer lies within stack
0x1000ca8e 0x080b5218

0x1000c9d9 0x1000d370
0x1000c9d8 0x00000000<-- User sp
0x1000c9d7 0x0807f6bb

0x1000c91e 0x00000000
System fault Occurred on: 2017-06-16-12:02:47
Type:Hard Fault in file:armv7-m/up_hardfault.c at line: 171 running task: sensors
FW git-hash: 96501c170f542b6efceb5ba19590f0b0c5d35b9f
Build datetime: May 22 2017 10:46:58
Build url: localhost
Processor registers: from 0x1000c904
r0:0x00000000 r1:0x200200d0 r2:0x00000000 r3:0xfc200000 r4:0x0b4770e7 r5:0x2001ff54 r6:0x00000010 r7:0x00000001
r8:0x0007a120 r9:0x00000000 r10:0x00000000 r11:0x00000000 r12:0x0805ed21 sp:0x1000c9d8 lr:0x0807f19d pc:0x0807f6c8
xpsr:0x01000000 basepri:0x00000010 control:0x00000004
exe return:0xffffffe9
IRQ stack:
top: 0x20005bf0
sp: 0x20005ba0 Valid
bottom: 0x20005904
size: 0x000002ec
used: 00000074
User stack:
top: 0x1000cac8
sp: 0x1000c9d8 Valid
bottom: 0x1000c30c
size: 0x000007bc
used: 000007bc
[boot] – 2017-06-16-12:02:47 END Fault Log –
[boot] There were 43 reboots with Hard fault that were not committed to disk - System halted

Enter B - Continue booting
Enter C - Clear the fault log
Enter D - Dump fault log

?>

By entering B, booting continues and Pixhawk works without two B/E orange leds and the led under ADC 3.3V port is blue.

?>sercon: Registering CDC/ACM serial driver
sercon: Successfully registered the CDC/ACM serial driver
nsh: mount: mount failed: No such device
nsh: mkfatfs: mkfatfs failed: No such device
INFO [param] selected parameter default file /fs/mtd_params
rgbled on I2C bus 2 at 0x55 (bus: 100 KHz, max: 100 KHz)
WARN [dataman] Could not open data manager file /fs/microsd/dataman
ERROR [dataman] dataman start failed
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 [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: Onboard, data rate: 80000 B/s on /dev/ttyS2 @ 921600B
ERROR [param] Parameter UAVCAN_ENABLE not found
INFO [ver] match: PX4FMU_V2
px4flow [208: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)
INFO [logger] log root dir created: /fs/microsd/log
INFO [init] Mixer: /etc/mixers/octo_cox.main.mix on /dev/pwm_output0
INFO [init] Mixer: /etc/mixers/pass.aux.mix on /dev/pwm_output1
error finding param: FW_ARSP_MODE
INFO [lib__ecl] EKF aligned, (pressure height, IMU buf: 17, OBS buf: 16)

I have tried to google the solution for this problem but there not exists a same topic. Thank you for your helps and advices!

Hi

It means the system crashed because of a bug in the code somewhere (not necessarily in the sensors module). See here: https://dev.px4.io/en/debug/gdb_debugging.html#debugging-hard-faults-in-nuttx
In general, if possible, it’s simpler to test and debug in SITL and only when you’re sure it works move over to the device.

cheers

1 Like