Pixhawk 6c mini with PWM wiring of lite lidar

Pixhawk:
pixhawk 6c mini

PX4 Autopilot Version:
v 1.15.2

Parameter setting for master and stable version :

SENS_EN_LL40LS : PWM

when flashing the build px4_fmu-v6c_default on my Pixhawk 6c mini, the problem appear similar as link below.

i changed default.px4board file to add “CONFIG_DRIVERS_PWM_INPUT=y”
and add ro distance_sensor/Kconfig “select DRIVERS_DISTANCE_SENSOR_LL40LS_PWM”
but when i build the px4_fmu-v6c_default, the error occurs like below and the board configuration of 6c’s PWMIN_TIMER_CHANNEL is 3.

#define PWMIN_TIMER_CHANNEL /* T4C3 */ 3

[637/1238] Building CXX object src/dri…ivers__pwm_input.dir/pwm_input.cpp.obj
FAILED: src/drivers/pwm_input/CMakeFiles/drivers__pwm_input.dir/pwm_input.cpp.obj
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-g++ -DCONFIG_ARCH_BOARD_PX4_FMU_V6C -DMODULE_NAME="pwm_input" -DPX4_MAIN=pwm_input_app_main -D_SYS_CDEFS_H_ -D_SYS_REENT_H_ -D__CUSTOM_FILE_IO__ -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -I/home/dcasl_kari/PX4-Autopilot/boards/px4/fmu-v6c/src -I/home/dcasl_kari/PX4-Autopilot/platforms/nuttx/src/px4/common/include -I/home/dcasl_kari/PX4-Autopilot/build/px4_fmu-v6c_default -I/home/dcasl_kari/PX4-Autopilot/build/px4_fmu-v6c_default/src/lib -I/home/dcasl_kari/PX4-Autopilot/platforms/nuttx/src/px4/stm/stm32h7/include -I/home/dcasl_kari/PX4-Autopilot/platforms/common -I/home/dcasl_kari/PX4-Autopilot/platforms/common/include -I/home/dcasl_kari/PX4-Autopilot/src -I/home/dcasl_kari/PX4-Autopilot/src/include -I/home/dcasl_kari/PX4-Autopilot/src/lib -I/home/dcasl_kari/PX4-Autopilot/src/lib/matrix -I/home/dcasl_kari/PX4-Autopilot/src/modules -I/home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/arch/arm/src/armv7-m -I/home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/arch/arm/src/chip -I/home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/arch/arm/src/common -I/home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/apps/include -I/home/dcasl_kari/PX4-Autopilot/build/px4_fmu-v6c_default/external/Install/include -isystem /home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/include/cxx -isystem /home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/include/cxx -isystem /home/dcasl_kari/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/include -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Os -DNDEBUG -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -fno-rtti -fno-exceptions -fno-sized-deallocation -fno-threadsafe-statics -nostdinc++ -Wframe-larger-than=2048 -Wno-pmf-conversions -Wno-cast-align -std=gnu++14 -MD -MT src/drivers/pwm_input/CMakeFiles/drivers__pwm_input.dir/pwm_input.cpp.obj -MF src/drivers/pwm_input/CMakeFiles/drivers__pwm_input.dir/pwm_input.cpp.obj.d -o src/drivers/pwm_input/CMakeFiles/drivers__pwm_input.dir/pwm_input.cpp.obj -c /home/dcasl_kari/PX4-Autopilot/src/drivers/pwm_input/pwm_input.cpp
In file included from /home/dcasl_kari/PX4-Autopilot/src/drivers/pwm_input/pwm_input.cpp:34:
/home/dcasl_kari/PX4-Autopilot/src/drivers/pwm_input/pwm_input.h:120:2: error: #error PWMIN_TIMER_CHANNEL must be either 1 and 2.
120 | #error PWMIN_TIMER_CHANNEL must be either 1 and 2.
| ^~~~~
compilation terminated due to -Wfatal-errors.
[650/1238] Building CXX object src/dri…Files/drivers__px4io.dir/px4io.cpp.obj
ninja: build stopped: subcommand failed.
make: *** [Makefile:227: px4_fmu-v6c_default] Error 1

Hey since helping on that git issue, I’ve learnt a lot more about best practices for building px4 firmware. I recommend now instead of changing the config/kconfig files manually to instead build with the boardguiconfig flag at the end i.e. make px4_fmu-v6c boardguiconfig, just to remove the chance of human error.

The 6c firmware seems to be the only one that has the PWM_TIMER_CHANNEL variable set to 3. you might be able to mess around with this, but its going to be tricky work.

When i compare the pixhawk 6c page with the original pixhawk 1 page, it doesn’t mention anywhere that it supports pwm IN. I also remember reading somewhere that “some models of flight controllers didn’t support pwm IN unlike older models”. This would also explain why I was never able to get my cuav x7+ pro to work with the pwm lidarlite, as they expect in both cases for people to use the included CAN / I2C ports instead. But then again the person I was talking with in that chat was able to make it work, so maybe this means nothing.

thank you for your apply, we also consider about using I2C. but the manual page introduce about the PWM one. So i was curious about 6C series can use PWM.
I think I should use I2C too.

1 Like