mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-02 20:20:05 +08:00
Compare commits
163 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1555f2bd22 | |||
| caa45c1caa | |||
| 8cb7d1c050 | |||
| 08e14a8072 | |||
| 1dacb4cdef | |||
| 011af5f797 | |||
| f75a92d199 | |||
| f6ec71d39f | |||
| 247067d392 | |||
| f69c6354dd | |||
| 23d8b3cf25 | |||
| 0c1b5e88c5 | |||
| e5f4adaa2d | |||
| 3e0290b084 | |||
| a2db688f4b | |||
| 4536f3b2e4 | |||
| 4b5a709e27 | |||
| 4339833696 | |||
| 4409f82efc | |||
| f916aeddea | |||
| b70381584c | |||
| 3691b132b2 | |||
| 4901edb5a4 | |||
| c5e2d9d871 | |||
| 50b85ca831 | |||
| 61eb53dc75 | |||
| 9687324778 | |||
| b303e9517f | |||
| 8df02de9fd | |||
| b0e86ba364 | |||
| 454a987568 | |||
| beb834af2b | |||
| 6eb8d042e1 | |||
| d09aa8ade5 | |||
| b50a9dac84 | |||
| 73fa6e0c52 | |||
| 968089bae4 | |||
| 43ba199c37 | |||
| a536e3dfe2 | |||
| 5d433ddef7 | |||
| 5928d7f067 | |||
| 740bf63fa7 | |||
| 634ad3893e | |||
| 26109a2fe6 | |||
| ff2441d73a | |||
| b15e57dd4f | |||
| 9ab8970206 | |||
| c3ed50488f | |||
| 6cdf09644e | |||
| 4138ab0436 | |||
| e5d92c5195 | |||
| 2edc3cf845 | |||
| 813494bc3d | |||
| e9a142ac7d | |||
| 40c9789e7d | |||
| b8c541dd72 | |||
| 2d3238dfbe | |||
| ad36b9add7 | |||
| 13cb8ce4a8 | |||
| b4f425db56 | |||
| e961b29c56 | |||
| 6e65478959 | |||
| 2f5aa92596 | |||
| 080e16f0a6 | |||
| 27e6a0d227 | |||
| ff8663b0b1 | |||
| 3e68e806b8 | |||
| 39351acbcb | |||
| 2c9b739814 | |||
| 5e8ee98bf9 | |||
| d98f3554da | |||
| 1f30b2168d | |||
| 17177b3948 | |||
| ccef260f10 | |||
| 3c9c5f7184 | |||
| 7316d50555 | |||
| 97112a7d20 | |||
| cd9fd12e91 | |||
| a3f1f0e846 | |||
| 37015c3dbe | |||
| 7160da741d | |||
| db48b04281 | |||
| da8dcc4942 | |||
| 7c2c288c09 | |||
| 30870e50c0 | |||
| 28b018f9bd | |||
| 3896df3e72 | |||
| 56fcabf0b1 | |||
| 7b60737f9a | |||
| 440165809a | |||
| d9fd67be3b | |||
| 3cf205c4a6 | |||
| d54e488288 | |||
| 70081652fe | |||
| 61bfa4fdc5 | |||
| 3c94a447d6 | |||
| 44805b9e62 | |||
| c5fc5c83d2 | |||
| ac1a157740 | |||
| 8af893348a | |||
| 251e24bccb | |||
| fc80b09c84 | |||
| 5359fe59e5 | |||
| 24603589d2 | |||
| 4b70105583 | |||
| 61036599db | |||
| eb23779c57 | |||
| a07b8c08ab | |||
| 36ec1fa811 | |||
| 694501b782 | |||
| 7dd8e3f614 | |||
| fe335344e7 | |||
| 343c7fcd52 | |||
| 66df5c1bd1 | |||
| 090f929659 | |||
| 89b238f094 | |||
| ecd1e9f730 | |||
| cca59843cc | |||
| 1806a7cec8 | |||
| 856b2e6178 | |||
| e0e5b38c0e | |||
| d0d113405a | |||
| 4ff03e4a06 | |||
| 8eb34ce8ce | |||
| 62077908a3 | |||
| cb2cc65eff | |||
| 4fc3f07cb1 | |||
| 9b092d6d35 | |||
| 21fb22d581 | |||
| 3c1bcbdee6 | |||
| d9b1a695b5 | |||
| 8838ebd77d | |||
| 7e0f0516a5 | |||
| 5b3d19944c | |||
| f2e706d7c4 | |||
| 5a5849d61a | |||
| 682190a21f | |||
| e0a2e0b223 | |||
| d9585bf3d3 | |||
| 2374937388 | |||
| ce8c4094a8 | |||
| 11436f4109 | |||
| db89bd5b5e | |||
| ae678e8e2f | |||
| 53bcb8789f | |||
| afa56d21c5 | |||
| 8cb7a67819 | |||
| c89f0776f6 | |||
| b21e7e6c87 | |||
| ccb46a2152 | |||
| f34fbdf0d3 | |||
| 7cbf720d26 | |||
| 29a3abb817 | |||
| 4e4ba40289 | |||
| d5cbf5df01 | |||
| 0d7933beac | |||
| 19029526d0 | |||
| b0712ef7a0 | |||
| 71293b4943 | |||
| fb1491de33 | |||
| 487b9ca7ef | |||
| 5aa5fc2da5 | |||
| 4b7da42a6e |
@@ -40,6 +40,8 @@ pipeline {
|
||||
"ark_can-flow_default",
|
||||
"ark_can-gps_canbootloader",
|
||||
"ark_can-gps_default",
|
||||
"ark_cannode_canbootloader",
|
||||
"ark_cannode_default",
|
||||
"ark_can-rtk-gps_canbootloader",
|
||||
"ark_can-rtk-gps_default",
|
||||
"ark_fmu-v6x_bootloader",
|
||||
@@ -53,8 +55,10 @@ pipeline {
|
||||
"cuav_nora_default",
|
||||
"cuav_x7pro_default",
|
||||
"cubepilot_cubeorange_default",
|
||||
"cubepilot_cubeorangeplus_default",
|
||||
"cubepilot_cubeyellow_default",
|
||||
"diatone_mamba-f405-mk2_default",
|
||||
"flywoo_gn-f405_default",
|
||||
"freefly_can-rtk-gps_canbootloader",
|
||||
"freefly_can-rtk-gps_default",
|
||||
"holybro_can-gps-v1_canbootloader",
|
||||
@@ -72,7 +76,7 @@ pipeline {
|
||||
"matek_h743_default",
|
||||
"modalai_fc-v1_default",
|
||||
"modalai_fc-v2_default",
|
||||
"modalai_voxl2-io_default",
|
||||
"mro_ctrl-zero-classic_default",
|
||||
"mro_ctrl-zero-f7_default",
|
||||
"mro_ctrl-zero-f7-oem_default",
|
||||
"mro_ctrl-zero-h7-oem_default",
|
||||
@@ -85,6 +89,7 @@ pipeline {
|
||||
"nxp_fmuk66-v3_default",
|
||||
"nxp_fmuk66-v3_socketcan",
|
||||
"nxp_fmurt1062-v1_default",
|
||||
"nxp_mr-canhubk3_default",
|
||||
"nxp_ucans32k146_canbootloader",
|
||||
"nxp_ucans32k146_default",
|
||||
"omnibus_f4sd_default",
|
||||
|
||||
@@ -45,6 +45,7 @@ jobs:
|
||||
matek_h743-slim,
|
||||
modalai_fc-v1,
|
||||
modalai_fc-v2,
|
||||
mro_ctrl-zero-classic,
|
||||
mro_ctrl-zero-f7,
|
||||
mro_ctrl-zero-f7-oem,
|
||||
mro_ctrl-zero-h7,
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v4.1.1
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
||||
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
|
||||
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
|
||||
days-before-issue-stale: 30
|
||||
days-before-pr-stale: 45
|
||||
days-before-issue-close: 5
|
||||
days-before-pr-close: 10
|
||||
debug-only: true
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
[submodule "platforms/nuttx/NuttX/nuttx"]
|
||||
path = platforms/nuttx/NuttX/nuttx
|
||||
url = https://github.com/PX4/NuttX.git
|
||||
branch = px4_firmware_nuttx-10.3.0+
|
||||
branch = px4_firmware_nuttx-10.3.0+-v1.14
|
||||
[submodule "platforms/nuttx/NuttX/apps"]
|
||||
path = platforms/nuttx/NuttX/apps
|
||||
url = https://github.com/PX4/NuttX-apps.git
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
param set-default FW_LAUN_DETCN_ON 1
|
||||
param set-default FW_THR_IDLE 0.1 # needs to be running before throw as that's how gazebo detects arming
|
||||
param set-default FW_LAUN_AC_THLD 10
|
||||
|
||||
param set-default FW_LND_ANG 8
|
||||
|
||||
|
||||
@@ -34,9 +34,7 @@ param set-default CA_ROTOR3_PX -0.25
|
||||
param set-default CA_ROTOR3_PY 0.25
|
||||
param set-default CA_ROTOR3_KM -0.05
|
||||
|
||||
param set-default PWM_AUX_FUNC1 101
|
||||
param set-default PWM_AUX_FUNC2 102
|
||||
param set-default PWM_AUX_FUNC3 103
|
||||
param set-default PWM_AUX_FUNC4 104
|
||||
param set-default PWM_AUX_TIM0 -4
|
||||
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
|
||||
@@ -162,7 +162,7 @@ else
|
||||
param select-backup $PARAM_BACKUP_FILE
|
||||
fi
|
||||
|
||||
if ver hwcmp PX4_FMU_V5X PX4_FMU_V6X ARK_FMU_V6X
|
||||
if mft query -q -k MFT -s MFT_ETHERNET -v 1
|
||||
then
|
||||
netman update -i eth0
|
||||
fi
|
||||
@@ -255,6 +255,7 @@ else
|
||||
rgbled start -X -q
|
||||
rgbled_ncp5623c start -X -q
|
||||
rgbled_lp5562 start -X -q
|
||||
rgbled_is31fl3195 start -X -q
|
||||
|
||||
#
|
||||
# Override parameters from user configuration file.
|
||||
@@ -265,12 +266,9 @@ else
|
||||
. $FCONFIG
|
||||
fi
|
||||
|
||||
#
|
||||
# Start IO for PWM output or RC input if enabled
|
||||
#
|
||||
if param compare -s SYS_USE_IO 1
|
||||
if px4io supported
|
||||
then
|
||||
# Check if PX4IO present and update firmware if needed.
|
||||
# Check if PX4IO present and update firmware if needed.
|
||||
if [ -f $IOFW ]
|
||||
then
|
||||
if ! px4io checkcrc ${IOFW}
|
||||
@@ -292,12 +290,12 @@ else
|
||||
tune_control stop
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! px4io start
|
||||
then
|
||||
echo "PX4IO start failed"
|
||||
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
|
||||
if ! px4io start
|
||||
then
|
||||
echo "PX4IO start failed"
|
||||
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Executable
+115
@@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
# Flash PX4 to a device running AuterionOS in the local network
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ $# -lt 2 ]; then
|
||||
echo "Usage: $0 -f <firmware.px4|.elf> [-c <configuration_dir>] -d <IP/Device> [-u <user>] [-p <ssh_port>] [--revert]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ssh_port=22
|
||||
ssh_user=root
|
||||
|
||||
while getopts ":f:c:d:p:u:r" opt; do
|
||||
case ${opt} in
|
||||
f )
|
||||
if [ -n "$OPTARG" ]; then
|
||||
firmware_file="$OPTARG"
|
||||
else
|
||||
echo "ERROR: -f requires a non-empty option argument."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
c )
|
||||
if [ -f "$OPTARG/rc.autostart" ]; then
|
||||
config_dir="$OPTARG"
|
||||
else
|
||||
echo "ERROR: -c configuration directory is empty or does not contain a valid rc.autostart"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
d )
|
||||
if [ "$OPTARG" ]; then
|
||||
device="$OPTARG"
|
||||
else
|
||||
echo "ERROR: -d requires a non-empty option argument."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
p )
|
||||
if [[ "$OPTARG" =~ ^[0-9]+$ ]]; then
|
||||
ssh_port="$OPTARG"
|
||||
else
|
||||
echo "ERROR: -p ssh_port must be a number."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
u )
|
||||
if [ "$OPTARG" ]; then
|
||||
ssh_user="$OPTARG"
|
||||
else
|
||||
echo "ERROR: -u requires a non-empty option argument."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
r )
|
||||
revert=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$device" ]; then
|
||||
echo "Error: missing device"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
target_dir=/shared_container_dir/fmu
|
||||
target_file_name="update-dev.tar"
|
||||
|
||||
if [ "$revert" == true ]; then
|
||||
# revert to the release version which was originally deployed
|
||||
cmd="cp $target_dir/update.tar $target_dir/$target_file_name"
|
||||
ssh -t -p $ssh_port $ssh_user@$device "$cmd"
|
||||
else
|
||||
# create custom update-dev.tar
|
||||
tmp_dir="$(mktemp -d)"
|
||||
config_path=""
|
||||
firmware_path=""
|
||||
|
||||
if [ -d "$config_dir" ]; then
|
||||
cp -r "$config_dir" "$tmp_dir/config"
|
||||
config_path=config
|
||||
fi
|
||||
|
||||
if [ -f "$firmware_file" ]; then
|
||||
extension="${firmware_file##*.}"
|
||||
cp "$firmware_file" "$tmp_dir/firmware.$extension"
|
||||
if [ "$extension" == "elf" ]; then
|
||||
# ensure the file is stripped to reduce file size
|
||||
arm-none-eabi-strip "$tmp_dir/firmware.$extension"
|
||||
fi
|
||||
firmware_path="firmware.$extension"
|
||||
fi
|
||||
|
||||
pushd "$tmp_dir" &>/dev/null
|
||||
|
||||
if [ -z $firmware_path ] && [ -z $config_path ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar_name="tar"
|
||||
|
||||
if [ -x "$(command -v gtar)" ]; then
|
||||
# check if gnu-tar is installed on macOS and use that instead
|
||||
tar_name="gtar"
|
||||
fi
|
||||
|
||||
$tar_name -C "$tmp_dir" --sort=name --owner=root:0 --group=root:0 --mtime='2019-01-01 00:00:00' -cvf $target_file_name $firmware_path $config_path
|
||||
|
||||
# send it to the target to start flashing
|
||||
scp -P $ssh_port "$target_file_name" $ssh_user@"$device":$target_dir
|
||||
popd &>/dev/null
|
||||
rm -rf "$tmp_dir"
|
||||
fi
|
||||
|
||||
# grab status output for flashing progress
|
||||
cmd="tail --follow=name $target_dir/update_status 2>/dev/null || true"
|
||||
ssh -t -p $ssh_port $ssh_user@$device "$cmd"
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$(dirname $(readlink -f $0))"
|
||||
DEFAULT_AUTOPILOT_HOST=10.41.1.1
|
||||
DEFAULT_AUTOPILOT_PORT=33333
|
||||
DEFAULT_AUTOPILOT_USER=auterion
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--file=*)
|
||||
PX4_BINARY_FILE="${i#*=}"
|
||||
;;
|
||||
--default-ip=*)
|
||||
DEFAULT_AUTOPILOT_HOST="${i#*=}"
|
||||
;;
|
||||
--default-port=*)
|
||||
DEFAULT_AUTOPILOT_PORT="${i#*=}"
|
||||
;;
|
||||
--default-user=*)
|
||||
DEFAULT_AUTOPILOT_USER="${i#*=}"
|
||||
;;
|
||||
--revert)
|
||||
REVERT_AUTOPILOT_ARGUMENT=-r
|
||||
;;
|
||||
--wifi)
|
||||
DEFAULT_AUTOPILOT_HOST=10.41.0.1
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# allow these to be overridden
|
||||
[ -z "$AUTOPILOT_HOST" ] && AUTOPILOT_HOST=$DEFAULT_AUTOPILOT_HOST
|
||||
[ -z "$AUTOPILOT_PORT" ] && AUTOPILOT_PORT=$DEFAULT_AUTOPILOT_PORT
|
||||
[ -z "$AUTOPILOT_USER" ] && AUTOPILOT_USER=$DEFAULT_AUTOPILOT_USER
|
||||
|
||||
ARGUMENTS=()
|
||||
ARGUMENTS+=(-d "$AUTOPILOT_HOST")
|
||||
ARGUMENTS+=(-p "$AUTOPILOT_PORT")
|
||||
ARGUMENTS+=(-u "$AUTOPILOT_USER")
|
||||
ARGUMENTS+=(${PX4_BINARY_FILE:+-f "$PX4_BINARY_FILE"})
|
||||
ARGUMENTS+=($REVERT_AUTOPILOT_ARGUMENT)
|
||||
|
||||
echo "Flashing $AUTOPILOT_HOST ..."
|
||||
|
||||
"$DIR"/remote_update_fmu.sh "${ARGUMENTS[@]}"
|
||||
|
||||
exit 0
|
||||
+498
-1132
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ sitl_num=2
|
||||
[ -n "$1" ] && sitl_num="$1"
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
src_path="$SCRIPT_DIR/../../"
|
||||
src_path="$SCRIPT_DIR/.."
|
||||
|
||||
build_path=${src_path}/build/px4_sitl_default
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
CONFIG_COMMON_OPTICAL_FLOW=y
|
||||
CONFIG_COMMON_OSD=y
|
||||
CONFIG_DRIVERS_PWM_OUT=y
|
||||
CONFIG_BOARD_UAVCAN_INTERFACES=1
|
||||
CONFIG_DRIVERS_UAVCANNODE=y
|
||||
|
||||
@@ -20,6 +20,7 @@ CONFIG_DRIVERS_HEATER=y
|
||||
CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16507=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_IIM42652=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_IIM42653=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
CONFIG_COMMON_OPTICAL_FLOW=y
|
||||
|
||||
@@ -17,17 +17,19 @@ param set-default SENS_EN_INA228 0
|
||||
param set-default SENS_EN_INA226 1
|
||||
|
||||
param set-default SENS_EN_THERMAL 1
|
||||
param set-default SENS_TEMP_ID 2818058
|
||||
param set-default SENS_IMU_TEMP 10.0
|
||||
#param set-default SENS_IMU_TEMP_FF 0.0
|
||||
#param set-default SENS_IMU_TEMP_I 0.025
|
||||
#param set-default SENS_IMU_TEMP_P 1.0
|
||||
|
||||
if ver hwtypecmp ARKV6X001000 ARKV6X001001 ARKV6X001002 ARKV6X001003 ARKV6X001004 ARKV6X001005 ARKV6X001006 ARKV6X001007
|
||||
if ver hwtypecmp ARKV6X000
|
||||
then
|
||||
param set-default SYS_USE_IO 0
|
||||
else
|
||||
param set-default SYS_USE_IO 1
|
||||
param set-default SENS_TEMP_ID 2818058
|
||||
fi
|
||||
|
||||
if ver hwtypecmp ARKV6X001
|
||||
then
|
||||
param set-default SENS_TEMP_ID 3014666
|
||||
fi
|
||||
|
||||
safety_button start
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
set HAVE_PM2 yes
|
||||
|
||||
if ver hwtypecmp ARKV6X005000 ARKV6X005001 ARKV6X005002 ARKV6X005003 ARKV6X005004
|
||||
if mft query -q -k MFT -s MFT_PM2 -v 0
|
||||
then
|
||||
set HAVE_PM2 no
|
||||
fi
|
||||
@@ -47,14 +47,29 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Internal SPI bus IIM42652 with SPIX measured frequency of 32.051kHz
|
||||
iim42652 -R 3 -s -b 1 -C 32051 start
|
||||
if ver hwtypecmp ARKV6X000
|
||||
then
|
||||
# Internal SPI bus IIM42652 with SPIX measured frequency of 32.051kHz
|
||||
iim42652 -R 3 -s -b 1 -C 32051 start
|
||||
|
||||
# Internal SPI bus ICM42688p with SPIX measured frequency of 32.051kHz
|
||||
icm42688p -R 9 -s -b 2 -C 32051 start
|
||||
# Internal SPI bus ICM42688p with SPIX measured frequency of 32.051kHz
|
||||
icm42688p -R 9 -s -b 2 -C 32051 start
|
||||
|
||||
# Internal SPI bus ICM42688p with SPIX measured frequency of 32.051kHz
|
||||
icm42688p -R 6 -s -b 3 -C 32051 start
|
||||
# Internal SPI bus ICM42688p with SPIX measured frequency of 32.051kHz
|
||||
icm42688p -R 6 -s -b 3 -C 32051 start
|
||||
fi
|
||||
|
||||
if ver hwtypecmp ARKV6X001
|
||||
then
|
||||
# Internal SPI bus IIM42653 with SPIX measured frequency of 32.051kHz
|
||||
iim42653 -R 3 -s -b 1 -C 32051 start
|
||||
|
||||
# Internal SPI bus IIM42653 with SPIX measured frequency of 32.051kHz
|
||||
iim42653 -R 9 -s -b 2 -C 32051 start
|
||||
|
||||
# Internal SPI bus IIM42653 with SPIX measured frequency of 32.051kHz
|
||||
iim42653 -R 6 -s -b 3 -C 32051 start
|
||||
fi
|
||||
|
||||
# Internal magnetometer on I2C
|
||||
bmm150 -I start
|
||||
|
||||
@@ -55,7 +55,6 @@ else()
|
||||
init.c
|
||||
led.c
|
||||
mtd.cpp
|
||||
manifest.c
|
||||
sdio.c
|
||||
spi.cpp
|
||||
spix_sync.c
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016-2022 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2016-2024 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -204,30 +204,17 @@
|
||||
#define BOARD_ADC_OPEN_CIRCUIT_V (5.6f)
|
||||
|
||||
/* HW Version and Revision drive signals Default to 1 to detect */
|
||||
#define BOARD_HAS_HW_VERSIONING
|
||||
#define BOARD_HAS_HW_SPLIT_VERSIONING
|
||||
|
||||
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
|
||||
#define GPIO_HW_REV_SENSE /* PH4 */ GPIO_ADC3_INP15
|
||||
#define GPIO_HW_VER_SENSE /* PH3 */ GPIO_ADC3_INP14
|
||||
#define HW_INFO_INIT_PREFIX "ARKV6X"
|
||||
|
||||
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 2 // Rev 0 and Rev 3,4 Sensor sets
|
||||
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 2
|
||||
// Base/FMUM
|
||||
#define ARKV6X00 HW_VER_REV(0x0,0x0) // ARKV6X, Rev 0
|
||||
#define ARKV6X01 HW_VER_REV(0x0,0x1) // ARKV6X, BMI388 I2C2 Rev 1
|
||||
#define ARKV6X03 HW_VER_REV(0x0,0x3) // ARKV6X, Sensor Set Rev 3
|
||||
#define ARKV6X04 HW_VER_REV(0x0,0x4) // ARKV6X, Sensor Set Rev 4
|
||||
#define ARKV6X10 HW_VER_REV(0x1,0x0) // NO PX4IO, Rev 0
|
||||
#define ARKV6X13 HW_VER_REV(0x1,0x3) // NO PX4IO, Sensor Set Rev 3
|
||||
#define ARKV6X14 HW_VER_REV(0x1,0x4) // NO PX4IO, Sensor Set Rev 4
|
||||
//#define ARKV6X40 HW_VER_REV(0x4,0x0) // ARKV6X, HB CM4 base Rev 0 // never shipped
|
||||
//#define ARKV6X41 HW_VER_REV(0x4,0x1) // ARKV6X, BMI388 I2C2 HB CM4 base Rev 1 // never shipped
|
||||
#define ARKV6X43 HW_VER_REV(0x4,0x3) // ARKV6X, Sensor Set HB CM4 base Rev 3
|
||||
#define ARKV6X44 HW_VER_REV(0x4,0x4) // ARKV6X, Sensor Set HB CM4 base Rev 4
|
||||
#define ARKV6X50 HW_VER_REV(0x5,0x0) // ARKV6X, ARKV6X Rev 0 with HB Mini Rev 5
|
||||
//#define ARKV6X51 HW_VER_REV(0x5,0x1) // ARKV6X, BMI388 I2C2 HB Mini Rev 1 // never shipped
|
||||
#define ARKV6X53 HW_VER_REV(0x5,0x3) // ARKV6X, Sensor Set HB Mini Rev 3
|
||||
#define ARKV6X54 HW_VER_REV(0x5,0x4) // ARKV6X, Sensor Set HB Mini Rev 4
|
||||
#define ARKV6X_0 HW_FMUM_ID(0x0) // ARKV6X, Sensor Set Rev 0
|
||||
#define ARKV6X_1 HW_FMUM_ID(0x1) // ARKV6X, Sensor Set Rev 1
|
||||
|
||||
#define UAVCAN_NUM_IFACES_RUNTIME 1
|
||||
|
||||
@@ -252,7 +239,6 @@
|
||||
/* PWM
|
||||
*/
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 8
|
||||
#define BOARD_PWM_FREQ 1024000
|
||||
|
||||
#define GPIO_FMU_CH1 /* PI0 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTI|GPIO_PIN0)
|
||||
#define GPIO_FMU_CH2 /* PH12 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTH|GPIO_PIN12)
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2022 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file manifest.c
|
||||
*
|
||||
* This module supplies the interface to the manifest of hardware that is
|
||||
* optional and dependent on the HW REV and HW VER IDs
|
||||
*
|
||||
* The manifest allows the system to know whether a hardware option
|
||||
* say for example the PX4IO is an no-pop option vs it is broken.
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <board_config.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "systemlib/px4_macros.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
uint32_t hw_ver_rev; /* the version and revision */
|
||||
const px4_hw_mft_item_t *mft; /* The first entry */
|
||||
uint32_t entries; /* the lenght of the list */
|
||||
} px4_hw_mft_list_entry_t;
|
||||
|
||||
typedef px4_hw_mft_list_entry_t *px4_hw_mft_list_entry;
|
||||
#define px4_hw_mft_list_uninitialized (px4_hw_mft_list_entry) -1
|
||||
|
||||
static const px4_hw_mft_item_t device_unsupported = {0, 0, 0};
|
||||
|
||||
// List of components on a specific board configuration
|
||||
// The index of those components is given by the enum (px4_hw_mft_item_id_t)
|
||||
// declared in board_common.h
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0600[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0610[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0640[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0650[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static px4_hw_mft_list_entry_t mft_lists[] = {
|
||||
// ver_rev
|
||||
{ARKV6X00, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)},
|
||||
{ARKV6X01, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // BMP388 moved to I2C2
|
||||
{ARKV6X03, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // BMP388 moved to I2C2, Sensor Set 3
|
||||
//{ARKV6X40, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // HB CM4 base // never shipped
|
||||
//{ARKV6X41, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2 HB CM4 base // never shipped
|
||||
{ARKV6X43, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 3
|
||||
{ARKV6X44, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 4
|
||||
{ARKV6X50, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // ARKV6X Rev 0 with HB Mini Rev 5
|
||||
//{ARKV6X51, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // BMP388 moved to I2C2 HB Mini // never shipped
|
||||
{ARKV6X53, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // BMP388 moved to I2C2, HB Mini Sensor Set 3
|
||||
{ARKV6X54, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // BMP388 moved to I2C2, HB Mini Sensor Set 4
|
||||
{ARKV6X10, hw_mft_list_v0610, arraySize(hw_mft_list_v0610)}, // No PX4IO
|
||||
{ARKV6X13, hw_mft_list_v0610, arraySize(hw_mft_list_v0610)}, // No PX4IO BMP388 moved to I2C2, Sensor Set 3
|
||||
{ARKV6X04, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // BMP388 moved to I2C2, Sensor Set 4
|
||||
{ARKV6X14, hw_mft_list_v0610, arraySize(hw_mft_list_v0610)}, // No PX4IO BMP388 moved to I2C2, Sensor Set 4
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_query_manifest
|
||||
*
|
||||
* Description:
|
||||
* Optional returns manifest item.
|
||||
*
|
||||
* Input Parameters:
|
||||
* manifest_id - the ID for the manifest item to retrieve
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 - item is not in manifest => assume legacy operations
|
||||
* pointer to a manifest item
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT px4_hw_mft_item board_query_manifest(px4_hw_mft_item_id_t id)
|
||||
{
|
||||
static px4_hw_mft_list_entry boards_manifest = px4_hw_mft_list_uninitialized;
|
||||
|
||||
if (boards_manifest == px4_hw_mft_list_uninitialized) {
|
||||
uint32_t ver_rev = board_get_hw_version() << 16;
|
||||
ver_rev |= board_get_hw_revision();
|
||||
|
||||
for (unsigned i = 0; i < arraySize(mft_lists); i++) {
|
||||
if (mft_lists[i].hw_ver_rev == ver_rev) {
|
||||
boards_manifest = &mft_lists[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (boards_manifest == px4_hw_mft_list_uninitialized) {
|
||||
syslog(LOG_ERR, "[boot] Board %08" PRIx32 " is not supported!\n", ver_rev);
|
||||
}
|
||||
}
|
||||
|
||||
px4_hw_mft_item rv = &device_unsupported;
|
||||
|
||||
if (boards_manifest != px4_hw_mft_list_uninitialized &&
|
||||
id < boards_manifest->entries) {
|
||||
rv = &boards_manifest->mft[id];
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 PX4 Development Team. All rights reserved.
|
||||
* Copyright (C) 2024 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,6 +31,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <board_config.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <px4_platform_common/px4_manifest.h>
|
||||
// KiB BS nB
|
||||
@@ -92,10 +95,16 @@ static const px4_mft_entry_s mtd_mft = {
|
||||
.pmft = (void *) &board_mtd_config,
|
||||
};
|
||||
|
||||
static const px4_mft_entry_s mft_mft = {
|
||||
.type = MFT,
|
||||
.pmft = (void *) system_query_manifest,
|
||||
};
|
||||
|
||||
static const px4_mft_s mft = {
|
||||
.nmft = 1,
|
||||
.nmft = 2,
|
||||
.mfts = {
|
||||
&mtd_mft
|
||||
&mtd_mft,
|
||||
&mft_mft,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 PX4 Development Team. All rights reserved.
|
||||
* Copyright (C) 2024 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSIONS] = {
|
||||
initSPIHWVersion(ARKV6X00, {
|
||||
initSPIFmumID(ARKV6X_0, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_IIM42652, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
@@ -59,15 +59,15 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(ARKV6X01, { // Placeholder
|
||||
initSPIFmumID(ARKV6X_1, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_IIM42652, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}),
|
||||
}, {GPIO::PortF, GPIO::Pin4}),
|
||||
initSPIBus(SPI::Bus::SPI3, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin6}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin6}),
|
||||
}, {GPIO::PortE, GPIO::Pin7}),
|
||||
// initSPIBus(SPI::Bus::SPI4, {
|
||||
// // no devices
|
||||
|
||||
@@ -82,9 +82,7 @@
|
||||
#define rDMAR(_tmr) REG(_tmr, STM32_GTIM_DMAR_OFFSET)
|
||||
#define rBDTR(_tmr) REG(_tmr, STM32_ATIM_BDTR_OFFSET)
|
||||
|
||||
#if !defined(BOARD_PWM_FREQ)
|
||||
#define BOARD_PWM_FREQ 1000000
|
||||
#endif
|
||||
#define BOARD_SPIX_SYNC_PWM_FREQ 1024000
|
||||
|
||||
unsigned
|
||||
spix_sync_timer_get_period(unsigned timer)
|
||||
@@ -129,11 +127,11 @@ static void spix_sync_timer_init_timer(unsigned timer, unsigned rate)
|
||||
* Otherwise, other frequencies are attainable by adjusting .clock_freq accordingly.
|
||||
*/
|
||||
|
||||
rPSC(timer) = (spix_sync_timers[timer].clock_freq / BOARD_PWM_FREQ) - 1;
|
||||
rPSC(timer) = (spix_sync_timers[timer].clock_freq / BOARD_SPIX_SYNC_PWM_FREQ) - 1;
|
||||
|
||||
/* configure the timer to update at the desired rate */
|
||||
|
||||
rARR(timer) = (BOARD_PWM_FREQ / rate) - 1;
|
||||
rARR(timer) = (BOARD_SPIX_SYNC_PWM_FREQ / rate) - 1;
|
||||
|
||||
/* generate an update event; reloads the counter and all registers */
|
||||
rEGR(timer) = GTIM_EGR_UG;
|
||||
|
||||
@@ -140,15 +140,7 @@
|
||||
|
||||
#define PX4_PWM_ALTERNATE_RANGES
|
||||
#define PWM_LOWEST_MIN 0
|
||||
#define PWM_MOTOR_OFF 0
|
||||
#define PWM_SERVO_STOP 0
|
||||
#define PWM_DEFAULT_MIN 20
|
||||
#define PWM_HIGHEST_MIN 0
|
||||
#define PWM_HIGHEST_MAX 255
|
||||
#define PWM_DEFAULT_MAX 255
|
||||
#define PWM_LOWEST_MAX 255
|
||||
#define PWM_DEFAULT_TRIM 1500
|
||||
|
||||
|
||||
/* High-resolution timer */
|
||||
#define HRT_TIMER 8 /* use timer8 for the HRT */
|
||||
|
||||
@@ -141,15 +141,7 @@
|
||||
|
||||
#define PX4_PWM_ALTERNATE_RANGES
|
||||
#define PWM_LOWEST_MIN 0
|
||||
#define PWM_MOTOR_OFF 0
|
||||
#define PWM_SERVO_STOP 0
|
||||
#define PWM_DEFAULT_MIN 20
|
||||
#define PWM_HIGHEST_MIN 0
|
||||
#define PWM_HIGHEST_MAX 255
|
||||
#define PWM_DEFAULT_MAX 255
|
||||
#define PWM_LOWEST_MAX 255
|
||||
#define PWM_DEFAULT_TRIM 1500
|
||||
|
||||
|
||||
/* High-resolution timer */
|
||||
#define HRT_TIMER 8 /* use timer8 for the HRT */
|
||||
|
||||
@@ -14,6 +14,4 @@ param set-default SENS_EN_THERMAL 0
|
||||
|
||||
param set-default -s SENS_TEMP_ID 2621474
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set IOFW "/etc/extras/cubepilot_io-v2_default.bin"
|
||||
|
||||
@@ -14,6 +14,4 @@ param set-default SENS_EN_THERMAL 0
|
||||
|
||||
param set-default -s SENS_TEMP_ID 2621474
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set IOFW "/etc/extras/cubepilot_io-v2_default.bin"
|
||||
|
||||
@@ -8,16 +8,22 @@ board_adc start
|
||||
# 1. Isolated {ICM42688p, ICM20948(with mag)}, body-fixed {ICM20649}
|
||||
# 2. Isolated {ICM42688p, ICM42688p}, body-fixed {ICM20649, ICM45686, AK09918}
|
||||
# 3. Isolated {ICM42688p, ICM42688p}, body-fixed {ICM45686, AK09918}
|
||||
# 4. Isolated {ICM45686, ICM45686}, body-fixed {ICM45686, AK09918}
|
||||
|
||||
# SPI4 is isolated, SPI1 is body-fixed
|
||||
|
||||
# SPI4, isolated
|
||||
ms5611 -s -b 4 start
|
||||
|
||||
icm42688p -s -b 4 -R 10 start -c 15
|
||||
if ! icm20948 -s -b 4 -R 10 -M -q start
|
||||
if icm42688p -s -b 4 -R 10 -q start -c 15
|
||||
then
|
||||
icm42688p -s -b 4 -R 6 start -c 13
|
||||
if ! icm20948 -s -b 4 -R 10 -M -q start
|
||||
then
|
||||
icm42688p -s -b 4 -R 6 start -c 13
|
||||
fi
|
||||
else
|
||||
icm45686 -s -b 4 -R 10 start -c 15
|
||||
icm45686 -s -b 4 -R 6 start -c 13
|
||||
fi
|
||||
|
||||
# SPI1, body-fixed
|
||||
|
||||
@@ -49,7 +49,9 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIBus(SPI::Bus::SPI4, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20948, SPI::CS{GPIO::PortE, GPIO::Pin4}), // MPU_EXT_CS
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortC, GPIO::Pin15}), // ACCEL_EXT_CS
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM45686, SPI::CS{GPIO::PortC, GPIO::Pin15}), // ACCEL_EXT_CS
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortC, GPIO::Pin13}), // GYRO_EXT_CS
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM45686, SPI::CS{GPIO::PortC, GPIO::Pin13}), // GYRO_EXT_CS
|
||||
initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortC, GPIO::Pin14}), // BARO_EXT_CS
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -13,6 +13,4 @@ param set-default BAT2_A_PER_V 17
|
||||
# Disable IMU thermal control
|
||||
param set-default SENS_EN_THERMAL 0
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set IOFW "/etc/extras/cubepilot_io-v2_default.bin"
|
||||
|
||||
@@ -11,5 +11,3 @@ param set-default BAT2_A_PER_V 36.367515152
|
||||
|
||||
# Enable IMU thermal control
|
||||
param set-default SENS_EN_THERMAL 1
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@@ -33,6 +33,12 @@ CONFIG_MODULES_COMMANDER=y
|
||||
CONFIG_MODULES_CONTROL_ALLOCATOR=y
|
||||
CONFIG_MODULES_DATAMAN=y
|
||||
CONFIG_MODULES_EKF2=y
|
||||
# CONFIG_EKF2_AUXVEL is not set
|
||||
# CONFIG_EKF2_BARO_COMPENSATION is not set
|
||||
# CONFIG_EKF2_DRAG_FUSION is not set
|
||||
# CONFIG_EKF2_EXTERNAL_VISION is not set
|
||||
# CONFIG_EKF2_GNSS_YAW is not set
|
||||
# CONFIG_EKF2_SIDESLIP is not set
|
||||
CONFIG_MODULES_ESC_BATTERY=y
|
||||
CONFIG_MODULES_EVENTS=y
|
||||
CONFIG_MODULES_FLIGHT_MODE_MANAGER=y
|
||||
|
||||
@@ -22,13 +22,10 @@ param set-default CBRK_SUPPLY_CHK 894281
|
||||
# Select the Generic 250 Racer by default
|
||||
param set-default SYS_AUTOSTART 4050
|
||||
|
||||
# use the Q attitude estimator, it works w/o mag or GPS.
|
||||
param set-default SYS_MC_EST_GROUP 3
|
||||
param set-default ATT_ACC_COMP 0
|
||||
param set-default ATT_W_ACC 0.4000
|
||||
param set-default ATT_W_GYRO_BIAS 0.0000
|
||||
|
||||
# use EKF2 without mag
|
||||
param set-default SYS_HAS_MAG 0
|
||||
# and enable gravity fusion
|
||||
param set-default EKF2_IMU_CONTROL 7
|
||||
|
||||
# the startup tune is not great on a binary output buzzer, so disable it
|
||||
param set-default CBRK_BUZZER 782090
|
||||
|
||||
@@ -43,7 +43,7 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIDevice(DRV_OSD_DEVTYPE_ATXXXX, SPI::CS{GPIO::PortB, GPIO::Pin12}),
|
||||
}),
|
||||
initSPIBus(SPI::Bus::SPI4, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20689, SPI::CS{GPIO::PortE, GPIO::Pin4}, SPI::DRDY{GPIO::PortE, GPIO::Pin1}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortE, GPIO::Pin4}, SPI::DRDY{GPIO::PortE, GPIO::Pin1}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_MPU6000, SPI::CS{GPIO::PortE, GPIO::Pin4}, SPI::DRDY{GPIO::PortE, GPIO::Pin1}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_BMI270, SPI::CS{GPIO::PortE, GPIO::Pin4}, SPI::DRDY{GPIO::PortE, GPIO::Pin1}),
|
||||
}),
|
||||
|
||||
@@ -32,6 +32,12 @@ CONFIG_MODULES_COMMANDER=y
|
||||
CONFIG_MODULES_CONTROL_ALLOCATOR=y
|
||||
CONFIG_MODULES_DATAMAN=y
|
||||
CONFIG_MODULES_EKF2=y
|
||||
# CONFIG_EKF2_AUXVEL is not set
|
||||
# CONFIG_EKF2_BARO_COMPENSATION is not set
|
||||
# CONFIG_EKF2_DRAG_FUSION is not set
|
||||
# CONFIG_EKF2_EXTERNAL_VISION is not set
|
||||
# CONFIG_EKF2_GNSS_YAW is not set
|
||||
# CONFIG_EKF2_SIDESLIP is not set
|
||||
CONFIG_MODULES_ESC_BATTERY=y
|
||||
CONFIG_MODULES_EVENTS=y
|
||||
CONFIG_MODULES_FLIGHT_MODE_MANAGER=y
|
||||
|
||||
@@ -33,6 +33,12 @@ CONFIG_MODULES_COMMANDER=y
|
||||
CONFIG_MODULES_CONTROL_ALLOCATOR=y
|
||||
CONFIG_MODULES_DATAMAN=y
|
||||
CONFIG_MODULES_EKF2=y
|
||||
# CONFIG_EKF2_AUXVEL is not set
|
||||
# CONFIG_EKF2_BARO_COMPENSATION is not set
|
||||
# CONFIG_EKF2_DRAG_FUSION is not set
|
||||
# CONFIG_EKF2_EXTERNAL_VISION is not set
|
||||
# CONFIG_EKF2_GNSS_YAW is not set
|
||||
# CONFIG_EKF2_SIDESLIP is not set
|
||||
CONFIG_MODULES_ESC_BATTERY=y
|
||||
CONFIG_MODULES_EVENTS=y
|
||||
CONFIG_MODULES_FLIGHT_MODE_MANAGER=y
|
||||
|
||||
@@ -9,7 +9,5 @@ param set-default BAT2_V_DIV 18.1
|
||||
param set-default BAT1_A_PER_V 36.367515152
|
||||
param set-default BAT2_A_PER_V 36.367515152
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
rgbled_pwm start
|
||||
safety_button start
|
||||
|
||||
@@ -14,10 +14,10 @@ CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y
|
||||
CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
# CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
# CONFIG_DRIVERS_IMU_INVENSENSE_ICM20602=y
|
||||
# CONFIG_DRIVERS_IMU_INVENSENSE_ICM20649=y
|
||||
# CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20602=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20649=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
@@ -29,13 +29,11 @@ CONFIG_DRIVERS_POWER_MONITOR_INA226=y
|
||||
CONFIG_DRIVERS_POWER_MONITOR_VOXLPM=y
|
||||
CONFIG_DRIVERS_PWM_OUT=y
|
||||
CONFIG_DRIVERS_RC_INPUT=y
|
||||
CONFIG_DRIVERS_RPM=y
|
||||
CONFIG_COMMON_TELEMETRY=y
|
||||
CONFIG_DRIVERS_UAVCAN=y
|
||||
CONFIG_BOARD_UAVCAN_INTERFACES=1
|
||||
CONFIG_BOARD_UAVCAN_TIMER_OVERRIDE=2
|
||||
CONFIG_MODULES_AIRSPEED_SELECTOR=y
|
||||
# CONFIG_MODULES_ATTITUDE_ESTIMATOR_Q=y
|
||||
CONFIG_MODULES_CAMERA_FEEDBACK=y
|
||||
CONFIG_MODULES_COMMANDER=y
|
||||
CONFIG_MODULES_CONTROL_ALLOCATOR=y
|
||||
@@ -54,7 +52,6 @@ CONFIG_MODULES_GYRO_FFT=y
|
||||
CONFIG_MODULES_LAND_DETECTOR=y
|
||||
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
|
||||
CONFIG_MODULES_LOAD_MON=y
|
||||
# CONFIG_MODULES_LOCAL_POSITION_ESTIMATOR=y
|
||||
CONFIG_MODULES_LOGGER=y
|
||||
CONFIG_MODULES_MAG_BIAS_ESTIMATOR=y
|
||||
CONFIG_MODULES_MANUAL_CONTROL=y
|
||||
@@ -73,7 +70,6 @@ CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
|
||||
CONFIG_MODULES_UXRCE_DDS_CLIENT=y
|
||||
CONFIG_MODULES_VTOL_ATT_CONTROL=y
|
||||
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
|
||||
CONFIG_SYSTEMCMDS_BL_UPDATE=y
|
||||
CONFIG_SYSTEMCMDS_BSONDUMP=y
|
||||
CONFIG_SYSTEMCMDS_DMESG=y
|
||||
CONFIG_SYSTEMCMDS_GPIO=y
|
||||
|
||||
@@ -20,8 +20,8 @@ icm42688p -s -b 1 -R 12 start
|
||||
# Internal SPI2 ICM-42688
|
||||
icm42688p -s -b 2 -R 12 start
|
||||
|
||||
# Don't start Internal I2C mag
|
||||
# bmm150 -I start
|
||||
# Internal I2C mag
|
||||
bmm150 -I start
|
||||
|
||||
# Internal I2C baro
|
||||
icp201xx -I start
|
||||
|
||||
@@ -68,18 +68,4 @@ else()
|
||||
nuttx_drivers # sdio
|
||||
px4_layer
|
||||
)
|
||||
|
||||
set(COMMON_MODALAI_SRC_DIR ${PX4_SOURCE_DIR}/boards/modalai/src)
|
||||
set(MODALAI_SYSTEMCMD_SRC_DIR ${COMMON_MODALAI_SRC_DIR}/systemcmds/modalai)
|
||||
|
||||
px4_add_module(
|
||||
MODULE systemcmds__modalai
|
||||
MAIN modalai
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
${MODALAI_SYSTEMCMD_SRC_DIR}/modalai_fc-v2.c
|
||||
${MODALAI_SYSTEMCMD_SRC_DIR}/modalai_fc-v1.c
|
||||
${MODALAI_SYSTEMCMD_SRC_DIR}/modalai.c
|
||||
DEPENDS
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -91,12 +91,6 @@
|
||||
# define GPIO_nLED_GREEN /* PE4 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN4)
|
||||
# define GPIO_nLED_BLUE /* PE5 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN5)
|
||||
|
||||
// GPIO_nLED_2_RED/ GPIO_nLED_2_GREEN /GPIO_nLED_2_BLUE are for v1 LED tests
|
||||
|
||||
# define GPIO_nLED_2_RED /* PI0 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTI|GPIO_PIN0)
|
||||
# define GPIO_nLED_2_GREEN /* PH11 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTH|GPIO_PIN11)
|
||||
# define GPIO_nLED_2_BLUE /* PA2 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN2)
|
||||
|
||||
# define BOARD_HAS_CONTROL_STATUS_LEDS 1
|
||||
# define BOARD_OVERLOAD_LED LED_RED
|
||||
# define BOARD_ARMED_STATE_LED LED_BLUE
|
||||
@@ -214,12 +208,6 @@
|
||||
|
||||
#define CAN1_SILENT /* PD15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN15)
|
||||
|
||||
/* For primary/backup signaling with VOXL, 2 pins on J4 are exposed */
|
||||
// GPIO_VOXL_STATUS_OUT/ GPIO_VOXL_STATUS_IN are for v1 Spare MSS Communications Interface and J4 tests
|
||||
|
||||
#define GPIO_VOXL_STATUS_OUT /* PE4 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN4)
|
||||
#define GPIO_VOXL_STATUS_IN /* PE3 */ (GPIO_INPUT|GPIO_FLOAT|GPIO_PORTE|GPIO_PIN3)
|
||||
|
||||
/* Define True logic Power Control in arch agnostic form */
|
||||
|
||||
#define VDD_3V3_SPEKTRUM_POWER_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SPEKTRUM_POWER_EN, (on_true))
|
||||
@@ -350,8 +338,8 @@
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
// J5 USART5 TELEM2 Port next to PWM connector
|
||||
#define MODAL_IO_DEFAULT_PORT "/dev/ttyS4"
|
||||
// J1 / TELEM1 / USART7
|
||||
#define MODAL_IO_DEFAULT_PORT "/dev/ttyS6"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
#include <px4_platform_common/module.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "board_config.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
// v2
|
||||
#ifdef CONFIG_ARCH_CHIP_STM32H753II // chip on M0087
|
||||
#include "modalai_fc-v2.h"
|
||||
#define MODALAI_FC_V2 1
|
||||
#else
|
||||
#include "modalai_fc-v1.h"
|
||||
#endif
|
||||
|
||||
__EXPORT int modalai_main(int argc, char *argv[]);
|
||||
|
||||
int modalai_main(int argc, char *argv[])
|
||||
{
|
||||
int hw_rev = board_get_hw_revision();
|
||||
int hw_ver = board_get_hw_version();
|
||||
|
||||
eHW_TYPE hw_type = eHwNone;
|
||||
|
||||
#ifdef MODALAI_FC_V2
|
||||
|
||||
if (hw_rev == 0 && hw_ver == 3) { // (should be hw_rev == 1 && hw_ver == 3) eventually...
|
||||
hw_type = eM0087;
|
||||
|
||||
} else if (hw_rev == 0 && hw_ver == 3) {
|
||||
hw_type = eM0079;
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (hw_rev == 6 && hw_ver == 0) {
|
||||
hw_type = eM0018;
|
||||
|
||||
} else if (hw_rev == 0 && hw_ver == 1) {
|
||||
hw_type = eM0019;
|
||||
|
||||
} else if (hw_rev == 0 && hw_ver == 2) {
|
||||
hw_type = eM0051;
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (argc <= 1) {
|
||||
#ifdef MODALAI_FC_V2
|
||||
modalai_print_usage_v2();
|
||||
#else
|
||||
modalai_print_usage_v1();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "led")) {
|
||||
#ifdef MODALAI_FC_V2
|
||||
return modalai_led_test_v2();
|
||||
#else
|
||||
return modalai_led_test_v1();
|
||||
#endif
|
||||
|
||||
} else if (!strcmp(argv[1], "con")) {
|
||||
if (argc <= 2) {
|
||||
PRINT_MODULE_USAGE_COMMAND("con");
|
||||
PRINT_MODULE_USAGE_ARG("<1,4,5,6,7,9,10,12,13>", "Connector ID", false);
|
||||
PRINT_MODULE_USAGE_ARG("<uint>", "Pin Number", false);
|
||||
PRINT_MODULE_USAGE_ARG("0 | 1", "<output state> (defaults to 0)", false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t con = 0;
|
||||
uint8_t pin = 0;
|
||||
bool state = false;
|
||||
|
||||
if (argc > 2) {
|
||||
con = atoi(argv[2]);
|
||||
}
|
||||
|
||||
if (argc > 3) {
|
||||
pin = atoi(argv[3]);
|
||||
}
|
||||
|
||||
if (argc > 4) {
|
||||
state = atoi(argv[4]);
|
||||
}
|
||||
|
||||
#ifdef MODALAI_FC_V2
|
||||
return modalai_con_gpio_test_v2(con, pin, state);
|
||||
#else
|
||||
return modalai_con_gpio_test_v1(con, pin, state);
|
||||
#endif
|
||||
|
||||
} else if (!strcmp(argv[1], "buzz")) {
|
||||
|
||||
#ifdef MODALAI_FC_V2
|
||||
return modalai_buzz_test_v2(hw_type);
|
||||
#else
|
||||
return modalai_buzz_test_v1(hw_type);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
} else if (!strcmp(argv[1], "detect")) {
|
||||
#ifdef MODALAI_FC_V2
|
||||
modalai_hw_detect_v2(hw_type);
|
||||
#else
|
||||
modalai_hw_detect_v1(hw_type);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MODALAI_FC_V2
|
||||
modalai_print_usage_v2();
|
||||
#else
|
||||
modalai_print_usage_v1();
|
||||
#endif
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1,913 +0,0 @@
|
||||
#include <px4_platform_common/module.h>
|
||||
|
||||
|
||||
#include "chip.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "board_config.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
// v1
|
||||
#ifndef CONFIG_ARCH_CHIP_STM32H743ZI
|
||||
|
||||
#include "modalai_fc-v1.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void modalai_print_usage_v1(void)
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("ModalAI Test utility\n");
|
||||
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("modalai", "command");
|
||||
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("led", "LED Test");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("con", "Connector Output Test (as GPIO)");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("buzz", "Automated buzz out test");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("detect", "Detect board type");
|
||||
}
|
||||
|
||||
void modalai_print_usage_con_gpio_test_v1(void)
|
||||
{
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("modalai con", "command");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("1", "W<3,6> R<2,6>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("4", "W<2-4,6-7> R<8>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("5", "W<2-5>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("6", "W<2-5>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("7", "W<2-9>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("9", "R<2>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("10", "W<2-5>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("12", "W<1-3>, <0-1>");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("13", "W<3-5>, <0-1>");
|
||||
}
|
||||
|
||||
int modalai_led_test_v1(void)
|
||||
{
|
||||
PX4_INFO("Running led test");
|
||||
|
||||
stm32_configgpio(GPIO_nLED_RED);
|
||||
stm32_configgpio(GPIO_nLED_GREEN);
|
||||
stm32_configgpio(GPIO_nLED_BLUE);
|
||||
|
||||
int i = 0;
|
||||
|
||||
stm32_configgpio(GPIO_nLED_2_RED);
|
||||
stm32_configgpio(GPIO_nLED_2_GREEN);
|
||||
stm32_configgpio(GPIO_nLED_2_BLUE);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_RED, false);
|
||||
|
||||
stm32_gpiowrite(GPIO_nLED_2_RED, false);
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_RED, true);
|
||||
stm32_gpiowrite(GPIO_nLED_2_RED, true);
|
||||
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_GREEN, false);
|
||||
stm32_gpiowrite(GPIO_nLED_2_GREEN, false);
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_GREEN, true);
|
||||
stm32_gpiowrite(GPIO_nLED_2_GREEN, true);
|
||||
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_BLUE, false);
|
||||
stm32_gpiowrite(GPIO_nLED_2_BLUE, false);
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_BLUE, true);
|
||||
stm32_gpiowrite(GPIO_nLED_2_BLUE, true);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int modalai_con_gpio_test_v1(uint8_t con, uint8_t pin, bool state)
|
||||
{
|
||||
// validate
|
||||
switch (con) {
|
||||
// Primary MSS Communications Interface
|
||||
case 1:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J1_PIN2_IN);
|
||||
state = stm32_gpioread(J1_PIN2_IN);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J1_PIN3);
|
||||
stm32_gpiowrite(J1_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J1_PIN4);
|
||||
stm32_gpiowrite(J1_PIN4, state);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
stm32_configgpio(J1_PIN6_IN);
|
||||
state = stm32_gpioread(J1_PIN6_IN);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// STM JTAG Programming Header
|
||||
case 2:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
|
||||
// USB 2.0 Full-Speed Downstream Device Port
|
||||
case 3:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
|
||||
// Spare MSS Communications Interface
|
||||
case 4:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J4_PIN2);
|
||||
stm32_gpiowrite(J4_PIN2, state);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J4_PIN3);
|
||||
stm32_gpiowrite(J4_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J4_PIN4);
|
||||
stm32_gpiowrite(J4_PIN4, state);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
stm32_configgpio(J4_PIN6);
|
||||
stm32_gpiowrite(J4_PIN6, state);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
stm32_configgpio(J4_PIN7);
|
||||
stm32_gpiowrite(J4_PIN7, state);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
stm32_configgpio(J4_PIN8);
|
||||
state = stm32_gpioread(J4_PIN8);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// TELEMETRY CONNECTOR
|
||||
case 5:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J5_PIN2);
|
||||
stm32_gpiowrite(J5_PIN2, state);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J5_PIN3);
|
||||
stm32_gpiowrite(J5_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J5_PIN4);
|
||||
stm32_gpiowrite(J5_PIN4, state);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
stm32_configgpio(J5_PIN5);
|
||||
stm32_gpiowrite(J5_PIN5, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// EXPANSION CONNECTOR
|
||||
case 6:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J6_PIN2);
|
||||
stm32_gpiowrite(J6_PIN2, state);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J6_PIN3);
|
||||
stm32_gpiowrite(J6_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J6_PIN4);
|
||||
stm32_gpiowrite(J6_PIN4, state);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
stm32_configgpio(J6_PIN5);
|
||||
stm32_gpiowrite(J6_PIN5, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// PWM Output Connector
|
||||
case 7:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J7_PIN2);
|
||||
stm32_gpiowrite(J7_PIN2, state);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J7_PIN3);
|
||||
stm32_gpiowrite(J7_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J7_PIN4);
|
||||
stm32_gpiowrite(J7_PIN4, state);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
stm32_configgpio(J7_PIN5);
|
||||
stm32_gpiowrite(J7_PIN5, state);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
stm32_configgpio(J7_PIN6);
|
||||
stm32_gpiowrite(J7_PIN6, state);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
stm32_configgpio(J7_PIN7);
|
||||
stm32_gpiowrite(J7_PIN7, state);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
stm32_configgpio(J7_PIN8);
|
||||
stm32_gpiowrite(J7_PIN8, state);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
stm32_configgpio(J7_PIN9);
|
||||
stm32_gpiowrite(J7_PIN9, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// CAN 1 Peripheral Connector
|
||||
case 8:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
|
||||
// PPM (RC) IN
|
||||
case 9:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J9_PIN2_IN);
|
||||
state = stm32_gpioread(J9_PIN2_IN);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// GPS CONNECTOR
|
||||
case 10:
|
||||
switch (pin) {
|
||||
case 2:
|
||||
stm32_configgpio(J10_PIN2);
|
||||
stm32_gpiowrite(J10_PIN2, state);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J10_PIN3);
|
||||
stm32_gpiowrite(J10_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J10_PIN4);
|
||||
stm32_gpiowrite(J10_PIN4, state);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
stm32_configgpio(J10_PIN5);
|
||||
stm32_gpiowrite(J10_PIN5, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Micro SD Card Slot
|
||||
case 11:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
|
||||
// Spektrum RC Input Connector
|
||||
case 12:
|
||||
switch (pin) {
|
||||
case 1:
|
||||
VDD_3V3_SPEKTRUM_POWER_EN(state);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
__asm("nop");
|
||||
stm32_configgpio(J12_PIN2);
|
||||
stm32_gpiowrite(J12_PIN2, state);
|
||||
//state = stm32_gpioread(J12_PIN2);
|
||||
__asm("nop");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
stm32_configgpio(J12_PIN3);
|
||||
stm32_gpiowrite(J12_PIN3, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// I2C DISPLAY / SPARE SENSOR CONNECTOR
|
||||
case 13:
|
||||
switch (pin) {
|
||||
case 3:
|
||||
stm32_configgpio(J13_PIN3);
|
||||
stm32_gpiowrite(J13_PIN3, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
stm32_configgpio(J13_PIN4);
|
||||
stm32_gpiowrite(J13_PIN4, state);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
stm32_configgpio(J13_PIN5);
|
||||
stm32_gpiowrite(J13_PIN5, state);
|
||||
break;
|
||||
|
||||
default:
|
||||
modalai_print_usage_con_gpio_test_v1();
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
printf("GPIO - Con: %d, Pin: %d, State: %d\n", con, pin, state);
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool test_pair(uint32_t output_pin, uint32_t input_pin)
|
||||
{
|
||||
|
||||
bool state = false;
|
||||
|
||||
stm32_gpiowrite(output_pin, true);
|
||||
usleep(1000 * 10);
|
||||
state = stm32_gpioread(input_pin);
|
||||
|
||||
if (state != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
usleep(1000 * 10);
|
||||
|
||||
stm32_gpiowrite(output_pin, false);
|
||||
usleep(1000 * 10);
|
||||
state = stm32_gpioread(input_pin);
|
||||
|
||||
if (state != false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool modalai_test_pair(uint32_t output_pin, uint32_t input_pin)
|
||||
{
|
||||
|
||||
bool state = false;
|
||||
|
||||
stm32_gpiowrite(output_pin, true);
|
||||
usleep(1000 * 10);
|
||||
state = stm32_gpioread(input_pin);
|
||||
|
||||
if (state != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
usleep(1000 * 10);
|
||||
|
||||
stm32_gpiowrite(output_pin, false);
|
||||
usleep(1000 * 10);
|
||||
state = stm32_gpioread(input_pin);
|
||||
|
||||
if (state != false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int modalai_buzz_test_v1(eHW_TYPE hw_type)
|
||||
{
|
||||
PX4_INFO("test: buzz");
|
||||
usleep(1000 * 100 * 10);
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO("Using Flight Core Config");
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO("Using VOXL-Flight Config");
|
||||
|
||||
} else if (hw_type == eM0051) {
|
||||
PX4_INFO("Using M0051 Config");
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J1");
|
||||
stm32_configgpio(J1_PIN2_IN); // 2 [in] to 4 [out]
|
||||
stm32_configgpio(J1_PIN3); // 3 [out] to 6 [in]
|
||||
stm32_configgpio(J1_PIN4); // 4 [out] to 2 [in]
|
||||
stm32_configgpio(J1_PIN6_IN); // 6 [in] to 3 [out]
|
||||
|
||||
if (test_pair(J1_PIN4, J1_PIN2_IN)) {
|
||||
PX4_INFO("PASS: J1P4-J1P2");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1P4-J1P2 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1_PIN3, J1_PIN6_IN)) {
|
||||
PX4_INFO("PASS: J1P3-J1P6");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1P3-J1P6 ----------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
// NA on VOXL-Flight (internally routed)
|
||||
}
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J4");
|
||||
stm32_configgpio(J4_PIN2); // 2 [out] 6 [in]
|
||||
stm32_configgpio(J4_PIN3); // 3 [out] 7 [in]
|
||||
stm32_configgpio(J4_PIN4); // 4 [out] 8 [in]
|
||||
stm32_configgpio(J4_PIN6_IN); // 2 [out] 6 [in]
|
||||
stm32_configgpio(J4_PIN7_IN); // 3 [out] 7 [in]
|
||||
stm32_configgpio(J4_PIN8_IN); // 4 [out] 8 [in]
|
||||
|
||||
if (test_pair(J4_PIN2, J4_PIN6_IN)) {
|
||||
PX4_INFO("PASS: J4P2-J4P6");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J4P2-J4P6 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J4_PIN3, J4_PIN7_IN)) {
|
||||
PX4_INFO("PASS: J4P3-J4P7");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J4P3-J4P7 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J4_PIN4, J4_PIN8_IN)) {
|
||||
PX4_INFO("PASS: J4P4-J4P8");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J4P4-J4P8 ----------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO(">> Testing J1002");
|
||||
stm32_configgpio(J1002_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J1002_PIN3); // 3 [out] 6 [in]
|
||||
stm32_configgpio(J1002_PIN4_IN); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J1002_PIN6_IN); // 3 [out] 6 [in]
|
||||
|
||||
if (test_pair(J1002_PIN2, J1002_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J1002P2-J1002P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1002P2-J1002P4 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1002_PIN3, J1002_PIN6_IN)) {
|
||||
PX4_INFO("PASS: J1002P3-J1002P6");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1002P3-J1002P6 ----------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J5");
|
||||
stm32_configgpio(J5_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J5_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(J5_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(J5_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(J5_PIN2, J5_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J5P2-J5P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J5P2-J5P4 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J5_PIN3, J5_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J5P3-J5P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J5P3-J5P5 ----------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO(">> Testing J1010");
|
||||
stm32_configgpio(J1010_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J1010_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(J1010_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(J1010_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(J1010_PIN2, J1010_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J1010P2-J1010P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1010P2-J1010P4 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1010_PIN3, J1010_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J1010P3-J1010P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1010P3-J1010P5 ----------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J6");
|
||||
stm32_configgpio(J6_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J6_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(J6_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(J6_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(J6_PIN2, J6_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J6P2-J6P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J6P2-J6P4 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J6_PIN3, J6_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J6P3-J6P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J6P3-J6P5 ----------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO(">> Testing J1009");
|
||||
stm32_configgpio(J1009_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J1009_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(J1009_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(J1009_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(J1009_PIN2, J1009_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J1009P2-J1009P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1009P2-J1009P4 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1009_PIN3, J1009_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J1009P3-J1009P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1009P3-J1009P5 ----------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J7");
|
||||
stm32_configgpio(J7_PIN2); // 2 [out] 6 [in]
|
||||
stm32_configgpio(J7_PIN3); // 3 [out] 7 [in]
|
||||
stm32_configgpio(J7_PIN4); // 4 [out] 8 [in]
|
||||
stm32_configgpio(J7_PIN5); // 5 [out] 9 [in]
|
||||
stm32_configgpio(J7_PIN6_IN); // 6 [in] 2 [out]
|
||||
stm32_configgpio(J7_PIN7_IN); // 7 [in] 3 [out]
|
||||
stm32_configgpio(J7_PIN8_IN); // 8 [in] 4 [out]
|
||||
stm32_configgpio(J7_PIN9_IN); // 9 [in] 5 [out]
|
||||
|
||||
if (test_pair(J7_PIN2, J7_PIN6_IN)) {
|
||||
PX4_INFO("PASS: J7P2-J7P6");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J7P2-J7P6 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J7_PIN3, J7_PIN7_IN)) {
|
||||
PX4_INFO("PASS: J7P3-J7P7");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J7P3-J7P7 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J7_PIN4, J7_PIN8_IN)) {
|
||||
PX4_INFO("PASS: J7P4-J7P8");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J7P4-J7P8 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J7_PIN5, J7_PIN9_IN)) {
|
||||
PX4_INFO("PASS: J7P5-J7P9");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J7P5-J7P9 ----------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO(">> Testing J1007");
|
||||
stm32_configgpio(J1007_PIN2); // 2 [out] 6 [in]
|
||||
stm32_configgpio(J1007_PIN3); // 3 [out] 7 [in]
|
||||
stm32_configgpio(J1007_PIN4); // 4 [out] 8 [in]
|
||||
stm32_configgpio(J1007_PIN5); // 5 [out] 9 [in]
|
||||
stm32_configgpio(J1007_PIN6_IN); // 6 [in] 2 [out]
|
||||
stm32_configgpio(J1007_PIN7_IN); // 7 [in] 3 [out]
|
||||
stm32_configgpio(J1007_PIN8_IN); // 8 [in] 4 [out]
|
||||
stm32_configgpio(J1007_PIN9_IN); // 9 [in] 5 [out]
|
||||
|
||||
if (test_pair(J1007_PIN2, J1007_PIN6_IN)) {
|
||||
PX4_INFO("PASS: J1007P2-J1007P6");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1007P2-J1007P6 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1007_PIN3, J1007_PIN7_IN)) {
|
||||
PX4_INFO("PASS: J1007P3-J1007P7");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1007P3-J1007P7 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1007_PIN4, J1007_PIN8_IN)) {
|
||||
PX4_INFO("PASS: J1007P4-J1007P8");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1007P4-J1007P8 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1007_PIN5, J1007_PIN9_IN)) {
|
||||
PX4_INFO("PASS: J1007P5-J1007P9");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1007P5-J1007P9 ----------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0051) {
|
||||
PX4_INFO(">> Testing M0051 J13");
|
||||
stm32_configgpio(M0051J13_PIN2); // 2 [out] 6 [in]
|
||||
stm32_configgpio(M0051J13_PIN3); // 3 [out] 7 [in]
|
||||
stm32_configgpio(M0051J13_PIN4); // 4 [out] 8 [in]
|
||||
stm32_configgpio(M0051J13_PIN5); // 5 [out] 9 [in]
|
||||
stm32_configgpio(M0051J13_PIN6_IN); // 6 [in] 2 [out]
|
||||
stm32_configgpio(M0051J13_PIN7_IN); // 7 [in] 3 [out]
|
||||
stm32_configgpio(M0051J13_PIN8_IN); // 8 [in] 4 [out]
|
||||
stm32_configgpio(M0051J13_PIN9_IN); // 9 [in] 5 [out]
|
||||
|
||||
if (test_pair(M0051J13_PIN2, M0051J13_PIN6_IN)) {
|
||||
PX4_INFO("PASS: J13_P2-J13_P6");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13_P2-J13_P6 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(M0051J13_PIN3, M0051J13_PIN7_IN)) {
|
||||
PX4_INFO("PASS: JJ13_P3-J13_P7");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13_P3-J13_7P7 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(M0051J13_PIN4, M0051J13_PIN8_IN)) {
|
||||
PX4_INFO("PASS: J13_P4-J13_P8");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13_P4-J13_P8 ----------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(M0051J13_PIN5, M0051J13_PIN9_IN)) {
|
||||
PX4_INFO("PASS: J13_P5-J13_P9");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13_P5-J13_P9 ----------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J10");
|
||||
stm32_configgpio(J10_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J10_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(J10_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(J10_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(J10_PIN2, J10_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J10P2-J10P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J10P2-J10P4 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J10_PIN3, J10_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J10P3-J10P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J10P3-J10P5 --------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO(">> Testing J1012");
|
||||
stm32_configgpio(J1012_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(J1012_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(J1012_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(J1012_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(J1012_PIN2, J1012_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J1012P2-J1120P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1012P2-J1012P4 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1012_PIN3, J1012_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J1012P3-J1012P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1012P3-J1012P5 --------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0051) {
|
||||
PX4_INFO(">> Testing M0051 J15");
|
||||
stm32_configgpio(M0051J15_PIN2); // 2 [out] 4 [in]
|
||||
stm32_configgpio(M0051J15_PIN3); // 3 [out] 5 [in]
|
||||
stm32_configgpio(M0051J15_PIN4_IN); // 4 [in] 2 [out]
|
||||
stm32_configgpio(M0051J15_PIN5_IN); // 5 [in] 3 [out]
|
||||
|
||||
if (test_pair(M0051J15_PIN2, M0051J15_PIN4_IN)) {
|
||||
PX4_INFO("PASS: J15_P2-J15_P4");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J15_P2-JJ15_P4 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(M0051J15_PIN3, M0051J15_PIN5_IN)) {
|
||||
PX4_INFO("PASS: J15_P3-J15_P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J15_P3-J15_P5 --------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO(">> Testing J9/J12/J13");
|
||||
stm32_configgpio(J9_PIN2_IN); // J9-2 [in] J13-5 [out]
|
||||
|
||||
stm32_configgpio(J12_PIN2_IN); // J12-2 [in] J13-3 [out]
|
||||
stm32_configgpio(J12_PIN3_IN); // J12-3 [in] J13-4 [out]
|
||||
|
||||
stm32_configgpio(J13_PIN3); // J13-3 [out] J12-2 [in]
|
||||
stm32_configgpio(J13_PIN4); // J13-4 [out] J12-3 [in]
|
||||
stm32_configgpio(J13_PIN5); // J13-5 [out] J9-2 [in]
|
||||
|
||||
if (test_pair(J13_PIN3, J12_PIN2_IN)) {
|
||||
PX4_INFO("PASS: J13P3-J12P2");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13P3-J12P2 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J13_PIN4, J12_PIN3_IN)) {
|
||||
PX4_INFO("PASS: J13P4-J12P3");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13P4-J12P3 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J13_PIN5, J9_PIN2_IN)) {
|
||||
PX4_INFO("PASS: J13P5-J9P2");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J13P5-J9P2 --------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO(">> Testing J1003/J1004/J1011");
|
||||
stm32_configgpio(J1003_PIN2_IN); // J1003-2 [in] J13-5 [out]
|
||||
|
||||
stm32_configgpio(J1004_PIN2_IN); // J1004-2 [in] J13-3 [out]
|
||||
stm32_configgpio(J1004_PIN3_IN); // J1004-3 [in] J13-4 [out]
|
||||
|
||||
stm32_configgpio(J1011_PIN3); // J1011-3 [out] J12-2 [in]
|
||||
stm32_configgpio(J1011_PIN4); // J1011-4 [out] J12-3 [in]
|
||||
stm32_configgpio(J1011_PIN5); // J1011-5 [out] J9-2 [in]
|
||||
|
||||
if (test_pair(J1011_PIN3, J1004_PIN2_IN)) {
|
||||
PX4_INFO("PASS: J1011P3-J1004P2");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1011P3-J1004P2 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1011_PIN4, J1004_PIN3_IN)) {
|
||||
PX4_INFO("PASS: J1011P4-J1004P3");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1011P4-J1004P3 --------------------------------------");
|
||||
}
|
||||
|
||||
if (test_pair(J1011_PIN5, J1003_PIN2_IN)) {
|
||||
PX4_INFO("PASS: J1011P5-J1011P5");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J1011P5-J1011P5 --------------------------------------");
|
||||
}
|
||||
|
||||
} else if (hw_type == eM0051) {
|
||||
PX4_INFO(">> Testing M0051 J14");
|
||||
stm32_configgpio(M0051J14_PIN2); // J14-2 [out] J14-3 [in]
|
||||
stm32_configgpio(M0051J14_PIN3_IN); // J14-3 [in] J14-2 [out]
|
||||
|
||||
if (test_pair(M0051J14_PIN2, M0051J14_PIN3_IN)) {
|
||||
PX4_INFO("PASS: J14_P2-J14_P3");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: J14_P2-J14_P3 --------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int modalai_hw_detect_v1(eHW_TYPE hw_type)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (hw_type == eM0018) {
|
||||
PX4_INFO("V106 - Flight Core");
|
||||
|
||||
} else if (hw_type == eM0019) {
|
||||
PX4_INFO("V110 - VOXL-Flight");
|
||||
|
||||
} else if (hw_type == eM0051) {
|
||||
PX4_INFO("V120 - M0051");
|
||||
|
||||
} else {
|
||||
PX4_ERR("Unknown hardware");
|
||||
result = -1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ARCH_CHIP_STM32H743ZI
|
||||
@@ -1,218 +0,0 @@
|
||||
#ifndef MODALAI_FC_V1_H_
|
||||
#define MODALAI_FC_V1_H_
|
||||
|
||||
typedef enum {
|
||||
eHwUnknown = -1,
|
||||
eHwNone = 0,
|
||||
eM0018, // Flight Core
|
||||
eM0019, // VOXL Flight
|
||||
eM0051
|
||||
} eHW_TYPE;
|
||||
|
||||
#define _MK_GPIO_INPUT(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_INPUT|GPIO_PULLUP))
|
||||
#define _MK_GPIO_OUTPUT(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR))
|
||||
|
||||
|
||||
//
|
||||
// Flight Core - J1 - Primary MSS Communications Interface
|
||||
// VOXL Flight - NA
|
||||
//
|
||||
#define J1_PIN2_IN _MK_GPIO_INPUT(GPIO_UART5_RX)
|
||||
#define J1_PIN3 _MK_GPIO_OUTPUT(GPIO_UART5_TX)
|
||||
#define J1_PIN4 _MK_GPIO_OUTPUT(GPIO_UART5_RTS)
|
||||
#define J1_PIN6_IN _MK_GPIO_INPUT(GPIO_UART5_CTS)
|
||||
|
||||
//
|
||||
// STM JTAG Programming Header
|
||||
// Flight Core - J2
|
||||
// VOXL Flight - J1001
|
||||
//
|
||||
|
||||
//
|
||||
// USB 2.0 Full-Speed Downstream Device Port
|
||||
// Flight Core - J
|
||||
// VOXL Flight - J1006
|
||||
//
|
||||
|
||||
//
|
||||
// Spare MSS Comms
|
||||
// Flight Core - J4
|
||||
// VOXL Flight - J1002
|
||||
//
|
||||
#define J4_PIN2 _MK_GPIO_OUTPUT(GPIO_USART2_RX)
|
||||
#define J1002_PIN2 J4_PIN2
|
||||
#define J4_PIN3 _MK_GPIO_OUTPUT(GPIO_USART2_TX)
|
||||
#define J1002_PIN3 J4_PIN3
|
||||
#define J4_PIN4 _MK_GPIO_OUTPUT(GPIO_USART2_RTS)
|
||||
#define J1002_PIN4 J4_PIN4
|
||||
#define J4_PIN4_IN _MK_GPIO_INPUT(GPIO_USART2_RTS)
|
||||
#define J1002_PIN4_IN J4_PIN4_IN
|
||||
#define J4_PIN6 _MK_GPIO_OUTPUT(GPIO_USART2_CTS)
|
||||
#define J4_PIN6_IN _MK_GPIO_INPUT(GPIO_USART2_CTS)
|
||||
#define J1002_PIN6_IN J4_PIN6_IN
|
||||
#define J4_PIN7 _MK_GPIO_OUTPUT(GPIO_VOXL_STATUS_OUT)
|
||||
#define J4_PIN7_IN _MK_GPIO_INPUT(GPIO_VOXL_STATUS_OUT)
|
||||
#define J4_PIN8 _MK_GPIO_OUTPUT(GPIO_VOXL_STATUS_IN)
|
||||
#define J4_PIN8_IN _MK_GPIO_INPUT(GPIO_VOXL_STATUS_IN)
|
||||
|
||||
//
|
||||
// TELEMETRY CONNECTOR
|
||||
// Flight Core - J5
|
||||
// VOXL Flight - J1010
|
||||
//
|
||||
#define J5_PIN2 _MK_GPIO_OUTPUT(GPIO_UART7_TX)
|
||||
#define J1010_PIN2 J5_PIN2
|
||||
#define J5_PIN3 _MK_GPIO_OUTPUT(GPIO_UART7_RX)
|
||||
#define J1010_PIN3 J5_PIN3
|
||||
#define J5_PIN4 _MK_GPIO_OUTPUT(GPIO_UART7_CTS)
|
||||
#define J1010_PIN4 J5_PIN4
|
||||
#define J5_PIN4_IN _MK_GPIO_INPUT(GPIO_UART7_CTS)
|
||||
#define J1010_PIN4_IN J5_PIN4_IN
|
||||
#define J5_PIN5 _MK_GPIO_OUTPUT(GPIO_UART7_RTS)
|
||||
#define J1010_PIN5 J5_PIN5
|
||||
#define J5_PIN5_IN _MK_GPIO_INPUT(GPIO_UART7_RTS)
|
||||
#define J1010_PIN5_IN J5_PIN5_IN
|
||||
|
||||
//
|
||||
// EXPANSION CONNECTOR
|
||||
// Flight Core - J6
|
||||
// VOXL Flight - J1009
|
||||
//
|
||||
#define J6_PIN2 _MK_GPIO_OUTPUT(GPIO_UART4_TX_5)
|
||||
#define J1009_PIN2 J6_PIN2
|
||||
#define J6_PIN3 _MK_GPIO_OUTPUT(GPIO_UART4_RX_5)
|
||||
#define J1009_PIN3 J6_PIN3
|
||||
#define J6_PIN4 _MK_GPIO_OUTPUT(GPIO_I2C3_SCL_2)
|
||||
#define J1009_PIN4 J6_PIN4
|
||||
#define J6_PIN4_IN _MK_GPIO_INPUT(GPIO_I2C3_SCL_2)
|
||||
#define J1009_PIN4_IN J6_PIN4_IN
|
||||
#define J6_PIN5 _MK_GPIO_OUTPUT(GPIO_I2C3_SDA_2)
|
||||
#define J1009_PIN5 J6_PIN5
|
||||
#define J6_PIN5_IN _MK_GPIO_INPUT(GPIO_I2C3_SDA_2)
|
||||
#define J1009_PIN5_IN J6_PIN5_IN
|
||||
|
||||
//
|
||||
// Flight Core - J7 - PWM Output Connector
|
||||
// VOXL Flight - J1007
|
||||
// M0051 - J13
|
||||
//
|
||||
#define J7_PIN2 _MK_GPIO_OUTPUT(GPIO_TIM1_CH4OUT_2)
|
||||
#define J1007_PIN2 J7_PIN2
|
||||
#define M0051J13_PIN2 J7_PIN2
|
||||
#define J7_PIN3 _MK_GPIO_OUTPUT(GPIO_TIM1_CH3OUT_1)
|
||||
#define J1007_PIN3 J7_PIN3
|
||||
#define M0051J13_PIN3 J7_PIN3
|
||||
#define J7_PIN4 _MK_GPIO_OUTPUT(GPIO_TIM1_CH2OUT_2)
|
||||
#define J1007_PIN4 J7_PIN4
|
||||
#define M0051J13_PIN4 J7_PIN4
|
||||
#define J7_PIN5 _MK_GPIO_OUTPUT(GPIO_TIM1_CH1OUT_1)
|
||||
#define J1007_PIN5 J7_PIN5
|
||||
#define M0051J13_PIN5 J7_PIN5
|
||||
#define J7_PIN6 _MK_GPIO_OUTPUT(GPIO_TIM4_CH2OUT_2)
|
||||
#define J1007_PIN6 J7_PIN6
|
||||
#define M0051J13_PIN6 J7_PIN6
|
||||
#define J7_PIN6_IN _MK_GPIO_INPUT(GPIO_TIM4_CH2OUT_2)
|
||||
#define J1007_PIN6_IN J7_PIN6_IN
|
||||
#define M0051J13_PIN6_IN J7_PIN6_IN
|
||||
#define J7_PIN7 _MK_GPIO_OUTPUT(GPIO_TIM4_CH3OUT_2)
|
||||
#define J1007_PIN7 J7_PIN7
|
||||
#define M0051J13_PIN7 J7_PIN7
|
||||
#define J7_PIN7_IN _MK_GPIO_INPUT(GPIO_TIM4_CH3OUT_2)
|
||||
#define J1007_PIN7_IN J7_PIN7_IN
|
||||
#define M0051J13_PIN7_IN J7_PIN7_IN
|
||||
#define J7_PIN8 _MK_GPIO_OUTPUT(GPIO_TIM4_CH1OUT_2)
|
||||
#define J1007_PIN8 J7_PIN8
|
||||
#define M0051J13_PIN8 J7_PIN8
|
||||
#define J7_PIN8_IN _MK_GPIO_INPUT(GPIO_TIM4_CH1OUT_2)
|
||||
#define J1007_PIN8_IN J7_PIN8_IN
|
||||
#define M0051J13_PIN8_IN J7_PIN8_IN
|
||||
#define J7_PIN9 _MK_GPIO_OUTPUT(GPIO_TIM4_CH4OUT_2)
|
||||
#define J1007_PIN9 J7_PIN9
|
||||
#define M0051J13_PIN9 J7_PIN9
|
||||
#define J7_PIN9_IN _MK_GPIO_INPUT(GPIO_TIM4_CH4OUT_2)
|
||||
#define J1007_PIN9_IN J7_PIN9_IN
|
||||
#define M0051J13_PIN9_IN J7_PIN9_IN
|
||||
|
||||
//
|
||||
// CAN 1 Peripheral Connector
|
||||
// Flight Core - J8
|
||||
// VOXL Flight - J1008
|
||||
//
|
||||
//#define J8_PIN2 _MK_GPIO_OUTPUT()
|
||||
//#define J8_PIN3 _MK_GPIO_OUTPUT()
|
||||
|
||||
// PPM (RC) IN
|
||||
// Flight Core - J9
|
||||
// VOXL Flight - J1003
|
||||
//
|
||||
#define J9_PIN2_IN _MK_GPIO_INPUT(GPIO_TIM8_CH1IN_2)
|
||||
#define J1003_PIN2_IN J9_PIN2_IN
|
||||
|
||||
//
|
||||
// GPS CONNECTOR
|
||||
// Flight Core - J10
|
||||
// VOXL Flight - J1012
|
||||
// M0051 - J15
|
||||
//
|
||||
#define J10_PIN2 _MK_GPIO_OUTPUT(GPIO_USART1_TX_3)
|
||||
#define J1012_PIN2 J10_PIN2
|
||||
#define M0051J15_PIN2 J10_PIN2
|
||||
#define J10_PIN3 _MK_GPIO_OUTPUT(GPIO_USART1_RX_3)
|
||||
#define J1012_PIN3 J10_PIN3
|
||||
#define M0051J15_PIN3 J10_PIN3
|
||||
#define J10_PIN4 _MK_GPIO_OUTPUT(GPIO_I2C1_SCL_2)
|
||||
#define J1012_PIN4 J10_PIN4
|
||||
#define M0051J15_PIN4 J10_PIN4
|
||||
#define J10_PIN4_IN _MK_GPIO_INPUT(GPIO_I2C1_SCL_2)
|
||||
#define J1012_PIN4_IN J10_PIN4_IN
|
||||
#define M0051J15_PIN4_IN J10_PIN4_IN
|
||||
#define J10_PIN5 _MK_GPIO_OUTPUT(GPIO_I2C1_SDA_1)
|
||||
#define J1012_PIN5 J10_PIN5
|
||||
#define M0051J15_PIN5 J10_PIN5
|
||||
#define J10_PIN5_IN _MK_GPIO_INPUT(GPIO_I2C1_SDA_1)
|
||||
#define J1012_PIN5_IN J10_PIN5_IN
|
||||
#define M0051J15_PIN5_IN J10_PIN5_IN
|
||||
|
||||
//
|
||||
// Spektrum RC Input Connector
|
||||
// Flight Core - J12
|
||||
// VOXL Flight - J1004
|
||||
// M0051 - J14
|
||||
//
|
||||
#define J12_PIN1 GPIO_VDD_3V3_SPEKTRUM_POWER_EN
|
||||
#define J1004_PIN1 J12_PIN1
|
||||
#define M0051J14_PIN1 J12_PIN1
|
||||
#define J12_PIN2 _MK_GPIO_OUTPUT(GPIO_USART6_TX_1)
|
||||
#define J1004_PIN2 J12_PIN2
|
||||
#define M0051J14_PIN2 J12_PIN2
|
||||
#define J12_PIN2_IN _MK_GPIO_INPUT(GPIO_USART6_TX_1)
|
||||
#define J1004_PIN2_IN J12_PIN2_IN
|
||||
#define M0051J14_PIN2_IN J12_PIN2_IN
|
||||
#define J12_PIN3 _MK_GPIO_OUTPUT(GPIO_USART6_RX_1)
|
||||
#define J1004_PIN3 J12_PIN3
|
||||
#define M0051J14_PIN3 J12_PIN3
|
||||
#define J12_PIN3_IN _MK_GPIO_INPUT(GPIO_USART6_RX_1)
|
||||
#define J1004_PIN3_IN J12_PIN3_IN
|
||||
#define M0051J14_PIN3_IN J12_PIN3_IN
|
||||
|
||||
//
|
||||
// I2C Display / Spare Sensor Connector
|
||||
// Flight Core - J13
|
||||
// VOXL Flight - J1011
|
||||
//
|
||||
#define J13_PIN3 _MK_GPIO_OUTPUT(GPIO_I2C2_SDA_2)
|
||||
#define J1011_PIN3 J13_PIN3
|
||||
#define J13_PIN4 _MK_GPIO_OUTPUT(GPIO_I2C2_SCL_2)
|
||||
#define J1011_PIN4 J13_PIN4
|
||||
#define J13_PIN5 _MK_GPIO_OUTPUT(GPIO_PF3_EVENTOUT)
|
||||
#define J1011_PIN5 J13_PIN5
|
||||
|
||||
|
||||
void modalai_print_usage_v1(void);
|
||||
void modalai_print_usage_con_gpio_test_v1(void);
|
||||
int modalai_con_gpio_test_v1(uint8_t con, uint8_t pin, bool state);
|
||||
int modalai_led_test_v1(void);
|
||||
int modalai_buzz_test_v1(eHW_TYPE type);
|
||||
int modalai_hw_detect_v1(eHW_TYPE type);
|
||||
|
||||
#endif //MODALAI_FC_V1_H_
|
||||
@@ -1,437 +0,0 @@
|
||||
#include <px4_platform_common/module.h>
|
||||
|
||||
|
||||
#include "chip.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "board_config.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
// v2
|
||||
#ifdef CONFIG_ARCH_CHIP_STM32H753II // chip on M0087
|
||||
|
||||
|
||||
#include "modalai_fc-v2.h"
|
||||
|
||||
void modalai_print_usage_v2(void)
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("ModalAI Test utility\n");
|
||||
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("modalai", "command");
|
||||
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("led", "LED Test");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("con", "Connector Output Test (as GPIO)");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("buzz", "Automated buzz out test");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("detect", "Detect board type");
|
||||
return;
|
||||
}
|
||||
void modalai_print_usage_con_gpio_test_v2(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int modalai_con_gpio_test_v2(uint8_t con, uint8_t pin, bool state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int modalai_led_test_v2(void)
|
||||
{
|
||||
PX4_INFO("Running led test");
|
||||
|
||||
stm32_configgpio(GPIO_nLED_RED);
|
||||
stm32_configgpio(GPIO_nLED_GREEN);
|
||||
stm32_configgpio(GPIO_nLED_BLUE);
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_RED, false);
|
||||
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_RED, true);
|
||||
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_GREEN, false);
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_GREEN, true);
|
||||
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_BLUE, false);
|
||||
usleep(1000 * 100);
|
||||
stm32_gpiowrite(GPIO_nLED_BLUE, true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool test_pair(uint32_t output_pin, uint32_t input_pin)
|
||||
{
|
||||
|
||||
bool state = false;
|
||||
|
||||
stm32_gpiowrite(output_pin, true);
|
||||
usleep(1000 * 10);
|
||||
state = stm32_gpioread(input_pin);
|
||||
|
||||
if (state != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
usleep(1000 * 10);
|
||||
|
||||
stm32_gpiowrite(output_pin, false);
|
||||
usleep(1000 * 10);
|
||||
state = stm32_gpioread(input_pin);
|
||||
|
||||
if (state != false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int modalai_buzz_test_v2(eHW_TYPE hw_type)
|
||||
{
|
||||
PX4_INFO("test: buzz");
|
||||
usleep(1000 * 100 * 10);
|
||||
|
||||
if (hw_type == eM0079) {
|
||||
PX4_INFO("Using M0079 config");
|
||||
|
||||
} else if (hw_type == eM0087) {
|
||||
PX4_INFO("Using M0087 config");
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
if (hw_type == eM0079) {
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J1");
|
||||
stm32_configgpio(M0079_J1_PIN_2_OUT); // 2-3
|
||||
stm32_configgpio(M0079_J1_PIN_3_IN); // 3-2
|
||||
stm32_configgpio(M0079_J1_PIN_4_OUT); // 4-5
|
||||
stm32_configgpio(M0079_J1_PIN_5_IN); // 5-4
|
||||
|
||||
if (test_pair(M0079_J1_PIN_2_OUT, M0079_J1_PIN_3_IN)) {
|
||||
PX4_INFO("PASS: M0079_J1_PIN_2_OUT M0079_J1_PIN_3_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J1_PIN_2_OUT M0079_J1_PIN_3_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0079_J1_PIN_4_OUT, M0079_J1_PIN_5_IN)) {
|
||||
PX4_INFO("PASS: M0079_J1_PIN_4_OUT M0079_J1_PIN_5_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J1_PIN_4_OUT M0079_J1_PIN_5_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J5");
|
||||
stm32_configgpio(M0079_J5_PIN_2_OUT); // 2-4
|
||||
stm32_configgpio(M0079_J5_PIN_3_OUT); // 3-5
|
||||
stm32_configgpio(M0079_J5_PIN_4_IN); // 4-2
|
||||
stm32_configgpio(M0079_J5_PIN_5_IN); // 5-3
|
||||
|
||||
if (test_pair(M0079_J5_PIN_2_OUT, M0079_J5_PIN_4_IN)) {
|
||||
PX4_INFO("PASS: M0079_J5_PIN_2_OUT M0079_J5_PIN_4_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J5_PIN_2_OUT M0079_J5_PIN_4_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0079_J5_PIN_3_OUT, M0079_J5_PIN_5_IN)) {
|
||||
PX4_INFO("PASS: M0079_J5_PIN_3_OUT M0079_J5_PIN_5_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J5_PIN_3_OUT M0079_J5_PIN_5_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J7");
|
||||
stm32_configgpio(M0079_J7_PIN_2_OUT); // 2-6
|
||||
stm32_configgpio(M0079_J7_PIN_3_OUT); // 3-7
|
||||
stm32_configgpio(M0079_J7_PIN_4_OUT); // 4-8
|
||||
stm32_configgpio(M0079_J7_PIN_5_OUT); // 5-9
|
||||
stm32_configgpio(M0079_J7_PIN_6_IN); // 6-2
|
||||
stm32_configgpio(M0079_J7_PIN_7_IN); // 7-3
|
||||
stm32_configgpio(M0079_J7_PIN_8_IN); // 8-4
|
||||
stm32_configgpio(M0079_J7_PIN_9_IN); // 9-5
|
||||
|
||||
if (test_pair(M0079_J7_PIN_2_OUT, M0079_J7_PIN_6_IN)) {
|
||||
PX4_INFO("PASS: M0079_J7_PIN_2_OUT M0079_J7_PIN_6_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J7_PIN_2_OUT M0079_J7_PIN_6_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0079_J7_PIN_3_OUT, M0079_J7_PIN_7_IN)) {
|
||||
PX4_INFO("PASS: M0079_J7_PIN_3_OUT M0079_J7_PIN_7_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J7_PIN_3_OUT M0079_J7_PIN_7_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0079_J7_PIN_4_OUT, M0079_J7_PIN_8_IN)) {
|
||||
PX4_INFO("PASS: M0079_J7_PIN_4_OUT M0079_J7_PIN_8_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J7_PIN_4_OUT M0079_J7_PIN_8_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0079_J7_PIN_5_OUT, M0079_J7_PIN_9_IN)) {
|
||||
PX4_INFO("PASS: M0079_J7_PIN_5_OUT M0079_J7_PIN_9_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J7_PIN_5_OUT M0079_J7_PIN_9_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J10");
|
||||
stm32_configgpio(M0079_J10_PIN_2_OUT); // 2-4
|
||||
stm32_configgpio(M0079_J10_PIN_3_OUT); // 3-5
|
||||
stm32_configgpio(M0079_J10_PIN_4_IN); // 4-2
|
||||
stm32_configgpio(M0079_J10_PIN_5_IN); // 5-3
|
||||
|
||||
if (test_pair(M0079_J10_PIN_2_OUT, M0079_J10_PIN_4_IN)) {
|
||||
PX4_INFO("PASS: M0079_J10_PIN_2_OUT M0079_J10_PIN_4_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J10_PIN_2_OUT M0079_J10_PIN_4_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0079_J10_PIN_3_OUT, M0079_J10_PIN_5_IN)) {
|
||||
PX4_INFO("PASS: M0079_J10_PIN_3_OUT M0079_J10_PIN_5_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J10_PIN_3_OUT M0079_J10_PIN_5_IN");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J13");
|
||||
stm32_configgpio(M0079_J12_PIN_2_OUT); // 2-3
|
||||
stm32_configgpio(M0079_J12_PIN_3_IN); // 3-2
|
||||
|
||||
if (test_pair(M0079_J12_PIN_2_OUT, M0079_J12_PIN_3_IN)) {
|
||||
PX4_INFO("PASS: M0079_J12_PIN_2 M0079_J12_PIN_3");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0079_J12_PIN_2 M0079_J12_PIN_3");
|
||||
}
|
||||
|
||||
|
||||
} else if (hw_type == eM0087) {
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J1");
|
||||
stm32_configgpio(M0087_J1_PIN_2_IN); // 2-4
|
||||
stm32_configgpio(M0087_J1_PIN_3_OUT); // 3-5
|
||||
stm32_configgpio(M0087_J1_PIN_4_OUT); // 4-2
|
||||
stm32_configgpio(M0087_J1_PIN_5_IN); // 5-3
|
||||
|
||||
if (test_pair(M0087_J1_PIN_4_OUT, M0087_J1_PIN_2_IN)) {
|
||||
PX4_INFO("PASS: M0087_J1_PIN_4_OUT M0087_J1_PIN_2_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J1_PIN_4_OUT M0087_J1_PIN_2_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J1_PIN_3_OUT, M0087_J1_PIN_5_IN)) {
|
||||
PX4_INFO("PASS: M0087_J1_PIN_3_OUT M0087_J1_PIN_5_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J1_PIN_3_OUT M0087_J1_PIN_5_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J5");
|
||||
stm32_configgpio(M0087_J5_PIN_2_OUT); // 2-4
|
||||
stm32_configgpio(M0087_J5_PIN_3_OUT); // 3-5
|
||||
stm32_configgpio(M0087_J5_PIN_4_IN); // 4-2
|
||||
stm32_configgpio(M0087_J5_PIN_5_IN); // 5-3
|
||||
|
||||
if (test_pair(M0087_J5_PIN_2_OUT, M0087_J5_PIN_4_IN)) {
|
||||
PX4_INFO("PASS: M0087_J5_PIN_2_OUT M0087_J5_PIN_4_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J5_PIN_2_OUT M0087_J5_PIN_4_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J5_PIN_3_OUT, M0087_J5_PIN_5_IN)) {
|
||||
PX4_INFO("PASS: M0087_J5_PIN_3_OUT M0087_J5_PIN_5_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J5_PIN_3_OUT M0087_J5_PIN_5_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J7");
|
||||
stm32_configgpio(M0087_J7_PIN_2_OUT); // 2-6
|
||||
stm32_configgpio(M0087_J7_PIN_3_OUT); // 3-7
|
||||
stm32_configgpio(M0087_J7_PIN_4_OUT); // 4-8
|
||||
stm32_configgpio(M0087_J7_PIN_5_OUT); // 5-9
|
||||
stm32_configgpio(M0087_J7_PIN_6_IN); // 6-2
|
||||
stm32_configgpio(M0087_J7_PIN_7_IN); // 7-3
|
||||
stm32_configgpio(M0087_J7_PIN_8_IN); // 8-4
|
||||
stm32_configgpio(M0087_J7_PIN_9_IN); // 9-5
|
||||
|
||||
if (test_pair(M0087_J7_PIN_2_OUT, M0087_J7_PIN_6_IN)) {
|
||||
PX4_INFO("PASS: M0087_J7_PIN_2_OUT M0087_J7_PIN_6_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J7_PIN_2_OUT M0087_J7_PIN_6_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J7_PIN_3_OUT, M0087_J7_PIN_7_IN)) {
|
||||
PX4_INFO("PASS: M0087_J7_PIN_3_OUT M0087_J7_PIN_7_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J7_PIN_3_OUT M0087_J7_PIN_7_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J7_PIN_4_OUT, M0087_J7_PIN_8_IN)) {
|
||||
PX4_INFO("PASS: M0087_J7_PIN_4_OUT M0087_J7_PIN_8_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J7_PIN_4_OUT M0087_J7_PIN_8_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J7_PIN_5_OUT, M0087_J7_PIN_9_IN)) {
|
||||
PX4_INFO("PASS: M0087_J7_PIN_5_OUT M0087_J7_PIN_9_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J7_PIN_5_OUT M0087_J7_PIN_9_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J10");
|
||||
stm32_configgpio(M0087_J10_PIN_2_OUT); // 2-4
|
||||
stm32_configgpio(M0087_J10_PIN_3_OUT); // 3-5
|
||||
stm32_configgpio(M0087_J10_PIN_4_IN); // 4-2
|
||||
stm32_configgpio(M0087_J10_PIN_5_IN); // 5-3
|
||||
|
||||
if (test_pair(M0087_J10_PIN_2_OUT, M0087_J10_PIN_4_IN)) {
|
||||
PX4_INFO("PASS: M0087_J10_PIN_2_OUT M0087_J10_PIN_4_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J10_PIN_2_OUT M0087_J10_PIN_4_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J10_PIN_3_OUT, M0087_J10_PIN_5_IN)) {
|
||||
PX4_INFO("PASS: M0087_J10_PIN_3_OUT M0087_J10_PIN_5_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J10_PIN_3_OUT M0087_J10_PIN_5_IN");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J12");
|
||||
stm32_configgpio(M0087_J12_PIN_2_OUT); // 2-3
|
||||
stm32_configgpio(M0087_J12_PIN_3_IN); // 3-2
|
||||
|
||||
if (test_pair(M0087_J12_PIN_2_OUT, M0087_J12_PIN_3_IN)) {
|
||||
PX4_INFO("PASS: M0087_J12_PIN_2_OUT M0087_J12_PIN_3_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J12_PIN_2_OUT M0087_J12_PIN_3_IN");
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
PX4_INFO(">> Testing J14");
|
||||
stm32_configgpio(M0087_J14_PIN_2_OUT);
|
||||
stm32_configgpio(M0087_J14_PIN_3_OUT);
|
||||
stm32_configgpio(M0087_J14_PIN_4_OUT);
|
||||
stm32_configgpio(M0087_J14_PIN_5_OUT);
|
||||
stm32_configgpio(M0087_J14_PIN_6_OUT);
|
||||
stm32_configgpio(M0087_J14_PIN_7_IN);
|
||||
stm32_configgpio(M0087_J14_PIN_8_IN);
|
||||
stm32_configgpio(M0087_J14_PIN_9_IN);
|
||||
stm32_configgpio(M0087_J14_PIN_10_IN);
|
||||
stm32_configgpio(M0087_J14_PIN_11_IN);
|
||||
|
||||
if (test_pair(M0087_J14_PIN_2_OUT, M0087_J14_PIN_7_IN)) {
|
||||
PX4_INFO("PASS: M0087_J14_PIN_2_OUT M0087_J14_PIN_7_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J14_PIN_2_OUT M0087_J14_PIN_7_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J14_PIN_3_OUT, M0087_J14_PIN_8_IN)) {
|
||||
PX4_INFO("PASS: M0087_J14_PIN_3_OUT M0087_J14_PIN_8_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J14_PIN_3_OUT M0087_J14_PIN_8_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J14_PIN_4_OUT, M0087_J14_PIN_9_IN)) {
|
||||
PX4_INFO("PASS: M0087_J14_PIN_4_OUT M0087_J14_PIN_9_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J14_PIN_4_OUT M0087_J14_PIN_9_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J14_PIN_5_OUT, M0087_J14_PIN_10_IN)) {
|
||||
PX4_INFO("PASS: M0087_J14_PIN_5_OUT M0087_J14_PIN_10_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J14_PIN_5_OUT M0087_J14_PIN_10_IN");
|
||||
}
|
||||
|
||||
if (test_pair(M0087_J14_PIN_6_OUT, M0087_J14_PIN_11_IN)) {
|
||||
PX4_INFO("PASS: M0087_J14_PIN_6_OUT M0087_J14_PIN_11_IN");
|
||||
|
||||
} else {
|
||||
PX4_ERR("FAIL: M0087_J14_PIN_6_OUT M0087_J14_PIN_11_IN");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int modalai_hw_detect_v2(eHW_TYPE hw_type)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (hw_type == eM0079) {
|
||||
PX4_INFO("V230 - M0079");
|
||||
result = 0;
|
||||
|
||||
} else if (hw_type == eM0087) {
|
||||
PX4_INFO("V230 - M0087");
|
||||
result = 0;
|
||||
|
||||
} else {
|
||||
PX4_ERR("Unknown hardware");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif //CONFIG_ARCH_CHIP_STM32H753II
|
||||
@@ -1,183 +0,0 @@
|
||||
#ifndef MODALAI_FC_V2_H_
|
||||
#define MODALAI_FC_V2_H_
|
||||
|
||||
typedef enum {
|
||||
eHwUnknown = -1,
|
||||
eHwNone = 0,
|
||||
eM0079, //FCv2
|
||||
eM0087 //FCv2 Pro
|
||||
} eHW_TYPE;
|
||||
|
||||
#define _MK_GPIO_INPUT(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_INPUT|GPIO_PULLUP))
|
||||
#define _MK_GPIO_OUTPUT(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR))
|
||||
|
||||
/* M0079 Pins */
|
||||
|
||||
//
|
||||
// TELEM1
|
||||
// M0079- J1
|
||||
// PF6 PIN2 - out
|
||||
// PE8 PIN3 - in
|
||||
// PF8 PIN4 - out
|
||||
// PE10 PIN4 - in
|
||||
//
|
||||
#define M0079_J1_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTF|GPIO_PIN6)
|
||||
#define M0079_J1_PIN_3_IN _MK_GPIO_INPUT(GPIO_PORTE|GPIO_PIN8)
|
||||
#define M0079_J1_PIN_4_OUT _MK_GPIO_OUTPUT(GPIO_PORTF|GPIO_PIN8)
|
||||
#define M0079_J1_PIN_5_IN _MK_GPIO_INPUT(GPIO_PORTE|GPIO_PIN10)
|
||||
|
||||
//
|
||||
// TELEM2
|
||||
// M0079- J5
|
||||
// PC12 PIN2 - out
|
||||
// PD2 PIN3 - out
|
||||
// PC9 PIN4 - in
|
||||
// PC8 PIN4 - in
|
||||
//
|
||||
#define M0079_J5_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTC|GPIO_PIN12)
|
||||
#define M0079_J5_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTD|GPIO_PIN2)
|
||||
#define M0079_J5_PIN_4_IN _MK_GPIO_INPUT(GPIO_PORTC|GPIO_PIN9)
|
||||
#define M0079_J5_PIN_5_IN _MK_GPIO_INPUT(GPIO_PORTC|GPIO_PIN8)
|
||||
|
||||
//
|
||||
// PWM Output
|
||||
// M0079- J7
|
||||
// PI0 PIN2 - out
|
||||
// PH12 PIN3 - out
|
||||
// PH11 PIN4 - out
|
||||
// PH10 PIN5 - out
|
||||
//
|
||||
// PD13 PIN6 - in
|
||||
// PD14 PIN7 - in
|
||||
// PH6 PIN8 - in
|
||||
// PH9 PIN9 - in
|
||||
//
|
||||
#define M0079_J7_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTI|GPIO_PIN0)
|
||||
#define M0079_J7_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTH|GPIO_PIN12)
|
||||
#define M0079_J7_PIN_4_OUT _MK_GPIO_OUTPUT(GPIO_PORTH|GPIO_PIN11)
|
||||
#define M0079_J7_PIN_5_OUT _MK_GPIO_OUTPUT(GPIO_PORTH|GPIO_PIN10)
|
||||
#define M0079_J7_PIN_6_IN _MK_GPIO_INPUT(GPIO_PORTD|GPIO_PIN13)
|
||||
#define M0079_J7_PIN_7_IN _MK_GPIO_INPUT(GPIO_PORTD|GPIO_PIN14)
|
||||
#define M0079_J7_PIN_8_IN _MK_GPIO_INPUT(GPIO_PORTH|GPIO_PIN6)
|
||||
#define M0079_J7_PIN_9_IN _MK_GPIO_INPUT(GPIO_PORTH|GPIO_PIN9)
|
||||
|
||||
//
|
||||
// GPS/Mag
|
||||
// M0079- J10
|
||||
// PB6 PIN2 - out
|
||||
// PB7 PIN3 - out
|
||||
// PB8 PIN4 - in
|
||||
// PB9 PIN4 - in
|
||||
//
|
||||
#define M0079_J10_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTB|GPIO_PIN6)
|
||||
#define M0079_J10_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTB|GPIO_PIN7)
|
||||
#define M0079_J10_PIN_4_IN _MK_GPIO_INPUT(GPIO_PORTB|GPIO_PIN8)
|
||||
#define M0079_J10_PIN_5_IN _MK_GPIO_INPUT(GPIO_PORTB|GPIO_PIN9)
|
||||
|
||||
//
|
||||
// Spektrum RC Input Connector
|
||||
// M0079- J12
|
||||
// PC6 PIN2 - out
|
||||
// PC7 PIN3 - in
|
||||
//
|
||||
#define M0079_J12_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTC|GPIO_PIN6)
|
||||
#define M0079_J12_PIN_3_IN _MK_GPIO_INPUT(GPIO_PORTC|GPIO_PIN7)
|
||||
|
||||
|
||||
/* M0087 Pins */
|
||||
|
||||
//
|
||||
// TELEM1
|
||||
// M0087- J1
|
||||
// PF6 PIN2 - in
|
||||
// PE8 PIN3 - out
|
||||
// PF8 PIN4 - out
|
||||
// PE10 PIN5 - in
|
||||
//
|
||||
#define M0087_J1_PIN_2_IN _MK_GPIO_INPUT(GPIO_PORTF|GPIO_PIN6)
|
||||
#define M0087_J1_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTE|GPIO_PIN8)
|
||||
#define M0087_J1_PIN_4_OUT _MK_GPIO_OUTPUT(GPIO_PORTF|GPIO_PIN8)
|
||||
#define M0087_J1_PIN_5_IN _MK_GPIO_INPUT(GPIO_PORTE|GPIO_PIN10)
|
||||
|
||||
//
|
||||
// TELEM2
|
||||
// M0087- J5
|
||||
// PC12 PIN2 - out
|
||||
// PD2 PIN3 - out
|
||||
// PC9 PIN4 - in
|
||||
// PC8 PIN5 - in
|
||||
//
|
||||
#define M0087_J5_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTC|GPIO_PIN12)
|
||||
#define M0087_J5_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTD|GPIO_PIN2)
|
||||
#define M0087_J5_PIN_4_IN _MK_GPIO_INPUT(GPIO_PORTC|GPIO_PIN9)
|
||||
#define M0087_J5_PIN_5_IN _MK_GPIO_INPUT(GPIO_PORTC|GPIO_PIN8)
|
||||
|
||||
//
|
||||
// PWM Output
|
||||
// M0087- J7
|
||||
// PI0 PIN2 - out
|
||||
// PH12 PIN3 - out
|
||||
// PH11 PIN4 - out
|
||||
// PH10 PIN5 - out
|
||||
//
|
||||
// PD13 PIN6 - in
|
||||
// PD14 PIN7 - in
|
||||
// PH6 PIN8 - in
|
||||
// PH9 PIN9 - in
|
||||
//
|
||||
#define M0087_J7_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTI|GPIO_PIN0)
|
||||
#define M0087_J7_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTH|GPIO_PIN12)
|
||||
#define M0087_J7_PIN_4_OUT _MK_GPIO_OUTPUT(GPIO_PORTH|GPIO_PIN11)
|
||||
#define M0087_J7_PIN_5_OUT _MK_GPIO_OUTPUT(GPIO_PORTH|GPIO_PIN10)
|
||||
#define M0087_J7_PIN_6_IN _MK_GPIO_INPUT(GPIO_PORTD|GPIO_PIN13)
|
||||
#define M0087_J7_PIN_7_IN _MK_GPIO_INPUT(GPIO_PORTD|GPIO_PIN14)
|
||||
#define M0087_J7_PIN_8_IN _MK_GPIO_INPUT(GPIO_PORTH|GPIO_PIN6)
|
||||
#define M0087_J7_PIN_9_IN _MK_GPIO_INPUT(GPIO_PORTH|GPIO_PIN9)
|
||||
|
||||
//
|
||||
// GPS/Mag
|
||||
// M0087- J10
|
||||
// PB6 PIN2 - out
|
||||
// PB7 PIN3 - out
|
||||
// PB8 PIN4 - in
|
||||
// PB9 PIN5 - in
|
||||
//
|
||||
#define M0087_J10_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTB|GPIO_PIN6)
|
||||
#define M0087_J10_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTB|GPIO_PIN7)
|
||||
#define M0087_J10_PIN_4_IN _MK_GPIO_INPUT(GPIO_PORTB|GPIO_PIN8)
|
||||
#define M0087_J10_PIN_5_IN _MK_GPIO_INPUT(GPIO_PORTB|GPIO_PIN9)
|
||||
|
||||
//
|
||||
// Spektrum RC Input Connector
|
||||
// M0087- J12
|
||||
// PC6 PIN2 - out
|
||||
// PC7 PIN3 - in
|
||||
//
|
||||
#define M0087_J12_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTC|GPIO_PIN6)
|
||||
#define M0087_J12_PIN_3_IN _MK_GPIO_INPUT(GPIO_PORTC|GPIO_PIN7)
|
||||
|
||||
//
|
||||
// AVIATOR SPI/I2C/ADC EXPANSION CONNECTOR
|
||||
// M0087- J14
|
||||
// PC6 PIN2 - out
|
||||
// PC7 PIN3 - in
|
||||
//
|
||||
#define M0087_J14_PIN_2_OUT _MK_GPIO_OUTPUT(GPIO_PORTA|GPIO_PIN6)
|
||||
#define M0087_J14_PIN_3_OUT _MK_GPIO_OUTPUT(GPIO_PORTG|GPIO_PIN14)
|
||||
#define M0087_J14_PIN_4_OUT _MK_GPIO_OUTPUT(GPIO_PORTB|GPIO_PIN3)
|
||||
#define M0087_J14_PIN_5_OUT _MK_GPIO_OUTPUT(GPIO_PORTI|GPIO_PIN10)
|
||||
#define M0087_J14_PIN_6_OUT _MK_GPIO_OUTPUT(GPIO_PORTF|GPIO_PIN0)
|
||||
#define M0087_J14_PIN_7_IN _MK_GPIO_INPUT(GPIO_PORTF|GPIO_PIN1)
|
||||
#define M0087_J14_PIN_8_IN _MK_GPIO_INPUT(GPIO_PORTF|GPIO_PIN12)
|
||||
#define M0087_J14_PIN_9_IN _MK_GPIO_INPUT(GPIO_PORTB|GPIO_PIN0)
|
||||
#define M0087_J14_PIN_10_IN _MK_GPIO_INPUT(GPIO_PORTA|GPIO_PIN0)
|
||||
#define M0087_J14_PIN_11_IN _MK_GPIO_INPUT(GPIO_PORTA|GPIO_PIN4)
|
||||
|
||||
void modalai_print_usage_v2(void);
|
||||
void modalai_print_usage_con_gpio_test_v2(void);
|
||||
int modalai_con_gpio_test_v2(uint8_t con, uint8_t pin, bool state);
|
||||
int modalai_led_test_v2(void);
|
||||
int modalai_buzz_test_v2(eHW_TYPE type);
|
||||
int modalai_hw_detect_v2(eHW_TYPE type);
|
||||
|
||||
#endif //MODALAI_FC_V2_H_
|
||||
@@ -0,0 +1,5 @@
|
||||
CONFIG_BOARD_TOOLCHAIN="arm-none-eabi"
|
||||
CONFIG_BOARD_ARCHITECTURE="cortex-m3"
|
||||
CONFIG_BOARD_ROMFSROOT=""
|
||||
CONFIG_BOARD_CONSTRAINED_FLASH=y
|
||||
CONFIG_MODULES_PX4IOFIRMWARE=y
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"board_id": 41777,
|
||||
"magic": "PX4FWv2",
|
||||
"description": "Firmware for the voxl2-io board",
|
||||
"image": "",
|
||||
"build_time": 0,
|
||||
"summary": "voxl2io",
|
||||
"version": "2.0",
|
||||
"image_size": 0,
|
||||
"image_maxsize": 61440,
|
||||
"git_identity": "",
|
||||
"board_revision": 0
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/************************************************************************************
|
||||
* nuttx-configs/px4io/include/board.h
|
||||
* include/arch/board/board.h
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_BOARD_BOARD_H
|
||||
#define __ARCH_BOARD_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#include <stm32.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
|
||||
/* On-board crystal frequency is 24MHz (HSE) */
|
||||
|
||||
#define STM32_BOARD_XTAL 16000000ul
|
||||
|
||||
/* Use the HSE output as the system clock */
|
||||
|
||||
#define STM32_SYSCLK_SW RCC_CFGR_SW_HSE
|
||||
#define STM32_SYSCLK_SWS RCC_CFGR_SWS_HSE
|
||||
#define STM32_SYSCLK_FREQUENCY STM32_BOARD_XTAL
|
||||
|
||||
/* AHB clock (HCLK) is SYSCLK (24MHz) */
|
||||
|
||||
#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
|
||||
#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
||||
#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
|
||||
|
||||
/* APB2 clock (PCLK2) is HCLK (24MHz) */
|
||||
|
||||
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
|
||||
#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
|
||||
#define STM32_APB2_CLKIN (STM32_PCLK2_FREQUENCY) /* Timers 2-4 */
|
||||
|
||||
/* APB2 timer 1 will receive PCLK2. */
|
||||
|
||||
#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
|
||||
#define STM32_APB2_TIM15_CLKIN (STM32_PCLK2_FREQUENCY)
|
||||
#define STM32_APB2_TIM16_CLKIN (STM32_PCLK2_FREQUENCY)
|
||||
#define STM32_APB2_TIM17_CLKIN (STM32_PCLK2_FREQUENCY)
|
||||
|
||||
/* APB1 clock (PCLK1) is HCLK (24MHz) */
|
||||
|
||||
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK
|
||||
#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY)
|
||||
|
||||
/* All timers run off PCLK */
|
||||
|
||||
|
||||
#define STM32_APB1_TIM2_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM3_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM4_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM5_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM12_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM13_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
#define STM32_APB1_TIM14_CLKIN (STM32_PCLK1_FREQUENCY)
|
||||
|
||||
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
|
||||
* otherwise frequency is 2xAPBx.
|
||||
* Note: TIM1, 15-17 are on APB2, others on APB1
|
||||
*/
|
||||
|
||||
#define BOARD_TIM1_FREQUENCY STM32_APB2_TIM1_CLKIN
|
||||
#define BOARD_TIM2_FREQUENCY STM32_APB1_TIM2_CLKIN
|
||||
#define BOARD_TIM3_FREQUENCY STM32_APB1_TIM3_CLKIN
|
||||
#define BOARD_TIM4_FREQUENCY STM32_APB1_TIM4_CLKIN
|
||||
#define BOARD_TIM5_FREQUENCY STM32_APB1_TIM5_CLKIN
|
||||
#define BOARD_TIM6_FREQUENCY STM32_APB1_TIM6_CLKIN
|
||||
#define BOARD_TIM7_FREQUENCY STM32_APB1_TIM7_CLKIN
|
||||
#define BOARD_TIM12_FREQUENCY STM32_APB1_TIM12_CLKIN
|
||||
#define BOARD_TIM13_FREQUENCY STM32_APB1_TIM13_CLKIN
|
||||
#define BOARD_TIM14_FREQUENCY STM32_APB1_TIM14_CLKIN
|
||||
#define BOARD_TIM15_FREQUENCY STM32_APB2_TIM15_CLKIN
|
||||
#define BOARD_TIM16_FREQUENCY STM32_APB2_TIM16_CLKIN
|
||||
#define BOARD_TIM17_FREQUENCY STM32_APB2_TIM17_CLKIN
|
||||
|
||||
|
||||
/*
|
||||
* Some of the USART pins are not available; override the GPIO
|
||||
* definitions with an invalid pin configuration.
|
||||
*/
|
||||
#undef GPIO_USART2_CTS
|
||||
#define GPIO_USART2_CTS 0xffffffff
|
||||
#undef GPIO_USART2_RTS
|
||||
#define GPIO_USART2_RTS 0xffffffff
|
||||
#undef GPIO_USART2_CK
|
||||
#define GPIO_USART2_CK 0xffffffff
|
||||
#undef GPIO_USART3_CK
|
||||
#define GPIO_USART3_CK 0xffffffff
|
||||
#undef GPIO_USART3_CTS
|
||||
#define GPIO_USART3_CTS 0xffffffff
|
||||
#undef GPIO_USART3_RTS
|
||||
#define GPIO_USART3_RTS 0xffffffff
|
||||
|
||||
#endif /* __ARCH_BOARD_BOARD_H */
|
||||
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_DEV_NULL is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD_CUSTOM=y
|
||||
CONFIG_ARCH_BOARD_CUSTOM_DIR="../../../../boards/modalai/voxl2-io/nuttx-config"
|
||||
CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
|
||||
CONFIG_ARCH_BOARD_CUSTOM_NAME="px4"
|
||||
CONFIG_ARCH_CHIP="stm32"
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32F100C8=y
|
||||
CONFIG_ARMV7M_USEBASEPRI=y
|
||||
CONFIG_ARM_MPU_EARLY_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=2000
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_FDCLONE_DISABLE=y
|
||||
CONFIG_FDCLONE_STDIO=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=316
|
||||
CONFIG_INIT_ENTRYPOINT="user_start"
|
||||
CONFIG_INIT_STACKSIZE=1100
|
||||
CONFIG_MM_FILL_ALLOCATIONS=y
|
||||
CONFIG_MM_SMALL=y
|
||||
CONFIG_NAME_MAX=12
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RAM_SIZE=8192
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_DAY=30
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_STM32_ADC1=y
|
||||
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
|
||||
CONFIG_STM32_DMA1=y
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART3=y
|
||||
CONFIG_STM32_USART_SINGLEWIRE=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USART1_RXBUFSIZE=64
|
||||
CONFIG_USART1_RXDMA=y
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USART1_TXBUFSIZE=32
|
||||
CONFIG_USART2_RXBUFSIZE=64
|
||||
CONFIG_USART2_TXBUFSIZE=64
|
||||
CONFIG_USART3_RXBUFSIZE=64
|
||||
CONFIG_USART3_RXDMA=y
|
||||
CONFIG_USART3_TXBUFSIZE=64
|
||||
CONFIG_USEC_PER_TICK=1000
|
||||
@@ -0,0 +1,131 @@
|
||||
/****************************************************************************
|
||||
* configs/px4io-v2/scripts/ld.script
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The STM32F100C8 has 64Kb of FLASH beginning at address 0x0800:0000 and
|
||||
* 8Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
|
||||
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
||||
* begin execution by jumping to the entry point in the 0x0800:0000 address
|
||||
* range.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x08001000, LENGTH = 60K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(__start) /* treat __start as the anchor for dead code stripping */
|
||||
EXTERN(_vectors) /* force the vectors to be included in the output */
|
||||
|
||||
/*
|
||||
* Ensure that abort() is present in the final object. The exception handling
|
||||
* code pulled in by libgcc.a requires it (and that code cannot be easily avoided).
|
||||
*/
|
||||
EXTERN(abort)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
/*
|
||||
* Init functions (static constructors and the like)
|
||||
*/
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
KEEP(*(.init_array .init_array.*))
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > flash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > flash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
/* The STM32F100CB has 8Kb of SRAM beginning at the following address */
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
. = ALIGN(4);
|
||||
} > sram AT > flash
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_library(drivers_board
|
||||
init.c
|
||||
timer_config.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_arch
|
||||
)
|
||||
@@ -0,0 +1,157 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file board_config.h
|
||||
*
|
||||
* PX4IOV2 internal definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/******************************************************************************
|
||||
* Included Files
|
||||
******************************************************************************/
|
||||
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/******************************************************************************
|
||||
* Definitions
|
||||
******************************************************************************/
|
||||
/* Configuration **************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* Serial
|
||||
******************************************************************************/
|
||||
#define PX4FMU_SERIAL_BASE STM32_USART2_BASE
|
||||
#define PX4FMU_SERIAL_VECTOR STM32_IRQ_USART2
|
||||
#define PX4FMU_SERIAL_TX_GPIO GPIO_USART2_TX
|
||||
#define PX4FMU_SERIAL_RX_GPIO GPIO_USART2_RX
|
||||
#define PX4FMU_SERIAL_TX_DMA DMACHAN_USART2_TX
|
||||
#define PX4FMU_SERIAL_RX_DMA DMACHAN_USART2_RX
|
||||
#define PX4FMU_SERIAL_CLOCK STM32_PCLK1_FREQUENCY
|
||||
#define PX4FMU_SERIAL_BITRATE 921600
|
||||
|
||||
/******************************************************************************
|
||||
* GPIOS
|
||||
******************************************************************************/
|
||||
|
||||
/* LEDS **********************************************************************/
|
||||
|
||||
#define GPIO_LED_BLUE (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN14)
|
||||
#define GPIO_LED_AMBER (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN15)
|
||||
#define GPIO_LED_SAFETY (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN13)
|
||||
|
||||
#define LED_BLUE(on_true) stm32_gpiowrite(GPIO_LED_BLUE, !(on_true))
|
||||
#define LED_AMBER(on_true) stm32_gpiowrite(GPIO_LED_AMBER, !(on_true))
|
||||
#define LED_SAFETY(on_true) stm32_gpiowrite(GPIO_LED_SAFETY, !(on_true))
|
||||
|
||||
//#define GPIO_LED4 (GPIO_OUTPUT|GPIO_CNF_OUTOD|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN11)
|
||||
|
||||
//#define GPIO_HEATER_OFF 0 // (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN14)
|
||||
|
||||
#define GPIO_PC14 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN14)
|
||||
#define GPIO_PC15 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN15)
|
||||
|
||||
#define GPIO_SENSE_PC14_DN (GPIO_INPUT|GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN14)
|
||||
#define GPIO_SENSE_PC15_UP (GPIO_INPUT|GPIO_CNF_INPULLUP|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN15)
|
||||
# define SENSE_PH1 0b10 /* Floating pulled as set */
|
||||
# define SENSE_PH2 0b01 /* Driven as tied */
|
||||
|
||||
#define GPIO_USART1_RX_SPEKTRUM (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN10)
|
||||
|
||||
/* Safety switch button *******************************************************/
|
||||
|
||||
/* CONNECTED TO TP8 - pulled down via SW */
|
||||
|
||||
#define GPIO_BTN_SAFETY (GPIO_INPUT|GPIO_CNF_INPULLDWN|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN5)
|
||||
|
||||
/* Power switch controls ******************************************************/
|
||||
|
||||
#define GPIO_SPEKTRUM_PWR_EN (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
|
||||
#define SPEKTRUM_POWER(_on_true) px4_arch_gpiowrite(GPIO_SPEKTRUM_PWR_EN, (_on_true))
|
||||
|
||||
#define SPEKTRUM_OUT(_one_true) px4_arch_gpiowrite(GPIO_USART1_RX_SPEKTRUM, (_one_true))
|
||||
#define SPEKTRUM_RX_AS_UART() px4_arch_configgpio(GPIO_USART1_RX)
|
||||
#define SPEKTRUM_RX_AS_GPIO_OUTPUT() px4_arch_configgpio(GPIO_USART1_RX_SPEKTRUM)
|
||||
|
||||
#define GPIO_SERVO_FAULT_DETECT 0 // (GPIO_INPUT|GPIO_CNF_INPULLUP|GPIO_MODE_INPUT|GPIO_PORTA|GPIO_PIN15)
|
||||
|
||||
/* Analog inputs **************************************************************/
|
||||
|
||||
/* PWM pins **************************************************************/
|
||||
|
||||
#define GPIO_PWM1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN0)
|
||||
#define GPIO_PWM2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_PWM3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8)
|
||||
#define GPIO_PWM4 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN9)
|
||||
#define GPIO_PWM5 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN6)
|
||||
#define GPIO_PWM6 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN7)
|
||||
#define GPIO_PWM7 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_PWM8 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1)
|
||||
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 8
|
||||
#define BOARD_HAS_NO_CAPTURE
|
||||
|
||||
/* SBUS pins *************************************************************/
|
||||
|
||||
/* XXX these should be UART pins */
|
||||
#define GPIO_SBUS_INPUT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTB|GPIO_PIN11)
|
||||
#define GPIO_SBUS_OUTPUT (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN10)
|
||||
#define GPIO_SBUS_OENABLE 0 // (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN4)
|
||||
|
||||
/*
|
||||
* High-resolution timer
|
||||
*/
|
||||
#define HRT_TIMER 1 /* use timer1 for the HRT */
|
||||
#define HRT_TIMER_CHANNEL 2 /* use capture/compare channel 2 */
|
||||
#define HRT_PPM_CHANNEL 1 /* use capture/compare channel 1 PA8 */
|
||||
#define GPIO_PPM_IN (GPIO_ALT|GPIO_CNF_INPULLUP|GPIO_PORTA|GPIO_PIN8)
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* PX4 has two LEDs that we will encode as: */
|
||||
|
||||
#define LED_STARTED 0 /* LED? */
|
||||
#define LED_HEAPALLOCATE 1 /* LED? */
|
||||
#define LED_IRQSENABLED 2 /* LED? + LED? */
|
||||
#define LED_STACKCREATED 3 /* LED? */
|
||||
#define LED_INIRQ 4 /* LED? + LED? */
|
||||
#define LED_SIGNAL 5 /* LED? + LED? */
|
||||
#define LED_ASSERTION 6 /* LED? + LED? + LED? */
|
||||
#define LED_PANIC 7 /* N/C + N/C + N/C + LED? */
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 3
|
||||
|
||||
#include <px4_platform_common/board_common.h>
|
||||
@@ -0,0 +1,133 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file init.c
|
||||
*
|
||||
* PX4FMU-specific early startup code. This file implements the
|
||||
* stm32_boardinitialize() function that is called during cpu startup.
|
||||
*
|
||||
* Code here is run before the rcS script is invoked; it should start required
|
||||
* subsystems and perform board-specific initialization.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include <stm32.h>
|
||||
#include "board_config.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Protected Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following entry point. This entry point
|
||||
* is called early in the intitialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT void stm32_boardinitialize(void)
|
||||
{
|
||||
/* configure GPIOs */
|
||||
|
||||
/* Set up for sensing HW */
|
||||
stm32_configgpio(GPIO_SENSE_PC14_DN);
|
||||
stm32_configgpio(GPIO_SENSE_PC15_UP);
|
||||
|
||||
/* LEDS - default to off */
|
||||
stm32_configgpio(GPIO_LED_BLUE);
|
||||
stm32_configgpio(GPIO_LED_AMBER);
|
||||
stm32_configgpio(GPIO_LED_SAFETY);
|
||||
|
||||
stm32_configgpio(GPIO_PC14);
|
||||
stm32_configgpio(GPIO_PC15);
|
||||
|
||||
|
||||
stm32_configgpio(GPIO_BTN_SAFETY);
|
||||
|
||||
/* spektrum power enable is active high - enable it by default */
|
||||
stm32_configgpio(GPIO_SPEKTRUM_PWR_EN);
|
||||
|
||||
stm32_configgpio(GPIO_SBUS_INPUT); /* xxx alternate function */
|
||||
stm32_configgpio(GPIO_SBUS_OUTPUT);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM1, true);
|
||||
stm32_configgpio(GPIO_PWM1);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM2, true);
|
||||
stm32_configgpio(GPIO_PWM2);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM3, true);
|
||||
stm32_configgpio(GPIO_PWM3);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM4, true);
|
||||
stm32_configgpio(GPIO_PWM4);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM5, true);
|
||||
stm32_configgpio(GPIO_PWM5);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM6, true);
|
||||
stm32_configgpio(GPIO_PWM6);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM7, true);
|
||||
stm32_configgpio(GPIO_PWM7);
|
||||
|
||||
stm32_gpiowrite(GPIO_PWM8, true);
|
||||
stm32_configgpio(GPIO_PWM8);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2023 PX4 Development Team. All rights reserved.
|
||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,42 +31,24 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <px4_arch/io_timer_hw_description.h>
|
||||
|
||||
#include <px4_platform_common/atomic_bitset.h>
|
||||
#include "atomic_transaction.h"
|
||||
#include "param.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
class ParamLayer
|
||||
{
|
||||
public:
|
||||
static constexpr param_t PARAM_COUNT = sizeof(px4::parameters) / sizeof(param_info_s);
|
||||
|
||||
ParamLayer(ParamLayer *parent = nullptr) : _parent(parent) {}
|
||||
|
||||
ParamLayer(const ParamLayer &) = delete;
|
||||
ParamLayer &operator=(const ParamLayer &) = delete;
|
||||
ParamLayer(ParamLayer &&) = delete;
|
||||
ParamLayer &operator=(ParamLayer &&) = delete;
|
||||
|
||||
|
||||
virtual bool store(param_t param, param_value_u value) = 0;
|
||||
|
||||
virtual bool contains(param_t param) const = 0;
|
||||
|
||||
virtual px4::AtomicBitset<PARAM_COUNT> containedAsBitset() const = 0;
|
||||
|
||||
virtual param_value_u get(param_t param) const = 0;
|
||||
|
||||
virtual void reset(param_t param) = 0;
|
||||
|
||||
virtual void refresh(param_t param) = 0;
|
||||
|
||||
virtual int size() const = 0;
|
||||
|
||||
virtual int byteSize() const = 0;
|
||||
|
||||
protected:
|
||||
ParamLayer *const _parent;
|
||||
constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
|
||||
initIOTimer(Timer::Timer2),
|
||||
initIOTimer(Timer::Timer3),
|
||||
initIOTimer(Timer::Timer4),
|
||||
};
|
||||
|
||||
constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
initIOTimerChannel(io_timers, {Timer::Timer2, Timer::Channel1}, {GPIO::PortA, GPIO::Pin0}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer2, Timer::Channel2}, {GPIO::PortA, GPIO::Pin1}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortB, GPIO::Pin8}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel4}, {GPIO::PortB, GPIO::Pin9}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel1}, {GPIO::PortA, GPIO::Pin6}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel2}, {GPIO::PortA, GPIO::Pin7}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel3}, {GPIO::PortB, GPIO::Pin0}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel4}, {GPIO::PortB, GPIO::Pin1}),
|
||||
};
|
||||
|
||||
constexpr io_timers_channel_mapping_t io_timers_channel_mapping =
|
||||
initIOTimerChannelMapping(io_timers, timer_io_channels);
|
||||
@@ -1,9 +1,11 @@
|
||||
CONFIG_BOARD_TOOLCHAIN="arm-none-eabi"
|
||||
CONFIG_BOARD_ARCHITECTURE="cortex-m7"
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS2"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS0"
|
||||
CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS1"
|
||||
CONFIG_BOARD_SERIAL_TEL3="/dev/ttyS4"
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS3"
|
||||
CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS4"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS1"
|
||||
CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS2"
|
||||
CONFIG_BOARD_SERIAL_TEL3="/dev/ttyS5"
|
||||
CONFIG_BOARD_SERIAL_TEL4="/dev/ttyS0"
|
||||
CONFIG_DRIVERS_ADC_ADS1115=y
|
||||
CONFIG_DRIVERS_ADC_BOARD_ADC=y
|
||||
CONFIG_DRIVERS_BAROMETER_DPS310=y
|
||||
@@ -25,6 +27,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
|
||||
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
|
||||
CONFIG_DRIVERS_PWM_OUT=y
|
||||
CONFIG_DRIVERS_RC_INPUT=y
|
||||
CONFIG_DRIVERS_SAFETY_BUTTON=y
|
||||
CONFIG_DRIVERS_SMART_BATTERY_BATMON=y
|
||||
CONFIG_COMMON_TELEMETRY=y
|
||||
CONFIG_DRIVERS_TONE_ALARM=y
|
||||
@@ -96,4 +99,3 @@ CONFIG_SYSTEMCMDS_UORB=y
|
||||
CONFIG_SYSTEMCMDS_USB_CONNECTED=y
|
||||
CONFIG_SYSTEMCMDS_VER=y
|
||||
CONFIG_SYSTEMCMDS_WORK_QUEUE=y
|
||||
CONFIG_EXAMPLES_FAKE_GPS=y
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
param set-default BAT1_V_DIV 10.1
|
||||
param set-default BAT1_A_PER_V 17
|
||||
|
||||
safety_button start
|
||||
param set-default GPS_2_CONFIG 202
|
||||
param set-default TEL_FRSKY_CONFIG 103
|
||||
|
||||
@@ -16,3 +16,5 @@ icm20948 -s -b 1 -R 8 -M start
|
||||
|
||||
# Interal DPS310 (barometer)
|
||||
dps310 -s -b 2 start
|
||||
|
||||
safety_button start
|
||||
|
||||
@@ -15,7 +15,7 @@ CONFIG_ARCH_BOARD_CUSTOM_DIR="../../../../boards/mro/ctrl-zero-classic/nuttx-con
|
||||
CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
|
||||
CONFIG_ARCH_BOARD_CUSTOM_NAME="px4"
|
||||
CONFIG_ARCH_CHIP="stm32h7"
|
||||
CONFIG_ARCH_CHIP_STM32H743II=y
|
||||
CONFIG_ARCH_CHIP_STM32H743ZI=y
|
||||
CONFIG_ARCH_CHIP_STM32H7=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=768
|
||||
CONFIG_ARMV7M_BASEPRI_WAR=y
|
||||
|
||||
@@ -222,6 +222,9 @@
|
||||
|
||||
|
||||
/* UART/USART */
|
||||
#define GPIO_USART1_TX GPIO_USART1_TX_3 /* PB6 */
|
||||
#define GPIO_USART1_RX GPIO_USART1_RX_3 /* PB7 */
|
||||
|
||||
#define GPIO_USART2_TX GPIO_USART2_TX_2 /* PD5 */
|
||||
#define GPIO_USART2_RX GPIO_USART2_RX_2 /* PD6 */
|
||||
#define GPIO_USART2_CTS GPIO_USART2_CTS_NSS_2 /* PD3 */
|
||||
@@ -235,9 +238,6 @@
|
||||
#define GPIO_UART4_TX GPIO_UART4_TX_2 /* PA0 */
|
||||
#define GPIO_UART4_RX GPIO_UART4_RX_2 /* PA1 */
|
||||
|
||||
#define GPIO_USART6_TX 0 /* USART6 is RX-only */
|
||||
#define GPIO_USART6_RX GPIO_USART6_RX_1 /* PC7 */
|
||||
|
||||
#define GPIO_UART7_TX GPIO_UART7_TX_3 /* PE8 */
|
||||
#define GPIO_UART7_RX GPIO_UART7_RX_3 /* PE7 */
|
||||
|
||||
@@ -268,13 +268,14 @@
|
||||
#define GPIO_SPI5_MISO GPIO_SPI5_MISO_1 /* PF8 */
|
||||
#define GPIO_SPI5_MOSI GPIO_SPI5_MOSI_2 /* PF9 */
|
||||
|
||||
#define GPIO_SPI6_SCK ADJ_SLEW_RATE(GPIO_SPI6_SCK_1) /* PG13 */
|
||||
#define GPIO_SPI6_MISO GPIO_SPI6_MISO_1 /* PG12 */
|
||||
#define GPIO_SPI6_MOSI GPIO_SPI6_MOSI_1 /* PG14 */
|
||||
|
||||
|
||||
/* I2C */
|
||||
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_2 /* PB8 */
|
||||
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_2 /* PB9 */
|
||||
|
||||
#define GPIO_I2C3_SCL GPIO_I2C3_SCL_2 /* PH7 */
|
||||
#define GPIO_I2C3_SDA GPIO_I2C3_SDA_2 /* PH8 */
|
||||
|
||||
#define GPIO_I2C4_SCL GPIO_I2C4_SCL_4 /* PB6 */
|
||||
#define GPIO_I2C4_SDA GPIO_I2C4_SDA_4 /* PB7 */
|
||||
#define GPIO_I2C4_SCL GPIO_I2C4_SCL_2 /* PF14 */
|
||||
#define GPIO_I2C4_SDA GPIO_I2C4_SDA_2 /* PF15 */
|
||||
|
||||
@@ -56,7 +56,7 @@ CONFIG_ARCH_BOARD_CUSTOM_DIR="../../../../boards/mro/ctrl-zero-classic/nuttx-con
|
||||
CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH=y
|
||||
CONFIG_ARCH_BOARD_CUSTOM_NAME="px4"
|
||||
CONFIG_ARCH_CHIP="stm32h7"
|
||||
CONFIG_ARCH_CHIP_STM32H743II=y
|
||||
CONFIG_ARCH_CHIP_STM32H743ZI=y
|
||||
CONFIG_ARCH_CHIP_STM32H7=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=768
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
@@ -190,7 +190,6 @@ CONFIG_STM32H7_DMA2=y
|
||||
CONFIG_STM32H7_DMACAPABLE=y
|
||||
CONFIG_STM32H7_FLOWCONTROL_BROKEN=y
|
||||
CONFIG_STM32H7_I2C1=y
|
||||
CONFIG_STM32H7_I2C3=y
|
||||
CONFIG_STM32H7_I2C4=y
|
||||
CONFIG_STM32H7_I2C_DYNTIMEO=y
|
||||
CONFIG_STM32H7_I2C_DYNTIMEO_STARTSTOP=10
|
||||
@@ -210,17 +209,20 @@ CONFIG_STM32H7_SPI2=y
|
||||
CONFIG_STM32H7_SPI5=y
|
||||
CONFIG_STM32H7_SPI5_DMA=y
|
||||
CONFIG_STM32H7_SPI5_DMA_BUFFER=1024
|
||||
CONFIG_STM32H7_SPI6=y
|
||||
CONFIG_STM32H7_TIM15=y
|
||||
CONFIG_STM32H7_TIM16=y
|
||||
CONFIG_STM32H7_TIM1=y
|
||||
CONFIG_STM32H7_TIM2=y
|
||||
CONFIG_STM32H7_TIM3=y
|
||||
CONFIG_STM32H7_TIM4=y
|
||||
CONFIG_STM32H7_TIM8=y
|
||||
CONFIG_STM32H7_USART1=y
|
||||
CONFIG_STM32H7_USART2=y
|
||||
CONFIG_STM32H7_USART3=y
|
||||
CONFIG_STM32H7_UART4=y
|
||||
CONFIG_STM32H7_UART7=y
|
||||
CONFIG_STM32H7_UART8=y
|
||||
CONFIG_STM32H7_USART2=y
|
||||
CONFIG_STM32H7_USART3=y
|
||||
CONFIG_STM32H7_USART6=y
|
||||
CONFIG_STM32H7_USART_BREAKS=y
|
||||
CONFIG_STM32H7_USART_INVERT=y
|
||||
CONFIG_STM32H7_USART_SINGLEWIRE=y
|
||||
@@ -250,9 +252,6 @@ CONFIG_USART3_IFLOWCONTROL=y
|
||||
CONFIG_USART3_OFLOWCONTROL=y
|
||||
CONFIG_USART3_RXBUFSIZE=600
|
||||
CONFIG_USART3_TXBUFSIZE=3000
|
||||
CONFIG_USART6_BAUD=57600
|
||||
CONFIG_USART6_RXBUFSIZE=600
|
||||
CONFIG_USART6_TXBUFSIZE=1500
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USBDEV_BUSPOWERED=y
|
||||
CONFIG_USBDEV_MAXPOWER=500
|
||||
|
||||
@@ -45,95 +45,111 @@
|
||||
#include <stm32_gpio.h>
|
||||
|
||||
/* LEDs are driven with push open drain to support Anode to 5V or 3.3V */
|
||||
#define GPIO_nLED_RED /* PB11 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN11)
|
||||
#define GPIO_nLED_GREEN /* PB1 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN1)
|
||||
#define GPIO_nLED_RED /* PB4 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN4)
|
||||
#define GPIO_nLED_GREEN /* PB5 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN5)
|
||||
#define GPIO_nLED_BLUE /* PB3 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN3)
|
||||
|
||||
#define GPIO_LED_SAFETY /* PE6 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN6)
|
||||
|
||||
#define BOARD_HAS_CONTROL_STATUS_LEDS 1
|
||||
#define BOARD_OVERLOAD_LED LED_RED
|
||||
#define BOARD_ARMED_STATE_LED LED_BLUE
|
||||
|
||||
/* ADC channels */
|
||||
#define PX4_ADC_GPIO \
|
||||
/* PA2 */ GPIO_ADC12_INP14, \
|
||||
/* PC4 */ GPIO_ADC12_INP4, \
|
||||
/* PA3 */ GPIO_ADC12_INP15, \
|
||||
/* PA4 */ GPIO_ADC12_INP18, \
|
||||
/* PC1 */ GPIO_ADC123_INP11
|
||||
/* PC0 */ GPIO_ADC123_INP10, \
|
||||
/* PC5 */ GPIO_ADC12_INP8, \
|
||||
/* PB0 */ GPIO_ADC12_INP9, \
|
||||
/* PB1 */ GPIO_ADC12_INP5
|
||||
|
||||
/* Define Channel numbers must match above GPIO pins */
|
||||
#define ADC_BATTERY_VOLTAGE_CHANNEL 14 /* PA2 BATT_VOLT_SENS */
|
||||
#define ADC_BATTERY_VOLTAGE_CHANNEL 4 /* PC4 BATT_VOLT_SENS */
|
||||
#define ADC_BATTERY_CURRENT_CHANNEL 15 /* PA3 BATT_CURRENT_SENS */
|
||||
#define ADC_SCALED_V5_CHANNEL 18 /* PA4 VDD_5V_SENS */
|
||||
#define ADC_RC_RSSI_CHANNEL 11 /* PC1 */
|
||||
#define ADC_RC_RSSI_CHANNEL 10 /* PC0 */
|
||||
#define ADC_AIRSPEED_VOLTAGE_CHANNEL 8 /* PC5 */
|
||||
#define ADC_AUX1_VOLTAGE_CHANNEL 9 /* PB0 */
|
||||
#define ADC_AUX2_VOLTAGE_CHANNEL 5 /* PB1 */
|
||||
|
||||
#define ADC_CHANNELS \
|
||||
((1 << ADC_BATTERY_VOLTAGE_CHANNEL) | \
|
||||
(1 << ADC_BATTERY_CURRENT_CHANNEL) | \
|
||||
(1 << ADC_SCALED_V5_CHANNEL) | \
|
||||
(1 << ADC_RC_RSSI_CHANNEL))
|
||||
(1 << ADC_RC_RSSI_CHANNEL) | \
|
||||
(1 << ADC_AIRSPEED_VOLTAGE_CHANNEL) | \
|
||||
(1 << ADC_AUX1_VOLTAGE_CHANNEL) | \
|
||||
(1 << ADC_AUX2_VOLTAGE_CHANNEL))
|
||||
|
||||
/* HW has to large of R termination on ADC todo:change when HW value is chosen */
|
||||
#define BOARD_ADC_OPEN_CIRCUIT_V (5.6f)
|
||||
|
||||
/* CAN Silence: Silent mode control */
|
||||
#define GPIO_CAN1_SILENT_S0 /* PF5 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN5)
|
||||
#define GPIO_CAN2_SILENT_S0 /* PF5 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN5)
|
||||
#define GPIO_CAN1_SILENT_S0 /* PF11 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN11)
|
||||
#define GPIO_CAN2_SILENT_S0 /* PF12 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN12)
|
||||
|
||||
/* PWM */
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 12
|
||||
|
||||
/* Power supply control and monitoring GPIOs */
|
||||
#define GPIO_nPOWER_IN_A /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5)
|
||||
#define GPIO_nPOWER_IN_A /* PC1 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN1)
|
||||
|
||||
#define GPIO_VDD_BRICK1_VALID GPIO_nPOWER_IN_A /* Brick 1 Is Chosen */
|
||||
#define BOARD_NUMBER_BRICKS 1
|
||||
|
||||
#define GPIO_VDD_3V3_SPEKTRUM_POWER_EN /* PE4 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN4)
|
||||
|
||||
#define GPIO_LEVEL_SHIFTER_OE /* PC13 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
|
||||
|
||||
/* Define True logic Power Control in arch agnostic form */
|
||||
#define VDD_3V3_SPEKTRUM_POWER_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SPEKTRUM_POWER_EN, (!on_true))
|
||||
#define READ_VDD_3V3_SPEKTRUM_POWER_EN() (px4_arch_gpioread(GPIO_VDD_3V3_SPEKTRUM_POWER_EN) == 0)
|
||||
|
||||
/* Tone alarm output */
|
||||
#define TONE_ALARM_TIMER 2 /* timer 2 */
|
||||
#define TONE_ALARM_CHANNEL 1 /* PA15 TIM2_CH1 */
|
||||
#define TONE_ALARM_TIMER 16 /* timer 16 */
|
||||
#define TONE_ALARM_CHANNEL 1 /* PF6 TIM16_CH1 */
|
||||
|
||||
#define GPIO_BUZZER_1 /* PA15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15)
|
||||
#define GPIO_BUZZER_1 /* PF6 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTF|GPIO_PIN6)
|
||||
|
||||
#define GPIO_TONE_ALARM_IDLE GPIO_BUZZER_1
|
||||
#define GPIO_TONE_ALARM GPIO_TIM2_CH1OUT_2
|
||||
#define GPIO_TONE_ALARM GPIO_TIM16_CH1OUT_2
|
||||
|
||||
/* USB OTG FS */
|
||||
#define GPIO_OTGFS_VBUS /* PA9 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_SPEED_100MHz|GPIO_PORTA|GPIO_PIN9)
|
||||
|
||||
/* High-resolution timer */
|
||||
#define HRT_TIMER 3 /* use timer3 for the HRT */
|
||||
#define HRT_TIMER_CHANNEL 1 /* use capture/compare channel 1 */
|
||||
#define HRT_TIMER_CHANNEL 2 /* use capture/compare channel 1 */
|
||||
|
||||
#define HRT_PPM_CHANNEL /* T3C3 */ 3 /* use capture/compare channel 3 */
|
||||
#define GPIO_PPM_IN /* PB0 T3C3 */ GPIO_TIM3_CH3IN_1
|
||||
#define HRT_PPM_CHANNEL /* T3C2 */ 2 /* use capture/compare channel 2 */
|
||||
#define GPIO_PPM_IN /* PC7 T3C2 */ GPIO_TIM3_CH2IN_3
|
||||
|
||||
/* RC Serial port */
|
||||
#define RC_SERIAL_PORT "/dev/ttyS3"
|
||||
#define RC_SERIAL_PORT "/dev/ttyS5"
|
||||
|
||||
#define GPIO_RSSI_IN /* PC1 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN1)
|
||||
#define GPIO_RSSI_IN /* PC0 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN0)
|
||||
|
||||
/* Safety Switch: Enable the FMU to control it if there is no px4io fixme:This should be BOARD_SAFETY_LED(__ontrue) */
|
||||
#define GPIO_SAFETY_SWITCH_IN /* PC4 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN4)
|
||||
/* Enable the FMU to use the switch it if there is no px4io fixme:This should be BOARD_SAFTY_BUTTON() */
|
||||
#define GPIO_SAFETY_SWITCH_IN /* PA10 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTA|GPIO_PIN10)
|
||||
/* Enable the FMU to use the switch it if there is no px4io fixme:This should be BOARD_SAFETY_BUTTON() */
|
||||
#define GPIO_BTN_SAFETY GPIO_SAFETY_SWITCH_IN /* Enable the FMU to control it if there is no px4io */
|
||||
|
||||
/* No PX4IO processor present */
|
||||
#define PX4_MFT_HW_SUPPORTED_PX4_MFT_PX4IO 0
|
||||
|
||||
/* Power switch controls ******************************************************/
|
||||
#define SPEKTRUM_POWER(_on_true) VDD_3V3_SPEKTRUM_POWER_EN(_on_true)
|
||||
|
||||
/*
|
||||
* Board has a separate RC_IN
|
||||
*
|
||||
* GPIO PPM_IN on PB0 T3CH3
|
||||
* GPIO PPM_IN on PC7 T3CH2
|
||||
* SPEKTRUM_RX (it's TX or RX in Bind) on UART6 PC7
|
||||
* Inversion is possible in the UART and can drive GPIO_PPM_IN as an output
|
||||
*/
|
||||
#define GPIO_PPM_IN_AS_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN0)
|
||||
#define GPIO_PPM_IN_AS_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN7)
|
||||
#define SPEKTRUM_RX_AS_GPIO_OUTPUT() px4_arch_configgpio(GPIO_PPM_IN_AS_OUT)
|
||||
#define SPEKTRUM_RX_AS_UART() /* Can be left as uart */
|
||||
#define SPEKTRUM_OUT(_one_true) px4_arch_gpiowrite(GPIO_PPM_IN_AS_OUT, (_one_true))
|
||||
@@ -156,7 +172,7 @@
|
||||
#define BOARD_HAS_STATIC_MANIFEST 1
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
#define BOARD_NUM_IO_TIMERS 6
|
||||
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
@@ -171,9 +187,12 @@
|
||||
GPIO_CAN2_SILENT_S0, \
|
||||
GPIO_nPOWER_IN_A, \
|
||||
GPIO_VDD_3V3_SPEKTRUM_POWER_EN, \
|
||||
GPIO_LEVEL_SHIFTER_OE, \
|
||||
GPIO_TONE_ALARM_IDLE, \
|
||||
GPIO_SAFETY_SWITCH_IN, \
|
||||
GPIO_OTGFS_VBUS, \
|
||||
GPIO_BTN_SAFETY, \
|
||||
GPIO_LED_SAFETY, \
|
||||
}
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -35,6 +35,5 @@
|
||||
|
||||
constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = {
|
||||
initI2CBusExternal(1),
|
||||
initI2CBusExternal(3),
|
||||
initI2CBusExternal(4),
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortG, GPIO::Pin3}, SPI::DRDY{GPIO::PortG, GPIO::Pin2}),
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20948, SPI::CS{GPIO::PortE, GPIO::Pin15}, SPI::DRDY{GPIO::PortE, GPIO::Pin12}),
|
||||
}, {GPIO::PortE, GPIO::Pin3}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
@@ -46,7 +46,10 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
}),
|
||||
initSPIBus(SPI::Bus::SPI5, {
|
||||
initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::PortF, GPIO::Pin10}, SPI::DRDY{GPIO::PortF, GPIO::Pin3}),
|
||||
initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::PortF, GPIO::Pin6}, SPI::DRDY{GPIO::PortF, GPIO::Pin1}),
|
||||
initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::PortF, GPIO::Pin0}, SPI::DRDY{GPIO::PortF, GPIO::Pin1}),
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI6, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortG, GPIO::Pin9}),
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,28 @@
|
||||
|
||||
#include <px4_arch/io_timer_hw_description.h>
|
||||
|
||||
/* Timer allocation
|
||||
*
|
||||
* TIM1_CH4 T FMU_CH1
|
||||
* TIM1_CH3 T FMU_CH2
|
||||
* TIM1_CH2 T FMU_CH3
|
||||
* TIM1_CH1 T FMU_CH4
|
||||
*
|
||||
* TIM4_CH2 T FMU_CH5
|
||||
* TIM4_CH3 T FMU_CH6
|
||||
* TIM2_CH3 T FMU_CH7
|
||||
* TIM2_CH1 T FMU_CH8
|
||||
*
|
||||
* TIM2_CH4 T FMU_CH9
|
||||
* TIM15_CH1 T FMU_CH10
|
||||
*
|
||||
* TIM8_CH1 T FMU_CH11
|
||||
*
|
||||
* TIM4_CH4 T FMU_CH12
|
||||
*
|
||||
* TIM16_CH1 T BUZZER - Driven by other driver
|
||||
*/
|
||||
|
||||
constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
|
||||
initIOTimer(Timer::Timer1, DMA{DMA::Index1}),
|
||||
initIOTimer(Timer::Timer4, DMA{DMA::Index1}),
|
||||
|
||||
@@ -5,5 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@@ -5,5 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@@ -19,6 +19,7 @@ CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_DRIVERS_UWB_UWB_SR150=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_DRIVERS_LIGHTS_RGBLED_PWM=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
|
||||
@@ -22,7 +22,7 @@ CONFIG_DRIVERS_PWM_OUT=y
|
||||
CONFIG_DRIVERS_RC_INPUT=y
|
||||
CONFIG_DRIVERS_SAFETY_BUTTON=y
|
||||
CONFIG_DRIVERS_TONE_ALARM=y
|
||||
CONFIG_COMMON_UWB=y
|
||||
CONFIG_DRIVERS_UWB_UWB_SR150=y
|
||||
CONFIG_MODULES_BATTERY_STATUS=y
|
||||
CONFIG_MODULES_CAMERA_FEEDBACK=y
|
||||
CONFIG_MODULES_COMMANDER=y
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
# CONFIG_BOARD_ROMFSROOT is not set
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS1"
|
||||
CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS4"
|
||||
CONFIG_BOARD_SERIAL_RC="/dev/ttyS5"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS2"
|
||||
CONFIG_BOARD_SERIAL_TEL4="/dev/ttyS3"
|
||||
CONFIG_BOARD_UAVCAN_INTERFACES=1
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_CYPHAL_BMS_SUBSCRIBER=y
|
||||
CONFIG_DRIVERS_ADC_BOARD_ADC=y
|
||||
CONFIG_DRIVERS_CYPHAL=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8310=y
|
||||
CONFIG_DRIVERS_MAGNETOMETER_LIS3MDL=y
|
||||
CONFIG_DRIVERS_RC_INPUT=y
|
||||
CONFIG_DRIVERS_SAFETY_BUTTON=y
|
||||
CONFIG_DRIVERS_UAVCAN=y
|
||||
CONFIG_EXAMPLES_FAKE_GPS=y
|
||||
CONFIG_MODULES_AIRSPEED_SELECTOR=y
|
||||
CONFIG_MODULES_ATTITUDE_ESTIMATOR_Q=y
|
||||
CONFIG_MODULES_BATTERY_STATUS=y
|
||||
CONFIG_MODULES_CAMERA_FEEDBACK=y
|
||||
CONFIG_MODULES_COMMANDER=y
|
||||
CONFIG_MODULES_ESC_BATTERY=y
|
||||
|
||||
@@ -17,6 +17,17 @@ param set-default MAV_1_UDP_PRT 14550
|
||||
param set-default SENS_EXT_I2C_PRB 0
|
||||
param set-default CYPHAL_ENABLE 0
|
||||
|
||||
if ver hwtypecmp MR-CANHUBK3-ADAP
|
||||
then
|
||||
param set-default GPS_1_CONFIG 202
|
||||
param set-default RC_PORT_CONFIG 104
|
||||
param set-default SENS_INT_BARO_EN 0
|
||||
param set-default SYS_HAS_BARO 0
|
||||
# MR-CANHUBK3-ADAP voltage divider
|
||||
param set-default BAT1_V_DIV 13.158
|
||||
safety_button start
|
||||
fi
|
||||
|
||||
if param greater -s UAVCAN_ENABLE 0
|
||||
then
|
||||
ifup can0
|
||||
|
||||
@@ -2,22 +2,31 @@
|
||||
#
|
||||
# NXP MR-CANHUBK3 specific board sensors init
|
||||
#------------------------------------------------------------------------------
|
||||
if ver hwtypecmp MR-CANHUBK3-ADAP
|
||||
then
|
||||
icm42688p -c 2 -b 3 -R 0 -S -f 15000 start
|
||||
# Internal magnetometer on I2c on ADAP
|
||||
bmm150 -X -a 18 start
|
||||
ist8310 -X -b 1 -R 10 start
|
||||
# ADC for voltage input sensing
|
||||
board_adc start
|
||||
|
||||
#board_adc start FIXME no ADC drivers
|
||||
# External SPI bus ICM20649
|
||||
icm20649 -b 4 -S -R 10 start
|
||||
|
||||
#FMUv5Xbase board orientation
|
||||
# External SPI bus ICM42688p
|
||||
icm42688p -c 1 -b 3 -R 10 -S -f 15000 start
|
||||
else
|
||||
bmm150 -X start
|
||||
# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer)
|
||||
ist8310 -X -b 2 -R 10 start
|
||||
|
||||
# Internal SPI bus ICM20649
|
||||
icm20649 -s -R 6 start
|
||||
# External SPI bus ICM20649
|
||||
icm20649 -b 4 -S -R 6 start
|
||||
|
||||
# Internal SPI bus ICM42688p
|
||||
icm42688p -R 6 -s start
|
||||
|
||||
# Internal magnetometer on I2c
|
||||
bmm150 -I start
|
||||
|
||||
# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer)
|
||||
ist8310 -X -b 2 -R 10 start
|
||||
# External SPI bus ICM42688p
|
||||
icm42688p -c 1 -b 3 -R 6 -S -f 15000 start
|
||||
fi
|
||||
|
||||
# External compass on GPS1/I2C1 (the 3rd external bus): Drotek RTK GPS with LIS3MDL Compass
|
||||
lis3mdl -X -b 2 -R 2 start
|
||||
@@ -25,5 +34,5 @@ lis3mdl -X -b 2 -R 2 start
|
||||
# Disable startup of internal baros if param is set to false
|
||||
if param compare SENS_INT_BARO_EN 1
|
||||
then
|
||||
bmp388 -I -a 0x77 start
|
||||
bmp388 -X -a 0x77 start
|
||||
fi
|
||||
|
||||
@@ -152,6 +152,18 @@
|
||||
#define PIN_LPUART1_RX (PIN_LPUART1_RX_3 | PIN_INPUT_PULLUP) /* PTC6 */
|
||||
#define PIN_LPUART1_TX PIN_LPUART1_TX_3 /* PTC7 */
|
||||
|
||||
|
||||
/* LPUART4 /dev/ttyS3 P8B 3X7 Pin 3 Single wire RC UART */
|
||||
|
||||
#define PIN_LPUART4_RX PIN_LPUART4_TX_3 /* Dummy since it's Single Wire TX-only */
|
||||
#define PIN_LPUART4_TX PIN_LPUART4_TX_3 /* PTE11 */
|
||||
|
||||
|
||||
/* LPUART7 /dev/ttyS4 P8B 3X7 Pin 3 and Pin 8 */
|
||||
|
||||
#define PIN_LPUART7_RX (PIN_LPUART7_RX_3 | PIN_INPUT_PULLUP) /* PTE0 */
|
||||
#define PIN_LPUART7_TX PIN_LPUART7_TX_3 /* PTE1 */
|
||||
|
||||
/* LPUART9 P24 UART connector */
|
||||
|
||||
#define PIN_LPUART9_RX (PIN_LPUART9_RX_1 | PIN_INPUT_PULLUP) /* PTB2 */
|
||||
@@ -209,7 +221,8 @@
|
||||
#define PIN_LPSPI4_PCS0 PIN_LPSPI4_PCS0_1 /* PTB8 */
|
||||
#define PIN_LPSPI4_PCS3 PIN_LPSPI4_PCS3_1 /* PTA16 */
|
||||
|
||||
#define PIN_LPSPI4_PCS (PIN_PTA16 | GPIO_LOWDRIVE | GPIO_OUTPUT_ONE) /* PTA16 */
|
||||
#define PIN_LPSPI4_CS_P26 (PIN_PTA16 | GPIO_LOWDRIVE | GPIO_OUTPUT_ONE) /* PTA16 */
|
||||
#define PIN_LPSPI4_CS_P8B (PIN_PTB8 | GPIO_LOWDRIVE | GPIO_OUTPUT_ONE) /* PTB8 */
|
||||
|
||||
/* LPSPI5 P26 external IMU connector */
|
||||
|
||||
|
||||
@@ -245,6 +245,8 @@ CONFIG_S32K3XX_LPUART13=y
|
||||
CONFIG_S32K3XX_LPUART14=y
|
||||
CONFIG_S32K3XX_LPUART1=y
|
||||
CONFIG_S32K3XX_LPUART2=y
|
||||
CONFIG_S32K3XX_LPUART4=y
|
||||
CONFIG_S32K3XX_LPUART7=y
|
||||
CONFIG_S32K3XX_LPUART9=y
|
||||
CONFIG_S32K3XX_LPUART_INVERT=y
|
||||
CONFIG_S32K3XX_LPUART_SINGLEWIRE=y
|
||||
|
||||
@@ -38,6 +38,7 @@ if("${PX4_BOARD_LABEL}" STREQUAL "canbootloader")
|
||||
clockconfig.c
|
||||
periphclocks.c
|
||||
timer_config.cpp
|
||||
hw_rev_ver_canhubk3.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
@@ -65,6 +66,8 @@ else()
|
||||
spi.cpp
|
||||
timer_config.cpp
|
||||
s32k3xx_userleds.c
|
||||
hw_rev_ver_canhubk3.c
|
||||
manifest.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
|
||||
@@ -88,7 +88,7 @@ __BEGIN_DECLS
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 8
|
||||
|
||||
#define RC_SERIAL_PORT "/dev/ttyS5"
|
||||
#define RC_SERIAL_SINGLEWIRE
|
||||
#define RC_SERIAL_SINGLEWIRE_FORCE
|
||||
#define RC_SERIAL_INVERT_RX_ONLY
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
@@ -110,6 +110,40 @@ __BEGIN_DECLS
|
||||
/* Reboot and ulog we store on a wear-level filesystem */
|
||||
#define HARDFAULT_REBOOT_PATH "/mnt/progmem/reboot"
|
||||
|
||||
/* To detect MR-CANHUBK3-ADAP board */
|
||||
#define BOARD_HAS_HW_VERSIONING 1
|
||||
#define CANHUBK3_ADAP_DETECT (PIN_PTA12 | GPIO_INPUT | GPIO_PULLUP)
|
||||
|
||||
|
||||
/*
|
||||
* ADC channels
|
||||
*
|
||||
* These are the channel numbers of the ADCs of the microcontroller that can be used by the Px4
|
||||
* Firmware in the adc driver. ADC1 has 32 channels, with some a/b selection overlap
|
||||
* in the AD4-AD7 range on the same ADC.
|
||||
*
|
||||
* Only ADC1 is used
|
||||
* Bits 31:0 are ADC1 channels 31:0
|
||||
*/
|
||||
|
||||
#define ADC1_CH(c) (((c) & 0x1f)) /* Define ADC number Channel number */
|
||||
|
||||
/* ADC defines to be used in sensors.cpp to read from a particular channel */
|
||||
|
||||
#define ADC_BATTERY_VOLTAGE_CHANNEL ADC1_CH(0) /* BAT_VSENS 85 PTB4 ADC1_SE10 */
|
||||
#define ADC_BATTERY_CURRENT_CHANNEL ADC1_CH(1) /* Non-existant but needed for compilation */
|
||||
|
||||
|
||||
/* Mask use to initialize the ADC driver */
|
||||
|
||||
#define ADC_CHANNELS ((1 << ADC_BATTERY_VOLTAGE_CHANNEL))
|
||||
|
||||
/* Safety Switch
|
||||
* TBD
|
||||
*/
|
||||
#define GPIO_LED_SAFETY (PIN_PTE26 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO)
|
||||
#define GPIO_BTN_SAFETY (PIN_PTA11 | GPIO_INPUT | GPIO_PULLDOWN)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2023 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file hw_rev_ver_canhubk3.c
|
||||
* CANHUBK3 Hardware Revision and Version ID API
|
||||
*/
|
||||
#include <drivers/drv_adc.h>
|
||||
#include <px4_arch/adc.h>
|
||||
#include <px4_platform_common/micro_hal.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <px4_platform/board_determine_hw_info.h>
|
||||
#include <stdio.h>
|
||||
#include <board_config.h>
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
|
||||
#if defined(BOARD_HAS_HW_VERSIONING)
|
||||
|
||||
|
||||
#define HW_INFO_SIZE HW_INFO_VER_DIGITS + HW_INFO_REV_DIGITS
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
static int is_adap_connected = 0;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
/************************************************************************************
|
||||
* Name: board_get_hw_type
|
||||
*
|
||||
* Description:
|
||||
* Optional returns a 0 terminated string defining the HW type.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* a 0 terminated string defining the HW type. This my be a 0 length string ""
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT const char *board_get_hw_type_name()
|
||||
{
|
||||
if (is_adap_connected) {
|
||||
return (const char *)"MR-CANHUBK3-ADAP";
|
||||
|
||||
} else {
|
||||
return (const char *)"MR-CANHUBK344";
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_get_hw_version
|
||||
*
|
||||
* Description:
|
||||
* Optional returns a integer HW version
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* An integer value of this boards hardware version.
|
||||
* A value of -1 is the default for boards not supporting the BOARD_HAS_VERSIONING API.
|
||||
* A value of 0 is the default for boards supporting the API but not having version.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT int board_get_hw_version()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_get_hw_revision
|
||||
*
|
||||
* Description:
|
||||
* Optional returns a integer HW revision
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* An integer value of this boards hardware revision.
|
||||
* A value of -1 is the default for boards not supporting the BOARD_HAS_VERSIONING API.
|
||||
* A value of 0 is the default for boards supporting the API but not having revision.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT int board_get_hw_revision()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_determine_hw_info
|
||||
*
|
||||
* Description:
|
||||
* Uses GPIO to detect MR-CANHUBK3-ADAP
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_determine_hw_info()
|
||||
{
|
||||
s32k3xx_pinconfig(CANHUBK3_ADAP_DETECT);
|
||||
is_adap_connected = !s32k3xx_gpioread(CANHUBK3_ADAP_DETECT);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -34,6 +34,6 @@
|
||||
#include <px4_arch/i2c_hw_description.h>
|
||||
|
||||
constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = {
|
||||
initI2CBusInternal(PX4_BUS_NUMBER_TO_PX4(0)),
|
||||
initI2CBusExternal(PX4_BUS_NUMBER_TO_PX4(1)),
|
||||
initI2CBusExternal(PX4_BUS_NUMBER_TO_PX4(0)),
|
||||
initI2CBusInternal(PX4_BUS_NUMBER_TO_PX4(1)),
|
||||
};
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "board_config.h"
|
||||
|
||||
#include <px4_platform_common/init.h>
|
||||
#include <px4_platform/board_determine_hw_info.h>
|
||||
|
||||
#if defined(CONFIG_S32K3XX_LPSPI1) && defined(CONFIG_MMCSD)
|
||||
#include <nuttx/mmcsd.h>
|
||||
@@ -96,6 +97,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
|
||||
int rv;
|
||||
|
||||
board_determine_hw_info();
|
||||
|
||||
|
||||
#if defined(CONFIG_S32K3XX_LPSPI1) && defined(CONFIG_MMCSD)
|
||||
/* LPSPI1 *****************************************************************/
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2023 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file manifest.c
|
||||
*
|
||||
* This module supplies the interface to the manifest of hardware that is
|
||||
* optional and dependent on the HW REV and HW VER IDs
|
||||
*
|
||||
* The manifest allows the system to know whether a hardware option
|
||||
* say for example the PX4IO is an no-pop option vs it is broken.
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <stdbool.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "systemlib/px4_macros.h"
|
||||
#include "px4_log.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_query_manifest
|
||||
*
|
||||
* Description:
|
||||
* Optional returns manifest item.
|
||||
*
|
||||
* Input Parameters:
|
||||
* manifest_id - the ID for the manifest item to retrieve
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 - item is not in manifest => assume legacy operations
|
||||
* pointer to a manifest item
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT px4_hw_mft_item board_query_manifest(px4_hw_mft_item_id_t id)
|
||||
{
|
||||
return px4_hw_mft_unsupported;
|
||||
}
|
||||
@@ -107,6 +107,9 @@ int s32k3xx_bringup(void)
|
||||
s32k3xx_spidev_initialize();
|
||||
#endif
|
||||
|
||||
s32k3xx_pinconfig(GPIO_LED_SAFETY);
|
||||
s32k3xx_pinconfig(GPIO_BTN_SAFETY);
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
|
||||
@@ -168,6 +168,22 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = {
|
||||
.clkgate = true,
|
||||
#else
|
||||
.clkgate = false,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.clkname = LPUART4_CLK,
|
||||
#ifdef CONFIG_S32K3XX_LPUART4
|
||||
.clkgate = true,
|
||||
#else
|
||||
.clkgate = false,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.clkname = LPUART7_CLK,
|
||||
#ifdef CONFIG_S32K3XX_LPUART7
|
||||
.clkgate = true,
|
||||
#else
|
||||
.clkgate = false,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
@@ -258,6 +274,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = {
|
||||
.clkname = EMIOS0_CLK,
|
||||
.clkgate = true,
|
||||
},
|
||||
{
|
||||
.clkname = ADC2_CLK,
|
||||
.clkgate = true,
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int const num_of_peripheral_clocks_0 =
|
||||
|
||||
@@ -70,11 +70,12 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
|
||||
initSPIBus(SPI::Bus::SPI3, { // SPI3 is ignored only used for FS26 by a NuttX driver
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin17})
|
||||
}),
|
||||
initSPIBus(SPI::Bus::SPI4, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortA, GPIO::Pin16}, SPI::DRDY{PIN_WKPU20})
|
||||
initSPIBusExternal(SPI::Bus::SPI4, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortA, GPIO::Pin16}, SPI::DRDY{PIN_WKPU20}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortB, GPIO::Pin8}, SPI::DRDY{PIN_WKPU56})
|
||||
}),
|
||||
initSPIBus(SPI::Bus::SPI5, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortA, GPIO::Pin14}, SPI::DRDY{PIN_WKPU4})
|
||||
initSPIBusExternal(SPI::Bus::SPI5, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortA, GPIO::Pin14}, SPI::DRDY{PIN_WKPU4})
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -337,7 +338,14 @@ void s32k3xx_lpspi4select(FAR struct spi_dev_s *dev, uint32_t devid,
|
||||
spiinfo("devid: %" PRId32 ", CS: %s\n", devid,
|
||||
selected ? "assert" : "de-assert");
|
||||
|
||||
s32k3xx_gpiowrite(PIN_LPSPI4_PCS, !selected);
|
||||
devid = ((devid) & 0xF);
|
||||
|
||||
if (devid == 0) {
|
||||
s32k3xx_gpiowrite(PIN_LPSPI4_CS_P26, !selected);
|
||||
|
||||
} else if (devid == 1) {
|
||||
s32k3xx_gpiowrite(PIN_LPSPI4_CS_P8B, !selected);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t s32k3xx_lpspi4status(FAR struct spi_dev_s *dev, uint32_t devid)
|
||||
|
||||
@@ -13,6 +13,7 @@ CONFIG_COMMON_MAGNETOMETER=y
|
||||
CONFIG_DRIVERS_PWM_OUT=y
|
||||
CONFIG_BOARD_UAVCAN_INTERFACES=1
|
||||
CONFIG_DRIVERS_UAVCANNODE=y
|
||||
CONFIG_DRIVERS_UWB_UWB_SR150=y
|
||||
CONFIG_UAVCANNODE_ARMING_STATUS=y
|
||||
CONFIG_UAVCANNODE_BEEP_COMMAND=y
|
||||
CONFIG_UAVCANNODE_ESC_RAW_COMMAND=y
|
||||
|
||||
@@ -5,5 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@@ -5,5 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@@ -13,6 +13,4 @@ param set-default BAT2_A_PER_V 26.4
|
||||
param set-default EKF2_MULTI_IMU 2
|
||||
param set-default SENS_IMU_MODE 0
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set LOGGER_BUF 64
|
||||
|
||||
@@ -9,13 +9,6 @@ param set-default BAT2_V_DIV 18.1
|
||||
param set-default BAT1_A_PER_V 36.367515152
|
||||
param set-default BAT2_A_PER_V 36.367515152
|
||||
|
||||
if ver hwtypecmp V5004000 V5006000
|
||||
then
|
||||
param set-default SYS_USE_IO 0
|
||||
else
|
||||
param set-default SYS_USE_IO 1
|
||||
fi
|
||||
|
||||
if ver hwtypecmp V5005000 V5005002 V5006000 V5006002
|
||||
then
|
||||
# CUAV V5+ (V550/V552) and V5nano (V560/V562) have 3 IMUs
|
||||
|
||||
@@ -4,11 +4,13 @@ CONFIG_DRIVERS_IRLOCK=n
|
||||
CONFIG_DRIVERS_PCA9685_PWM_OUT=n
|
||||
CONFIG_EXAMPLES_FAKE_GPS=n
|
||||
CONFIG_MODULES_ATTITUDE_ESTIMATOR_Q=n
|
||||
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=n
|
||||
CONFIG_MODULES_MC_AUTOTUNE_ATTITUDE_CONTROL=n
|
||||
CONFIG_MODULES_LOCAL_POSITION_ESTIMATOR=n
|
||||
CONFIG_MODULES_ROVER_POS_CONTROL=n
|
||||
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=n
|
||||
CONFIG_BOARD_TESTING=y
|
||||
CONFIG_DRIVERS_TEST_PPM=y
|
||||
CONFIG_SYSTEMCMDS_MICROBENCH=y
|
||||
CONFIG_MODULES_FW_ATT_CONTROL=n
|
||||
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=n
|
||||
CONFIG_MODULES_FW_POS_CONTROL=n
|
||||
CONFIG_MODULES_FW_RATE_CONTROL=n
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2020 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
|
||||
set(PX4_FW_NAME ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_${PX4_BOARD_LABEL}.px4)
|
||||
|
||||
add_custom_target(upload_skynode_usb
|
||||
COMMAND ${PX4_SOURCE_DIR}/Tools/auterion/upload_skynode.sh --file=${PX4_FW_NAME}
|
||||
DEPENDS ${PX4_FW_NAME}
|
||||
COMMENT "Uploading PX4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(upload_skynode_wifi
|
||||
COMMAND ${PX4_SOURCE_DIR}/Tools/auterion/upload_skynode.sh --file=${PX4_FW_NAME} --wifi
|
||||
DEPENDS ${PX4_FW_NAME}
|
||||
COMMENT "Uploading PX4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
@@ -16,6 +16,4 @@ param set-default SENS_EN_INA238 0
|
||||
param set-default SENS_EN_INA228 0
|
||||
param set-default SENS_EN_INA226 1
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
safety_button start
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# board specific MAVLink startup script.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if ver hwtypecmp V5X009000 V5X009001 V5X00a000 V5X00a001 V5X008000 V5X008001 V5X010001
|
||||
if ver hwbasecmp 008 009 00a 010
|
||||
then
|
||||
# Start MAVLink on the UART connected to the mission computer
|
||||
mavlink start -d /dev/ttyS4 -b 3000000 -r 290000 -m onboard_low_bandwidth -x -z
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
set HAVE_PM2 yes
|
||||
|
||||
if ver hwtypecmp V5X005000 V5X005001 V5X005002
|
||||
if mft query -q -k MFT -s MFT_PM2 -v 0
|
||||
then
|
||||
set HAVE_PM2 no
|
||||
fi
|
||||
@@ -49,33 +49,11 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ver hwtypecmp V5X000000 V5X000001 V5X000002 V5X001000 V5X004000 V5X004001 V5X004002 V5X005001 V5X005002
|
||||
if ver hwbasecmp 008 009 00a 010 011
|
||||
then
|
||||
#FMUv5Xbase board orientation
|
||||
|
||||
if ver hwtypecmp V5X000000 V5X000001 V5X004000 V5X004001 V5X005001
|
||||
then
|
||||
# Internal SPI BMI088
|
||||
bmi088 -A -R 4 -s start
|
||||
bmi088 -G -R 4 -s start
|
||||
else
|
||||
# Internal SPI bus ICM20649
|
||||
icm20649 -s -R 6 start
|
||||
fi
|
||||
|
||||
# Internal SPI bus ICM42688p
|
||||
icm42688p -R 6 -s start
|
||||
|
||||
# Internal SPI bus ICM-20602 (hard-mounted)
|
||||
icm20602 -R 10 -s start
|
||||
|
||||
# Internal magnetometer on I2c
|
||||
bmm150 -I start
|
||||
|
||||
else
|
||||
#SKYNODE base fmu board orientation
|
||||
|
||||
if ver hwtypecmp V5X009000 V5X009001 V5X00a000 V5X00a001 V5X008000 V5X008001 V5X010001
|
||||
if ver hwtypecmp V5X000 V5X001
|
||||
then
|
||||
# Internal SPI BMI088
|
||||
bmi088 -A -R 2 -s start
|
||||
@@ -94,6 +72,27 @@ else
|
||||
# Internal magnetometer on I2c
|
||||
bmm150 -I -R 6 start
|
||||
|
||||
else
|
||||
#FMUv5Xbase board orientation
|
||||
|
||||
if ver hwtypecmp V5X000 V5X001
|
||||
then
|
||||
# Internal SPI BMI088
|
||||
bmi088 -A -R 4 -s start
|
||||
bmi088 -G -R 4 -s start
|
||||
else
|
||||
# Internal SPI bus ICM20649
|
||||
icm20649 -s -R 6 start
|
||||
fi
|
||||
|
||||
# Internal SPI bus ICM42688p
|
||||
icm42688p -R 6 -s start
|
||||
|
||||
# Internal SPI bus ICM-20602 (hard-mounted)
|
||||
icm20602 -R 10 -s start
|
||||
|
||||
# Internal magnetometer on I2c
|
||||
bmm150 -I start
|
||||
fi
|
||||
|
||||
# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer)
|
||||
@@ -105,7 +104,7 @@ ist8310 -X -b 1 -R 10 start
|
||||
if param compare SENS_INT_BARO_EN 1
|
||||
then
|
||||
bmp388 -I -a 0x77 start
|
||||
if ver hwtypecmp V5X000000 V5X001000 V5X008000 V5X009000 V5X00a000
|
||||
if ver hwtypecmp V5X000
|
||||
then
|
||||
bmp388 -I start
|
||||
else
|
||||
|
||||
@@ -36,7 +36,6 @@ add_library(drivers_board
|
||||
i2c.cpp
|
||||
init.cpp
|
||||
led.c
|
||||
manifest.c
|
||||
mtd.cpp
|
||||
sdio.c
|
||||
spi.cpp
|
||||
|
||||
@@ -179,31 +179,17 @@
|
||||
|
||||
/* HW Version and Revision drive signals Default to 1 to detect */
|
||||
|
||||
#define BOARD_HAS_HW_VERSIONING
|
||||
#define BOARD_HAS_HW_SPLIT_VERSIONING
|
||||
|
||||
#define GPIO_HW_VER_REV_DRIVE /* PG0 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTG|GPIO_PIN0)
|
||||
#define GPIO_HW_REV_SENSE /* PF5 */ ADC3_GPIO(15)
|
||||
#define GPIO_HW_VER_SENSE /* PF4 */ ADC3_GPIO(14)
|
||||
#define HW_INFO_INIT_PREFIX "V5X"
|
||||
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 7
|
||||
// Base FMUM
|
||||
#define V5X00 HW_VER_REV(0x0,0x0) // FMUV5X, Rev 0
|
||||
#define V5X10 HW_VER_REV(0x1,0x0) // NO PX4IO, Rev 0
|
||||
#define V5X01 HW_VER_REV(0x0,0x1) // FMUV5X I2C2 BMP388, Rev 1
|
||||
#define V5X02 HW_VER_REV(0x0,0x2) // FMUV5X, Rev 2
|
||||
#define V5X40 HW_VER_REV(0x4,0x0) // FMUV5X, HB CM4 base Rev 0
|
||||
#define V5X41 HW_VER_REV(0x4,0x1) // FMUV5X I2C2 BMP388, HB CM4 base Rev 1
|
||||
#define V5X42 HW_VER_REV(0x4,0x2) // FMUV5X, HB CM4 base Rev 2
|
||||
#define V5X50 HW_VER_REV(0x5,0x0) // FMUV5X, HB Mini Rev 0
|
||||
#define V5X51 HW_VER_REV(0x5,0x1) // FMUV5X I2C2 BMP388, HB Mini Rev 1
|
||||
#define V5X52 HW_VER_REV(0x5,0x2) // FMUV5X, HB Mini Rev 2
|
||||
#define V5X90 HW_VER_REV(0x9,0x0) // NO USB, Rev 0
|
||||
#define V5X91 HW_VER_REV(0x9,0x1) // NO USB I2C2 BMP388, Rev 1
|
||||
#define V5X92 HW_VER_REV(0x9,0x2) // NO USB I2C2 BMP388, Rev 2
|
||||
#define V5Xa0 HW_VER_REV(0xa,0x0) // NO USB (Q), Rev 0
|
||||
#define V5Xa1 HW_VER_REV(0xa,0x1) // NO USB (Q) I2C2 BMP388, Rev 1
|
||||
#define V5Xa2 HW_VER_REV(0xa,0x2) // NO USB (Q) I2C2 BMP388, Rev 2
|
||||
#define V5X101 HW_VER_REV(0x10,0x1) // NO USB (Q) I2C2 BMP388, Rev 1
|
||||
#define BOARD_NUM_SPI_CFG_HW_VERSIONS 3
|
||||
|
||||
#define V5X_0 HW_FMUM_ID(0x0) // FMUV5X, Auterion FMUv5x RC13 (baro2 BMP388 on I2C4) Sensor Set Rev 0
|
||||
#define V5X_1 HW_FMUM_ID(0x1) // FMUV5X, Auterion, HB FMUv5x RC15 (baro2 BMP388 on I2C2) Sensor Set Rev 1
|
||||
#define V5X_2 HW_FMUM_ID(0x2) // FMUV5X, HB FMUv5x Sensor Set Rev 2
|
||||
|
||||
#define UAVCAN_NUM_IFACES_RUNTIME 1
|
||||
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2021 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file manifest.c
|
||||
*
|
||||
* This module supplies the interface to the manifest of hardware that is
|
||||
* optional and dependent on the HW REV and HW VER IDs
|
||||
*
|
||||
* The manifest allows the system to know whether a hardware option
|
||||
* say for example the PX4IO is an no-pop option vs it is broken.
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <board_config.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "systemlib/px4_macros.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
uint32_t hw_ver_rev; /* the version and revision */
|
||||
const px4_hw_mft_item_t *mft; /* The first entry */
|
||||
uint32_t entries; /* the lenght of the list */
|
||||
} px4_hw_mft_list_entry_t;
|
||||
|
||||
typedef px4_hw_mft_list_entry_t *px4_hw_mft_list_entry;
|
||||
#define px4_hw_mft_list_uninitialized (px4_hw_mft_list_entry) -1
|
||||
|
||||
static const px4_hw_mft_item_t device_unsupported = {0, 0, 0};
|
||||
|
||||
// List of components on a specific board configuration
|
||||
// The index of those components is given by the enum (px4_hw_mft_item_id_t)
|
||||
// declared in board_common.h
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0500[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0550[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0510[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static const px4_hw_mft_item_t hw_mft_list_v0509[] = {
|
||||
{
|
||||
// PX4_MFT_PX4IO
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_USB
|
||||
.present = 0,
|
||||
.mandatory = 0,
|
||||
.connection = px4_hw_con_unknown,
|
||||
},
|
||||
{
|
||||
// PX4_MFT_CAN2
|
||||
.present = 1,
|
||||
.mandatory = 1,
|
||||
.connection = px4_hw_con_onboard,
|
||||
},
|
||||
};
|
||||
|
||||
static px4_hw_mft_list_entry_t mft_lists[] = {
|
||||
// ver_rev
|
||||
{V5X00, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, Rev 0
|
||||
{V5X01, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, Rev 1
|
||||
{V5X02, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, Rev 2
|
||||
{V5X10, hw_mft_list_v0510, arraySize(hw_mft_list_v0510)}, // NO PX4IO, Rev 0
|
||||
{V5X41, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, HB CM4 base Rev 1
|
||||
{V5X42, hw_mft_list_v0500, arraySize(hw_mft_list_v0500)}, // FMUV5X, HB CM4 base Rev 2
|
||||
{V5X51, hw_mft_list_v0550, arraySize(hw_mft_list_v0550)}, // FMUV5X, HB Mini Rev 1
|
||||
{V5X52, hw_mft_list_v0550, arraySize(hw_mft_list_v0550)}, // FMUV5X, HB Mini Rev 2
|
||||
{V5X90, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB, Rev 0
|
||||
{V5X91, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB I2C2 BMP388, Rev 1
|
||||
{V5X92, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB I2C2 BMP388, Rev 2
|
||||
{V5Xa0, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB (Q), Rev 0
|
||||
{V5Xa1, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB (Q) I2C2 BMP388, Rev 1
|
||||
{V5Xa2, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB (Q) I2C2 BMP388, Rev 2
|
||||
{V5X101, hw_mft_list_v0509, arraySize(hw_mft_list_v0509)}, // NO USB I2C2 BMP388, Rev 1
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_query_manifest
|
||||
*
|
||||
* Description:
|
||||
* Optional returns manifest item.
|
||||
*
|
||||
* Input Parameters:
|
||||
* manifest_id - the ID for the manifest item to retrieve
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 - item is not in manifest => assume legacy operations
|
||||
* pointer to a manifest item
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
__EXPORT px4_hw_mft_item board_query_manifest(px4_hw_mft_item_id_t id)
|
||||
{
|
||||
static px4_hw_mft_list_entry boards_manifest = px4_hw_mft_list_uninitialized;
|
||||
|
||||
if (boards_manifest == px4_hw_mft_list_uninitialized) {
|
||||
uint32_t ver_rev = board_get_hw_version() << 16;
|
||||
ver_rev |= board_get_hw_revision();
|
||||
|
||||
for (unsigned i = 0; i < arraySize(mft_lists); i++) {
|
||||
if (mft_lists[i].hw_ver_rev == ver_rev) {
|
||||
boards_manifest = &mft_lists[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (boards_manifest == px4_hw_mft_list_uninitialized) {
|
||||
syslog(LOG_ERR, "[boot] Board %08" PRIx32 " is not supported!\n", ver_rev);
|
||||
}
|
||||
}
|
||||
|
||||
px4_hw_mft_item rv = &device_unsupported;
|
||||
|
||||
if (boards_manifest != px4_hw_mft_list_uninitialized &&
|
||||
id < boards_manifest->entries) {
|
||||
rv = &boards_manifest->mft[id];
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -31,6 +31,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <board_config.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <px4_platform_common/px4_manifest.h>
|
||||
// KiB BS nB
|
||||
@@ -120,10 +123,16 @@ static const px4_mft_entry_s mtd_mft = {
|
||||
.pmft = (void *) &board_mtd_config,
|
||||
};
|
||||
|
||||
static const px4_mft_entry_s mft_mft = {
|
||||
.type = MFT,
|
||||
.pmft = (void *) system_query_manifest,
|
||||
};
|
||||
|
||||
static const px4_mft_s mft = {
|
||||
.nmft = 1,
|
||||
.nmft = 2,
|
||||
.mfts = {
|
||||
&mtd_mft
|
||||
&mtd_mft,
|
||||
&mft_mft,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSIONS] = {
|
||||
initSPIHWVersion(V5X00, {
|
||||
initSPIFmumID(V5X_0, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
@@ -60,7 +60,7 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(V5X01, {
|
||||
initSPIFmumID(V5X_1, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
@@ -84,7 +84,7 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(V5X02, {
|
||||
initSPIFmumID(V5X_2, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
@@ -107,99 +107,6 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(V5X41, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortH, GPIO::Pin12}),
|
||||
}, {GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIBus(SPI::Bus::SPI3, {
|
||||
initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::PortI, GPIO::Pin8}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}),
|
||||
initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::PortI, GPIO::Pin4}),
|
||||
}, {GPIO::PortE, GPIO::Pin7}),
|
||||
// initSPIBus(SPI::Bus::SPI4, {
|
||||
// // no devices
|
||||
// TODO: if enabled, remove GPIO_VDD_3V3_SENSORS4_EN from board_config.h
|
||||
// }, {GPIO::PortG, GPIO::Pin8}),
|
||||
initSPIBus(SPI::Bus::SPI5, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortG, GPIO::Pin7})
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI6, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortA, GPIO::Pin15}, SPI::DRDY{GPIO::PortD, GPIO::Pin12}),
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(V5X42, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortH, GPIO::Pin12}),
|
||||
}, {GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIBus(SPI::Bus::SPI3, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}),
|
||||
}, {GPIO::PortE, GPIO::Pin7}),
|
||||
// initSPIBus(SPI::Bus::SPI4, {
|
||||
// // no devices
|
||||
// TODO: if enabled, remove GPIO_VDD_3V3_SENSORS4_EN from board_config.h
|
||||
// }, {GPIO::PortG, GPIO::Pin8}),
|
||||
initSPIBus(SPI::Bus::SPI5, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortG, GPIO::Pin7})
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI6, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortA, GPIO::Pin15}, SPI::DRDY{GPIO::PortD, GPIO::Pin12}),
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(V5X51, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortH, GPIO::Pin12}),
|
||||
}, {GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIBus(SPI::Bus::SPI3, {
|
||||
initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::PortI, GPIO::Pin8}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}),
|
||||
initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::PortI, GPIO::Pin4}),
|
||||
}, {GPIO::PortE, GPIO::Pin7}),
|
||||
// initSPIBus(SPI::Bus::SPI4, {
|
||||
// // no devices
|
||||
// TODO: if enabled, remove GPIO_VDD_3V3_SENSORS4_EN from board_config.h
|
||||
// }, {GPIO::PortG, GPIO::Pin8}),
|
||||
initSPIBus(SPI::Bus::SPI5, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortG, GPIO::Pin7})
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI6, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortA, GPIO::Pin15}, SPI::DRDY{GPIO::PortD, GPIO::Pin12}),
|
||||
}),
|
||||
}),
|
||||
|
||||
initSPIHWVersion(V5X52, {
|
||||
initSPIBus(SPI::Bus::SPI1, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}),
|
||||
}, {GPIO::PortI, GPIO::Pin11}),
|
||||
initSPIBus(SPI::Bus::SPI2, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortH, GPIO::Pin12}),
|
||||
}, {GPIO::PortD, GPIO::Pin15}),
|
||||
initSPIBus(SPI::Bus::SPI3, {
|
||||
initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}),
|
||||
}, {GPIO::PortE, GPIO::Pin7}),
|
||||
// initSPIBus(SPI::Bus::SPI4, {
|
||||
// // no devices
|
||||
// TODO: if enabled, remove GPIO_VDD_3V3_SENSORS4_EN from board_config.h
|
||||
// }, {GPIO::PortG, GPIO::Pin8}),
|
||||
initSPIBus(SPI::Bus::SPI5, {
|
||||
initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortG, GPIO::Pin7})
|
||||
}),
|
||||
initSPIBusExternal(SPI::Bus::SPI6, {
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortI, GPIO::Pin10}, SPI::DRDY{GPIO::PortD, GPIO::Pin11}),
|
||||
initSPIConfigExternal(SPI::CS{GPIO::PortA, GPIO::Pin15}, SPI::DRDY{GPIO::PortD, GPIO::Pin12}),
|
||||
}),
|
||||
}),
|
||||
};
|
||||
|
||||
static constexpr bool unused = validateSPIConfig(px4_spi_buses_all_hw);
|
||||
|
||||
@@ -7,7 +7,6 @@ CONFIG_DRIVERS_IRLOCK=n
|
||||
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=n
|
||||
CONFIG_MODULES_MC_AUTOTUNE_ATTITUDE_CONTROL=n
|
||||
CONFIG_MODULES_ROVER_POS_CONTROL=n
|
||||
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=n
|
||||
CONFIG_BOARD_TESTING=y
|
||||
CONFIG_DRIVERS_DISTANCE_SENSOR_LIGHTWARE_LASER_SERIAL=y
|
||||
CONFIG_DRIVERS_TEST_PPM=y
|
||||
|
||||
@@ -9,5 +9,3 @@ param set-default BAT2_V_DIV 18.1
|
||||
|
||||
param set-default BAT1_A_PER_V 36.367515152
|
||||
param set-default BAT2_A_PER_V 36.367515152
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2023 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
|
||||
set(PX4_FW_NAME ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_${PX4_BOARD_LABEL}.px4)
|
||||
|
||||
add_custom_target(upload_skynode_usb
|
||||
COMMAND ${PX4_SOURCE_DIR}/Tools/auterion/upload_skynode.sh --file=${PX4_FW_NAME}
|
||||
DEPENDS ${PX4_FW_NAME}
|
||||
COMMENT "Uploading PX4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(upload_skynode_wifi
|
||||
COMMAND ${PX4_SOURCE_DIR}/Tools/auterion/upload_skynode.sh --file=${PX4_FW_NAME} --wifi
|
||||
DEPENDS ${PX4_FW_NAME}
|
||||
COMMENT "Uploading PX4"
|
||||
USES_TERMINAL
|
||||
)
|
||||
@@ -7,6 +7,7 @@ CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS6"
|
||||
CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS4"
|
||||
CONFIG_BOARD_SERIAL_TEL3="/dev/ttyS1"
|
||||
CONFIG_BOARD_SERIAL_EXT2="/dev/ttyS3"
|
||||
CONFIG_DRIVERS_ADC_ADS1115=y
|
||||
CONFIG_DRIVERS_ADC_BOARD_ADC=y
|
||||
CONFIG_DRIVERS_BAROMETER_BMP388=y
|
||||
CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP201XX=y
|
||||
@@ -19,28 +20,32 @@ CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_HEATER=y
|
||||
CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16470=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20602=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20649=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42670P=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM45686=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_IIM42652=y
|
||||
CONFIG_COMMON_INS=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
CONFIG_COMMON_OPTICAL_FLOW=y
|
||||
CONFIG_COMMON_OSD=y
|
||||
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
|
||||
CONFIG_DRIVERS_POWER_MONITOR_INA228=y
|
||||
CONFIG_DRIVERS_POWER_MONITOR_INA238=y
|
||||
CONFIG_DRIVERS_PWM_OUT=y
|
||||
CONFIG_DRIVERS_PX4IO=y
|
||||
CONFIG_COMMON_RC=y
|
||||
CONFIG_DRIVERS_RC_INPUT=y
|
||||
CONFIG_DRIVERS_SAFETY_BUTTON=y
|
||||
CONFIG_DRIVERS_TONE_ALARM=y
|
||||
CONFIG_DRIVERS_UAVCAN=y
|
||||
CONFIG_BOARD_UAVCAN_TIMER_OVERRIDE=2
|
||||
CONFIG_MODULES_AIRSPEED_SELECTOR=y
|
||||
CONFIG_MODULES_BATTERY_STATUS=y
|
||||
CONFIG_MODULES_CAMERA_FEEDBACK=y
|
||||
CONFIG_MODULES_COMMANDER=y
|
||||
CONFIG_MODULES_CONTROL_ALLOCATOR=y
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user