Skip to content

Commit

Permalink
hwdef: added NxtPX4v2
Browse files Browse the repository at this point in the history
Update README.md

Update back view image

HWDEF Remove: define HAL_GPIO_LED_OFF 0

Remove: define HAL_GPIO_LED_OFF 0

Revert "scripts: add NxtPX4v2 to manifest generator"
  • Loading branch information
Minderring committed Apr 18, 2024
1 parent 30990a0 commit 4b270c8
Show file tree
Hide file tree
Showing 7 changed files with 310 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
92 changes: 92 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/NxtPX4v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# NxtPX4v2 Flight Controller

The NxtPX4v2 is an open-source hardware designed and maintened by [HKUST UAV-Group](https://github.com/HKUST-Aerial-Robotics/Nxt-FC). And it is produced by [MicoAir Tech.](http://micoair.com/).

## Features

- STM32H743 microcontroller
- BMI088+BMI088(DUAL) IMU
- SPL06 barometer
- 12V 2.5A BEC; 5V 2.5A BEC
- SDCard
- 7x UART
- 8x PWM
- 1x I2C
- 1x SPI
- 1x SWD

## UART Mapping

- SERIAL0 -> USB
- SERIAL1 -> UART2 (MAVLink2, DMA-enabled)
- SERIAL2 -> UART4 (MAVLink2, DMA-enabled)
- SERIAL3 -> UART1 (GPS, DMA-enabled)
- SERIAL4 -> UART3 (VTX-HD, DMA-enabled)
- SERIAL5 -> UART7 (ESC Telemetry, DMA-enabled)
- SERIAL6 -> UART5 (RCIN, DMA-enabled)
- SERIAL7 -> UART8 (DMA-enabled)

## RC Input

The default RC input is configured on the UART5. The SBUS pin is inverted and connected to RX5. Non SBUS, single wire serial inputs can be directly tied to RX5 if SBUS pin is left unconnected. RC could be applied instead at a different UART port such as UART2, UART4 or UART8, and set the protocol to receive RC data: `SERIALn_PROTOCOL=23` and change SERIAL6 _Protocol to something other than '23'

## VTX Support

The SH1.0-6P connector supports a DJI Air Unit / HD VTX connection. Protocol defaults to DisplayPort. Pin 1 of the connector is 12v so be careful not to connect this to a peripheral requiring 5v.

## PWM Output

The NxtPX4v2 supports up to 8 PWM outputs. All channels support bi-directional DShot.

PWM outputs are grouped and every group must use the same output protocol:

1, 2, 3, 4 are Group1;

5, 6 are Group 2;

7, 8 are Group 3;

## Battery Monitoring

The board has a internal voltage sensor and connections on the ESC connector for an external current sensor input.
The voltage sensor can handle up to 6S LiPo batteries.

The default battery parameters are:

- BATT_MONITOR 4
- BATT_VOLT_PIN 4
- BATT_CURR_PIN 8
- BATT_VOLT_MULT 10.2
- BATT_CURR_SCALE 20.4

## Compass

The NxtPX4v2 does not have a built-in compass, but you can attach an external compass using I2C on the SDA and SCL connector.

## GPIOs

The remaining 3 outputs (labelled AUX1 to AUX3) are the "auxiliary" outputs. These are directly attached to the STM32H743.

The numbering of the GPIOs for PIN variables in ardupilot is:

- AUX1 - PA4 - 81
- AUX2 - PC1 - 82
- AUX3 - PC0 - 83

## Physical

- Mounting: 20 x 20mm, Φ3mm
- Dimensions: 27 x 32 x 8 mm
- Weight: 6.5g

## Ports Connector

![NxtPX4v2 Front View](NxtPX4v2_FrontView.jpg)

![NxtPX4v2 Back View](NxtPX4v2_BackView.jpg)

## Loading Firmware

Initial firmware load can be done with DFU by plugging in USB with the bootloader button pressed. Then you should load the "with_bl.hex" firmware, using your favorite DFU loading tool.

Once the initial firmware is loaded you can update the firmware using any ArduPilot ground station software. Updates should be done with the "*.apj" firmware files.
10 changes: 10 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/NxtPX4v2/defaults.parm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#BATTERY MONITOR ON
BATT_MONITOR 4

#Serial Port defaults
SERIAL4_PROTOCOL 42
SERIAL5_PROTOCOL 16
SERIAL6_PROTOCOL 23

#MSP DisplayPort enable
OSD_TYPE 5
45 changes: 45 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/NxtPX4v2/hwdef-bl.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# hw definition file for processing by chibios_hwdef.py
# for the NxtPX4v2 hardware

# MCU class and specific type
MCU STM32H7xx STM32H743xx

# board ID for firmware load
APJ_BOARD_ID AP_HW_NxtPX4v2

# crystal frequency
OSCILLATOR_HZ 16000000

# flash size
FLASH_SIZE_KB 2048

# bootloader is installed at zero offset
FLASH_RESERVE_START_KB 0

# the location where the bootloader will put the firmware
FLASH_BOOTLOADER_LOAD_KB 128

# default to all pins low to avoid ESD issues
DEFAULTGPIO OUTPUT LOW PULLDOWN

# order of UARTs (and USB)
SERIAL_ORDER OTG1

# USB
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1

# pins for SWD debugging
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD

# CS pins
PA3 BMI088_1_G_CS CS
PA2 BMI088_1_A_CS CS
PC2 BMI088_2_G_CS CS
PC13 BMI088_2_A_CS CS

# LEDs
PD11 LED_ACTIVITY OUTPUT HIGH GPIO(91) #green
PB15 LED_BOOTLOADER OUTPUT HIGH GPIO(92) #blue
define HAL_LED_ON 1
163 changes: 163 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/NxtPX4v2/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# hw definition file for processing by chibios_hwdef.py
# for the NxtPX4v2 hardware

# MCU class and specific type
MCU STM32H7xx STM32H743xx

# board ID for firmware load
APJ_BOARD_ID AP_HW_NxtPX4v2

# crystal frequency
OSCILLATOR_HZ 16000000

# ChibiOS system timer
STM32_ST_USE_TIMER 12
define CH_CFG_ST_RESOLUTION 16

# flash size
FLASH_SIZE_KB 2048
FLASH_RESERVE_START_KB 128

define HAL_STORAGE_SIZE 32768
STORAGE_FLASH_PAGE 14

# default to all pins low to avoid ESD issues
DEFAULTGPIO OUTPUT LOW PULLDOWN

# order of UARTs (and USB)
SERIAL_ORDER OTG1 USART2 UART4 USART1 USART3 UART7 UART5 UART8

# USB
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
PD0 VBUS INPUT OPENDRAIN

# GPS1
PA9 USART1_TX USART1
PA10 USART1_RX USART1

# TELEM1
PD6 USART2_RX USART2
PD5 USART2_TX USART2

# DJI O3
PD8 USART3_TX USART3
PD9 USART3_RX USART3

# TELEM2
PB9 UART4_TX UART4
PB8 UART4_RX UART4

# RC_INPUT
PB13 UART5_TX UART5
PB12 UART5_RX UART5
PD14 SBUS_INV OUTPUT LOW

# ESC
PE7 UART7_RX UART7

# TELEM3
PE0 UART8_RX UART8
PE1 UART8_TX UART8

# SWD
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD

# two I2C bus
I2C_ORDER I2C1 I2C4

# I2C1 - baro
PB6 I2C1_SCL I2C1
PB7 I2C1_SDA I2C1

# I2C4 - CONNECTOR
PD12 I2C4_SCL I2C4
PD13 I2C4_SDA I2C4

# PWM output pins
PE9 TIM1_CH1 TIM1 PWM(1) GPIO(50) BIDIR
PE11 TIM1_CH2 TIM1 PWM(2) GPIO(51)
PE13 TIM1_CH3 TIM1 PWM(3) GPIO(52) BIDIR
PE14 TIM1_CH4 TIM1 PWM(4) GPIO(53)
PB10 TIM2_CH3 TIM2 PWM(5) GPIO(54) BIDIR
PB11 TIM2_CH4 TIM2 PWM(6) GPIO(55)
PB0 TIM3_CH3 TIM3 PWM(7) GPIO(56) BIDIR
PB1 TIM3_CH4 TIM3 PWM(8) GPIO(57)

# GPIOs
PA4 PINIO1 OUTPUT GPIO(81) LOW
PC1 PINIO2 OUTPUT GPIO(82) LOW
PC0 PINIO3 OUTPUT GPIO(83) LOW

# LEDs
PD15 LED_RED OUTPUT HIGH GPIO(90)
PD11 LED_GREEN OUTPUT HIGH GPIO(91)
PB15 LED_BLUE OUTPUT HIGH GPIO(92)

define HAL_GPIO_A_LED_PIN 90
define HAL_GPIO_B_LED_PIN 91
define HAL_GPIO_C_LED_PIN 92

define HAL_GPIO_LED_ON 1
define HAL_HAVE_PIXRACER_LED

# ADC for Power
PC4 BATT_VOLTAGE_SENS ADC1 SCALE(1)
PC5 BATT_CURRENT_SENS ADC2 SCALE(1)

define HAL_BATT_VOLT_PIN 4
define HAL_BATT_CURR_PIN 8
define HAL_BATT_VOLT_SCALE 10.2
define HAL_BATT_CURR_SCALE 20.4

# no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS
define HAL_PROBE_EXTERNAL_I2C_COMPASSES

# microSD support
PC12 SDMMC1_CK SDMMC1
PD2 SDMMC1_CMD SDMMC1
PC8 SDMMC1_D0 SDMMC1
PC9 SDMMC1_D1 SDMMC1
PC10 SDMMC1_D2 SDMMC1
PC11 SDMMC1_D3 SDMMC1
define FATFS_HAL_DEVICE SDCD1

# SPI1 - IMU0
PA5 SPI1_SCK SPI1
PA6 SPI1_MISO SPI1
PA7 SPI1_MOSI SPI1
PA3 BMI088_1_G_CS CS
PA2 BMI088_1_A_CS CS

# SPI3 - CONNECTOR
PB3 SPI3_SCK SPI3
PB4 SPI3_MISO SPI3
PB2 SPI3_MOSI SPI3

# SPI4 - IMU1
PE6 SPI4_MOSI SPI4
PE2 SPI4_SCK SPI4
PE5 SPI4_MISO SPI4
PC2 BMI088_2_G_CS CS
PC13 BMI088_2_A_CS CS

# barometers
BARO SPL06 I2C:0:0x77

# SPI devices
SPIDEV imu0_a SPI1 DEVID1 BMI088_1_A_CS MODE3 10*MHZ 10*MHZ
SPIDEV imu0_g SPI1 DEVID2 BMI088_1_G_CS MODE3 10*MHZ 10*MHZ
SPIDEV imu1_a SPI4 DEVID3 BMI088_2_A_CS MODE3 10*MHZ 10*MHZ
SPIDEV imu1_g SPI4 DEVID4 BMI088_2_G_CS MODE3 10*MHZ 10*MHZ

# 2 IMUs
IMU BMI088 SPI:imu0_a SPI:imu0_g ROTATION_ROLL_180_YAW_90
IMU BMI088 SPI:imu1_a SPI:imu1_g ROTATION_ROLL_180_YAW_90

# enable FAT filesystem support (needs a microSD defined via SDMMC)
define HAL_OS_FATFS_IO 1
define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"

0 comments on commit 4b270c8

Please sign in to comment.