Daniel Agar
6 years ago
6 changed files with 294 additions and 195 deletions
@ -0,0 +1,141 @@
@@ -0,0 +1,141 @@
|
||||
#!nsh |
||||
# |
||||
# PX4 FMUv2 specific board init |
||||
# |
||||
#------------------------------------------------------------------------------ |
||||
# |
||||
# UART mapping on FMUv2: |
||||
# |
||||
# UART1 /dev/ttyS0 IO debug |
||||
# USART2 /dev/ttyS1 TELEM1 (flow control) |
||||
# USART3 /dev/ttyS2 TELEM2 (flow control) |
||||
# UART4 |
||||
# UART7 CONSOLE |
||||
# UART8 /dev/ttyS6 SERIAL4/TELEM4 |
||||
# |
||||
#------------------------------------------------------------------------------ |
||||
# |
||||
|
||||
# |
||||
# Bootloader upgrade |
||||
# |
||||
set BL_FILE /etc/extras/px4fmuv3_bl.bin |
||||
if [ -f $BL_FILE ] |
||||
then |
||||
if param compare SYS_BL_UPDATE 1 |
||||
then |
||||
param set SYS_BL_UPDATE 0 |
||||
param save |
||||
echo "BL update..." >> $LOG_FILE |
||||
bl_update $BL_FILE |
||||
echo "BL update done" >> $LOG_FILE |
||||
reboot |
||||
fi |
||||
fi |
||||
unset BL_FILE |
||||
|
||||
|
||||
if [ $AUTOCNF = yes ] |
||||
then |
||||
param set SYS_FMU_TASK 1 |
||||
fi |
||||
|
||||
|
||||
# External I2C bus |
||||
hmc5883 -C -T -X start |
||||
lis3mdl -X start |
||||
ist8310 -C start |
||||
|
||||
# Internal I2C bus |
||||
hmc5883 -C -T -I -R 4 start |
||||
|
||||
# Internal SPI bus ICM-20608-G |
||||
mpu6000 -T 20608 start |
||||
|
||||
set BOARD_FMUV3 0 |
||||
|
||||
# V3 build hwtypecmp supports V2|V2M|V30 |
||||
if ver hwtypecmp V30 |
||||
then |
||||
# Check for Pixhawk 2.0 cube |
||||
# external MPU6K is rotated 180 degrees yaw |
||||
if mpu6000 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 20 |
||||
else |
||||
# Check for Pixhawk 2.1 cube |
||||
# external MPU9250 is rotated 180 degrees yaw |
||||
if mpu9250 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 21 |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
# Check if a Pixhack (which reports as V2M) is present |
||||
if ver hwtypecmp V2M |
||||
then |
||||
# Pixhawk Mini doesn't have these sensors, |
||||
# so if they are found we know its a Pixhack |
||||
|
||||
# external MPU6K is rotated 180 degrees yaw |
||||
if mpu6000 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 20 |
||||
else |
||||
# Check for Pixhack 3.1 |
||||
# external MPU9250 is rotated 180 degrees yaw |
||||
if mpu9250 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 21 |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
if [ $BOARD_FMUV3 != 0 ] |
||||
then |
||||
# sensor heating is available, but we disable it for now |
||||
param set SENS_EN_THERMAL 0 |
||||
|
||||
# external L3GD20H is rotated 180 degrees yaw |
||||
l3gd20 -X -R 4 start |
||||
|
||||
# external LSM303D is rotated 270 degrees yaw |
||||
lsm303d -X -R 6 start |
||||
|
||||
if [ $BOARD_FMUV3 = 20 ] |
||||
then |
||||
# v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw |
||||
mpu6000 -R 14 start |
||||
|
||||
# v2.0 Has internal hmc5883 on SPI1 |
||||
hmc5883 -C -T -S -R 8 start |
||||
fi |
||||
|
||||
if [ $BOARD_FMUV3 = 21 ] |
||||
then |
||||
# v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw |
||||
mpu9250 -R 14 start |
||||
fi |
||||
|
||||
else |
||||
# $BOARD_FMUV3 = 0 -> FMUv2 |
||||
|
||||
mpu6000 start |
||||
|
||||
# As we will use the external mag and the ICM-20608-G |
||||
# V2 build hwtypecmp is always false |
||||
# V3 build hwtypecmp supports V2|V2M|V30 |
||||
if ! ver hwtypecmp V2M |
||||
then |
||||
mpu9250 start |
||||
# else: On the PixhawkMini the mpu9250 has been disabled due to HW errata |
||||
fi |
||||
|
||||
l3gd20 start |
||||
lsm303d start |
||||
fi |
||||
|
||||
px4flow start & |
||||
|
||||
unset BOARD_FMUV3 |
@ -0,0 +1,141 @@
@@ -0,0 +1,141 @@
|
||||
#!nsh |
||||
# |
||||
# PX4 FMUv2 specific board init |
||||
# |
||||
#------------------------------------------------------------------------------ |
||||
# |
||||
# UART mapping on FMUv2: |
||||
# |
||||
# UART1 /dev/ttyS0 IO debug |
||||
# USART2 /dev/ttyS1 TELEM1 (flow control) |
||||
# USART3 /dev/ttyS2 TELEM2 (flow control) |
||||
# UART4 |
||||
# UART7 CONSOLE |
||||
# UART8 /dev/ttyS6 SERIAL4/TELEM4 |
||||
# |
||||
#------------------------------------------------------------------------------ |
||||
# |
||||
|
||||
# |
||||
# Bootloader upgrade |
||||
# |
||||
set BL_FILE /etc/extras/px4fmuv3_bl.bin |
||||
if [ -f $BL_FILE ] |
||||
then |
||||
if param compare SYS_BL_UPDATE 1 |
||||
then |
||||
param set SYS_BL_UPDATE 0 |
||||
param save |
||||
echo "BL update..." >> $LOG_FILE |
||||
bl_update $BL_FILE |
||||
echo "BL update done" >> $LOG_FILE |
||||
reboot |
||||
fi |
||||
fi |
||||
unset BL_FILE |
||||
|
||||
|
||||
if [ $AUTOCNF = yes ] |
||||
then |
||||
param set SYS_FMU_TASK 1 |
||||
fi |
||||
|
||||
|
||||
# External I2C bus |
||||
hmc5883 -C -T -X start |
||||
lis3mdl -X start |
||||
ist8310 -C start |
||||
|
||||
# Internal I2C bus |
||||
hmc5883 -C -T -I -R 4 start |
||||
|
||||
# Internal SPI bus ICM-20608-G |
||||
mpu6000 -T 20608 start |
||||
|
||||
set BOARD_FMUV3 0 |
||||
|
||||
# V3 build hwtypecmp supports V2|V2M|V30 |
||||
if ver hwtypecmp V30 |
||||
then |
||||
# Check for Pixhawk 2.0 cube |
||||
# external MPU6K is rotated 180 degrees yaw |
||||
if mpu6000 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 20 |
||||
else |
||||
# Check for Pixhawk 2.1 cube |
||||
# external MPU9250 is rotated 180 degrees yaw |
||||
if mpu9250 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 21 |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
# Check if a Pixhack (which reports as V2M) is present |
||||
if ver hwtypecmp V2M |
||||
then |
||||
# Pixhawk Mini doesn't have these sensors, |
||||
# so if they are found we know its a Pixhack |
||||
|
||||
# external MPU6K is rotated 180 degrees yaw |
||||
if mpu6000 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 20 |
||||
else |
||||
# Check for Pixhack 3.1 |
||||
# external MPU9250 is rotated 180 degrees yaw |
||||
if mpu9250 -S -R 4 start |
||||
then |
||||
set BOARD_FMUV3 21 |
||||
fi |
||||
fi |
||||
fi |
||||
|
||||
if [ $BOARD_FMUV3 != 0 ] |
||||
then |
||||
# sensor heating is available, but we disable it for now |
||||
param set SENS_EN_THERMAL 0 |
||||
|
||||
# external L3GD20H is rotated 180 degrees yaw |
||||
l3gd20 -X -R 4 start |
||||
|
||||
# external LSM303D is rotated 270 degrees yaw |
||||
lsm303d -X -R 6 start |
||||
|
||||
if [ $BOARD_FMUV3 = 20 ] |
||||
then |
||||
# v2.0 internal MPU6000 is rotated 180 deg roll, 270 deg yaw |
||||
mpu6000 -R 14 start |
||||
|
||||
# v2.0 Has internal hmc5883 on SPI1 |
||||
hmc5883 -C -T -S -R 8 start |
||||
fi |
||||
|
||||
if [ $BOARD_FMUV3 = 21 ] |
||||
then |
||||
# v2.1 internal MPU9250 is rotated 180 deg roll, 270 deg yaw |
||||
mpu9250 -R 14 start |
||||
fi |
||||
|
||||
else |
||||
# $BOARD_FMUV3 = 0 -> FMUv2 |
||||
|
||||
mpu6000 start |
||||
|
||||
# As we will use the external mag and the ICM-20608-G |
||||
# V2 build hwtypecmp is always false |
||||
# V3 build hwtypecmp supports V2|V2M|V30 |
||||
if ! ver hwtypecmp V2M |
||||
then |
||||
mpu9250 start |
||||
# else: On the PixhawkMini the mpu9250 has been disabled due to HW errata |
||||
fi |
||||
|
||||
l3gd20 start |
||||
lsm303d start |
||||
fi |
||||
|
||||
px4flow start & |
||||
|
||||
unset BOARD_FMUV3 |
Loading…
Reference in new issue