From d940f500f6dce3bda1b8429246fb77979b964323 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Fri, 30 Nov 2018 14:05:31 -0500 Subject: [PATCH] move fmu-v4 init to rc.board --- ROMFS/px4fmu_common/init.d/rc.mavlink | 6 -- ROMFS/px4fmu_common/init.d/rc.sensors | 60 ----------------- ROMFS/px4fmu_common/init.d/rcS | 15 +---- ROMFS/px4fmu_test/init.d/rc.sensors | 29 +-------- boards/px4/fmu-v4/init/rc.board | 92 +++++++++++++++++++++++++++ 5 files changed, 96 insertions(+), 106 deletions(-) create mode 100644 boards/px4/fmu-v4/init/rc.board diff --git a/ROMFS/px4fmu_common/init.d/rc.mavlink b/ROMFS/px4fmu_common/init.d/rc.mavlink index 1a8141ec8a..5552edcf75 100644 --- a/ROMFS/px4fmu_common/init.d/rc.mavlink +++ b/ROMFS/px4fmu_common/init.d/rc.mavlink @@ -11,12 +11,6 @@ then mavlink start -r 800000 -d /dev/ttyACM0 -m config -x fi -if ver hwcmp PX4_FMU_V4 -then - # Pixracer: start MAVLink on Wifi (ESP8266 port) - mavlink start -r 20000 -b 921600 -d /dev/ttyS0 -fi - if ver hwcmp AV_X_V1 then # AV-X: start MAVLink to companion (connected to TX2) diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 3c28bceea1..ee33481c24 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -22,17 +22,6 @@ then fmu i2c 2 100000 fi - if ver hwcmp PX4_FMU_V4 - then - # We know there are sketchy boards out there - # as chinese companies produce Pixracers without - # fully understanding the critical parts of the - # schematic and BOM, leading to sensor brownouts - # on boot. Original Pixracers following the - # open hardware design do not require this. - fmu sensor_reset 50 - fi - # External SPI ms5611 -S start @@ -255,55 +244,6 @@ then fi fi -if ver hwcmp PX4_FMU_V4 -then - # External I2C bus - hmc5883 -C -T -X start - lis3mdl -X start - ist8310 start - bmp280 -I start - - # expansion i2c used for BMM150 rotated by 90deg - bmm150 -R 2 start - - # hmc5883 internal SPI bus is rotated 90 deg yaw - if ! hmc5883 -C -T -S -R 2 start - then - # lis3mdl internal SPI bus is rotated 90 deg yaw - if ! lis3mdl start - then - # BMI055 gyro internal SPI bus - bmi055 -G start - fi - fi - - # Start either ICM2060X or BMI055. They are both connected to the same SPI bus and use the same - # chip select pin. There are different boards with either one of them and the WHO_AM_I register - # will prevent the incorrect driver from a successful initialization. - - # ICM20602 internal SPI bus ICM-20608-G is rotated 90 deg yaw - if ! mpu6000 -R 2 -T 20602 start - then - # ICM20608 internal SPI bus ICM-20602-G is rotated 90 deg yaw - if ! mpu6000 -R 2 -T 20608 start - then - # BMI055 accel internal SPI bus - bmi055 -A start - fi - fi - - # Start either MPU9250 or BMI160. They are both connected to the same SPI bus and use the same - # chip select pin. There are different boards with either one of them and the WHO_AM_I register - # will prevent the incorrect driver from a successful initialization. - - # mpu9250 internal SPI bus mpu9250 is rotated 90 deg yaw - if ! mpu9250 -R 2 start - then - # BMI160 internal SPI bus - bmi160 start - fi -fi - if ver hwcmp PX4_FMU_V4PRO then # Internal SPI bus ICM-20608-G diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 8278aabb42..ec288b2c75 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -339,13 +339,13 @@ else if [ $AUTOCNF = yes ] then # Run FMU as task on Pixracer and on boards with enough RAM. - if ver hwcmp PX4_FMU_V4 PX4_FMU_V4PRO PX4_FMU_V5 + if ver hwcmp PX4_FMU_V4PRO PX4_FMU_V5 then param set SYS_FMU_TASK 1 fi - # Disable safety switch by default on Pixracer and OmnibusF4SD. - if ver hwcmp PX4_FMU_V4 OMNIBUS_F4SD + # Disable safety switch by default on OmnibusF4SD. + if ver hwcmp OMNIBUS_F4SD then param set CBRK_IO_SAFETY 22027 fi @@ -514,15 +514,6 @@ else # sh /etc/init.d/rc.serial - if ver hwcmp PX4_FMU_V4 - then - # Run FrSky Telemetry on Pixracer on the FrSky port if not enabled already - if param compare TEL_FRSKY_CONFIG 0 - then - frsky_telemetry start -d /dev/ttyS6 -t 15 - fi - fi - # # Configure vehicle type specific parameters. # Note: rc.vehicle_setup is the entry point for rc.interface, diff --git a/ROMFS/px4fmu_test/init.d/rc.sensors b/ROMFS/px4fmu_test/init.d/rc.sensors index 3a47199dac..173e220f5a 100644 --- a/ROMFS/px4fmu_test/init.d/rc.sensors +++ b/ROMFS/px4fmu_test/init.d/rc.sensors @@ -1,6 +1,6 @@ #!nsh # -# Standard startup script for PX4FMU v2, v3, v4 onboard sensor drivers. +# Standard startup script for onboard sensor drivers. # # Configure all I2C buses to 100 KHz as they @@ -82,33 +82,6 @@ then fi fi -if ver hwcmp PX4_FMU_V4 -then - # External I2C bus - if hmc5883 -C -T -X start - then - fi - - if lis3mdl -R 2 start - then - fi - - # Internal SPI bus is rotated 90 deg yaw - if hmc5883 -C -T -S -R 2 start - then - fi - - # Internal SPI bus ICM-20608-G is rotated 90 deg yaw - if mpu6000 -R 2 -T 20608 start - then - fi - - # Internal SPI bus mpu9250 is rotated 90 deg yaw - if mpu9250 -R 2 start - then - fi -fi - if ver hwcmp AIRMIND_MINDPX_V2 then # External I2C bus diff --git a/boards/px4/fmu-v4/init/rc.board b/boards/px4/fmu-v4/init/rc.board new file mode 100644 index 0000000000..f3f394c179 --- /dev/null +++ b/boards/px4/fmu-v4/init/rc.board @@ -0,0 +1,92 @@ +#!nsh +# +# PX4 FMUv4 specific board init +# +#------------------------------------------------------------------------------ +# +# UART mapping on FMUv5: +# +# UART1 /dev/ttyS0 wifi +# USART2 /dev/ttyS1 TELEM1 (flow control) +# USART3 /dev/ttyS2 TELEM2 (flow control) +# UART4 +# UART7 CONSOLE +# UART8 /dev/ttyS6 SERIAL4/TELEM4 +# +#------------------------------------------------------------------------------ +# + +# We know there are sketchy boards out there +# as chinese companies produce Pixracers without +# fully understanding the critical parts of the +# schematic and BOM, leading to sensor brownouts +# on boot. Original Pixracers following the +# open hardware design do not require this. +fmu sensor_reset 50 + +if [ $AUTOCNF = yes ] +then + # Disable safety switch by default + param set CBRK_IO_SAFETY 22027 + + param set SYS_FMU_TASK 1 +fi + +set MIXER_AUX none + + +# External I2C bus +hmc5883 -C -T -X start +lis3mdl -X start +ist8310 start +bmp280 -I start + +# expansion i2c used for BMM150 rotated by 90deg +bmm150 -R 2 start + +# hmc5883 internal SPI bus is rotated 90 deg yaw +if ! hmc5883 -C -T -S -R 2 start +then + # lis3mdl internal SPI bus is rotated 90 deg yaw + if ! lis3mdl start + then + # BMI055 gyro internal SPI bus + bmi055 -G start + fi +fi + +# Start either ICM2060X or BMI055. They are both connected to the same SPI bus and use the same +# chip select pin. There are different boards with either one of them and the WHO_AM_I register +# will prevent the incorrect driver from a successful initialization. + +# ICM20602 internal SPI bus ICM-20608-G is rotated 90 deg yaw +if ! mpu6000 -R 2 -T 20602 start +then + # ICM20608 internal SPI bus ICM-20602-G is rotated 90 deg yaw + if ! mpu6000 -R 2 -T 20608 start + then + # BMI055 accel internal SPI bus + bmi055 -A start + fi +fi + +# Start either MPU9250 or BMI160. They are both connected to the same SPI bus and use the same +# chip select pin. There are different boards with either one of them and the WHO_AM_I register +# will prevent the incorrect driver from a successful initialization. + +# mpu9250 internal SPI bus mpu9250 is rotated 90 deg yaw +if ! mpu9250 -R 2 start +then + # BMI160 internal SPI bus + bmi160 start +fi + + +# Pixracer: start MAVLink on Wifi (ESP8266 port) +mavlink start -r 20000 -b 921600 -d /dev/ttyS0 + +# Run FrSky Telemetry on Pixracer on the FrSky port if not enabled already +if param compare TEL_FRSKY_CONFIG 0 +then + frsky_telemetry start -d /dev/ttyS6 -t 15 +fi