Lidar causes hard fault

I was testing software on a pixracer using a modified version of the v1.6.5 firmware, and have recently had repeatable hard faults in the system. The fault logs show a full user stack, and an error on the following line.

Type:Hard Fault in file:semaphore/sem_post.c at line: 118 running task: mc_att_control

So far it seems to originate when the ll40ls lidar is plugged in over i2c. Timing is a bit unpredictable but the fault is repeatable.

I have not tried to reproduce this problem on unmodified 1.6.5 software, but the modifications are minimal and i find them unlikely to be the cause.

Hi,

I have a related question, when you connected the lidar, did you use pullup resistors ?
How did you verify that the lidar talks to PX4 ?

Thanks G

The pixracer board has a pull-up resistor on the i2c bus, but I didn’t add an additional one. In order to verify that it was working I run the ll40ls test, as details on this site.

https://pixhawk.org/peripherals/rangefinder

Additionally after flights distance_sensor_0.current_distance shows up in the .ulog so I know it must be working.

In QGC you can use the mavlink inspector (under widgets). If the sensor is publishing data you’ll see a DISTANCE_SENSOR message.

With a console connected to the vehicle (or through QGC) you can also do `listener distance_sensor’.