PWM frequency issue with fmu-v5_default

Hi,

On a Pixhawk 4 mini, and I’m compiling the v1.12 beta 5.
The PWM frequency that I get as output has a factor 8 compared to what is required, and it makes my servo motors suffer.
What I tried:
1- make distclean and make submodulesdistclean, no difference
2- changing the rate in CLI, changes the rate, but not to the desired value (pwm rate -c 1234 -r 40 gives 320Hz at the scope)

Commits and scope trace


Pwm status:
channel 1: 1500 us (alternative rate: 50 Hz failsafe: 0, disarmed: 1500 us, min: 1000 us, max: 2000 us, trim: 0.00)

Traces of the compilation

(base) Malis@MacBook-Pro PX4-Autopilot % make clean
(base) Malis@MacBook-Pro PX4-Autopilot % make px4_fmu-v5_default upload
– PX4 version: v1.12.0-beta3
– PX4 config file: /Users/Malis/Workspace/my-code/PX4-Autopilot/boards/px4/fmu-v5/default.cmake
– PX4 config: px4_fmu-v5_default
– PX4 platform: nuttx
– cmake build type: MinSizeRel
– The CXX compiler identification is GNU 9.3.1
– The C compiler identification is GNU 9.3.1
– The ASM compiler identification is GNU
– Found assembler: /usr/local/bin/arm-none-eabi-gcc
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/local/bin/arm-none-eabi-g++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/local/bin/arm-none-eabi-gcc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Enabling double FP precision hardware instructions
– ccache enabled (export CCACHE_DISABLE=1 to disable)
– Found PythonInterp: /Users/Malis/anaconda3/bin/python3 (found suitable version “3.7.9”, minimum required is “3”)
– build type is MinSizeRel
– PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-551-g5d34d7a
– Building and including px4_io-v2_default
CMake Deprecation Warning at src/drivers/uavcan/libuavcan/CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument value or use a … suffix to tell
CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at src/drivers/uavcan/libuavcan/libuavcan/CMakeLists.txt:5 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument value or use a … suffix to tell
CMake that the project does not need compatibility with older versions.

– Found PythonInterp: /Users/Malis/anaconda3/bin/python3 (found version “3.7.9”)
– Using C++11
– Release build type: MinSizeRel
– ROMFS: ROMFS/px4fmu_common
– ROMFS: Adding build/px4_fmu-v5_default/romfs_extras/px4_io-v2_default.bin → /etc/extras/px4_io-v2_default.bin
– ROMFS: Adding boards/px4/fmu-v5/bootloader/px4_fmu-v5_bootloader.bin → /etc/extras/bootloader.bin
– ROMFS: Adding platforms/nuttx/init/stm32f7/rc.board_arch_defaults → /etc/init.d/rc.board_arch_defaults
– ROMFS: Adding boards/px4/fmu-v5/init/rc.board_defaults → /etc/init.d/rc.board_defaults
– ROMFS: Adding boards/px4/fmu-v5/init/rc.board_sensors → /etc/init.d/rc.board_sensors
– ROMFS: Adding boards/px4/fmu-v5/init/rc.board_mavlink → /etc/init.d/rc.board_mavlink
– Configuring done
– Generating done
– Build files have been written to: /Users/Malis/Workspace/my-code/PX4-Autopilot/build/px4_fmu-v5_default
[1/1494] git submodule platforms/nuttx/NuttX/nuttx
[5/1494] git submodule src/lib/ecl
[10/1494] git submodule src/drivers/gps/devices
[11/1494] git submodule src/drivers/uavcan/libuavcan
[12/1494] git submodule mavlink/include/mavlink/v2.0
[15/1494] git submodule platforms/nuttx/NuttX/apps
[164/1494] Performing configure step for ‘px4io_firmware’
– PX4 version: v1.12.0-beta3
– PX4 config file: /Users/Malis/Workspace/my-code/PX4-Autopilot/boards/px4/io-v2/default.cmake
– PX4 config: px4_io-v2_default
– PX4 platform: nuttx
– cmake build type: MinSizeRel
– The CXX compiler identification is GNU 9.3.1
– The C compiler identification is GNU 9.3.1
– The ASM compiler identification is GNU
– Found assembler: /usr/local/bin/arm-none-eabi-gcc
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/local/bin/arm-none-eabi-g++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/local/bin/arm-none-eabi-gcc - skipped
– Detecting C compile features
– Detecting C compile features - done
– ccache enabled (export CCACHE_DISABLE=1 to disable)
– Found PythonInterp: /Users/Malis/anaconda3/bin/python3 (found suitable version “3.7.9”, minimum required is “3”)
– build type is MinSizeRel
– PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-551-g5d34d7a
– Configuring done
– Generating done
– Build files have been written to: /Users/Malis/Workspace/my-code/PX4-Autopilot/build/px4_fmu-v5_default/external/Build/px4io_firmware
[351/1494] Performing build step for ‘px4io_firmware’
[0/244] git submodule platforms/nuttx/NuttX/nuttx
[6/244] git submodule platforms/nuttx/NuttX/apps
[242/244] Linking CXX executable px4_io-v2_default.elf
Memory region Used Size Region Size %age Used
flash: 58320 B 60 KB 94.92%
sram: 3856 B 8 KB 47.07%
[244/244] Creating /Users/Malis/Work…d/px4io_firmware/px4_io-v2_default.px4
[1491/1494] Linking CXX executable px4_fmu-v5_default.elf
Memory region Used Size Region Size %age Used
FLASH_ITCM: 0 GB 2016 KB 0.00%
FLASH_AXIM: 2029517 B 2016 KB 98.31%
ITCM_RAM: 0 GB 16 KB 0.00%
DTCM_RAM: 0 GB 128 KB 0.00%
SRAM1: 50104 B 368 KB 13.30%
SRAM2: 0 GB 16 KB 0.00%
[1493/1494] uploading px4
Loaded firmware for board id: 50,0 size: 2029517 bytes (98.31%), waiting for the bootloader…

Attempting reboot on /dev/tty.usbmodem01 with baudrate=57600…
If the board does not respond, unplug and re-plug the USB connector.

Found board id: 50,0 bootloader version: 5 on /dev/tty.usbmodem01
sn: xxxxxxx
chip: xxxxxx
family: b’STM32F7[6|7]x’
revision: b’Z’
flash: 2064384 bytes
Windowed mode: False

Erase : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting. Elapsed Time 28.455

Thanks!

Hi, thanks for reporting.

This should be fixed in the meanwhile, can you test with the latest branch release/1.12?

Hi,

Yes, that works (I assume the fixes were done between beta3 and beta5).

Thanks!