Skip to content

Commit e519b69

Browse files
Merge pull request #11693 from sensei-hacker/feature-axisflyingh743pro-target
Add AXISFLYINGH743PRO target
2 parents 3110497 + 27a7bb7 commit e519b69

5 files changed

Lines changed: 287 additions & 17 deletions

File tree

docs/development/Converting Betaflight Targets.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,27 @@ Using the BETAFPVF405 target mentioned above, to create the target now we need t
4040
3. Create a target folder that will be used as the output folder for the `bf2inav.py` script, eg: `inav/src/main/targets/BETAFPVF405`
4141
4. Navigate to the script folder in `inav/src/utils/`
4242
5. `python3 ./bf2inav.py -i config.h -o ../main/target/BETAFPVF405/`
43-
6. Edit generated `target.c` and chose the correct timer definitions to match Betaflight's timer definitions.
43+
6. Edit generated `target.c` and chose the correct timer definitions to match Betaflight's timer definitions for motor, servo, and LED timers (not gyro).
4444
```
4545
timerHardware_t timerHardware[] = {
4646
DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0),
47-
//DEF_TIM(TIM8, CH2N, PB0, TIM_USE_OUTPUT_AUTO, 0, 0),
48-
//DEF_TIM(TIM1, CH2N, PB0, TIM_USE_OUTPUT_AUTO, 0, 0),
49-
5047
DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0),
51-
//DEF_TIM(TIM8, CH3N, PB1, TIM_USE_OUTPUT_AUTO, 0, 0),
52-
//DEF_TIM(TIM1, CH3N, PB1, TIM_USE_OUTPUT_AUTO, 0, 0),
53-
54-
//DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 0),
55-
//DEF_TIM(TIM9, CH2, PA3, TIM_USE_OUTPUT_AUTO, 0, 0),
5648
DEF_TIM(TIM2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 0),
57-
58-
//DEF_TIM(TIM5, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0),
59-
//DEF_TIM(TIM9, CH1, PA2, TIM_USE_OUTPUT_AUTO, 0, 0),
6049
DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0),
6150
6251
DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0),
63-
//DEF_TIM(TIM3, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0),
64-
6552
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0),
6653
67-
//DEF_TIM(TIM3, CH1, PB4, TIM_USE_BEEPER, 0, 0),
6854
6955
DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0),
7056
7157
};
7258
```
73-
In this particular example, PA3, PA2 were changed to match Betaflight's mapping, and the timer PB4 was disabled, due to a timer conflict. Normal channels are prefered over N channels (CH1, over CH1N) or C channels in AT32 architectures.
74-
7. Now update yout build scripts by running `cmake` and build the target you just created. The target name can be checked in the generated `CMakeLists.txt`, but should match the Betaflight target name.
59+
Normal channels are prefered over N channels (CH1, over CH1N) or C channels in AT32 architectures.
60+
61+
The typical value to be set in target.h for DEFAULT_FEATURES is:
62+
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX)
63+
64+
7. Now update your build scripts by running `cmake` and build the target you just created. The target name can be checked in the generated `CMakeLists.txt`, but should match the Betaflight target name.
7565

7666
For information on how to build INAV, check the documents in the [docs/development](https://github.com/iNavFlight/inav/tree/master/docs/development) folder.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target_stm32h743xi(AXISFLYINGH743PRO)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is part of INAV.
3+
*
4+
* INAV is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* INAV is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with INAV. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include <stdint.h>
19+
20+
#include "platform.h"
21+
22+
#include "fc/fc_msp_box.h"
23+
24+
#include "io/piniobox.h"
25+
#include "io/serial.h"
26+
27+
void targetConfiguration(void)
28+
{
29+
pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1;
30+
pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2;
31+
32+
// UART5 is RX-only and hard-wired to ESC telemetry
33+
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART5)].functionMask = FUNCTION_ESCSERIAL;
34+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* This file is part of INAV.
3+
*
4+
* INAV is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* INAV is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with INAV. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include <stdint.h>
19+
20+
#include <platform.h>
21+
#include "drivers/io.h"
22+
#include "drivers/pwm_mapping.h"
23+
#include "drivers/timer.h"
24+
#include "drivers/bus.h"
25+
#include "drivers/sensor.h"
26+
27+
#include "drivers/pwm_output.h"
28+
#include "common/maths.h"
29+
#include "fc/config.h"
30+
31+
// Gyro 1 - ICM42688P on SPI1, tag 0
32+
BUSDEV_REGISTER_SPI_TAG(busdev_gyro1_icm42605, DEVHW_ICM42605, GYRO_1_SPI_BUS, GYRO_1_CS_PIN, GYRO_1_EXTI_PIN, 0, DEVFLAGS_NONE, GYRO_1_ALIGN);
33+
34+
// Gyro 2 - ICM42688P on SPI4, tag 1
35+
BUSDEV_REGISTER_SPI_TAG(busdev_gyro2_icm42605, DEVHW_ICM42605, GYRO_2_SPI_BUS, GYRO_2_CS_PIN, GYRO_2_EXTI_PIN, 1, DEVFLAGS_NONE, GYRO_2_ALIGN);
36+
37+
timerHardware_t timerHardware[] = {
38+
// Motors - DMA1 Stream0-7 (dmaopt 0-7), kept unique per channel so a
39+
// fallback to per-channel DMA (USE_DSHOT_DMAR disabled) still works.
40+
DEF_TIM(TIM8, CH1, PC6, TIM_USE_OUTPUT_AUTO, 0, 0), // M1
41+
DEF_TIM(TIM8, CH2, PC7, TIM_USE_OUTPUT_AUTO, 0, 1), // M2
42+
DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 2), // M3
43+
DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 3), // M4
44+
DEF_TIM(TIM2, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 4), // M5
45+
DEF_TIM(TIM2, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 5), // M6
46+
DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 6), // M7
47+
DEF_TIM(TIM2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 7), // M8
48+
49+
// dmaopt 8 (DMA2 Stream0) is reserved for ADC
50+
DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 9), // S1
51+
DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 10), // S2
52+
DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 11), // S3
53+
DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 12), // S4 - needs USE_DSHOT_DMAR, see target.h
54+
55+
// LED strip - DMA2 Stream5 (dmaopt 13)
56+
DEF_TIM(TIM15, CH1, PE5, TIM_USE_LED, 0, 13), // LED_STRIP_PIN
57+
};
58+
59+
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
/*
2+
* This file is part of INAV.
3+
*
4+
* INAV is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* INAV is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with INAV. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#pragma once
19+
20+
#define TARGET_BOARD_IDENTIFIER "AXHP"
21+
#define USBD_PRODUCT_STRING "AXISFLYINGH743PRO"
22+
23+
#define USE_TARGET_CONFIG
24+
25+
// *************** LED, BEEPER ***************
26+
#define LED0 PD3
27+
#define BEEPER PC13
28+
#define BEEPER_INVERTED
29+
30+
// *************** Gyro / Acc - dual ICM42688P (registered as DEVHW_ICM42605,
31+
// whose WHO_AM_I switch also matches ICM42688P) ***************
32+
#define USE_DUAL_GYRO
33+
#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS // Don't use common busdev descriptors for IMU
34+
#define USE_IMU_ICM42605
35+
36+
// SPI1: Gyro 1
37+
#define USE_SPI
38+
#define USE_SPI_DEVICE_1
39+
#define SPI1_SCK_PIN PA5
40+
#define SPI1_MISO_PIN PA6
41+
#define SPI1_MOSI_PIN PA7
42+
43+
#define GYRO_1_SPI_BUS BUS_SPI1
44+
#define GYRO_1_CS_PIN PC4
45+
#define GYRO_1_EXTI_PIN PA4
46+
#define GYRO_1_ALIGN CW0_DEG
47+
48+
// SPI4: Gyro 2
49+
#define USE_SPI_DEVICE_4
50+
#define SPI4_SCK_PIN PE12
51+
#define SPI4_MISO_PIN PE13
52+
#define SPI4_MOSI_PIN PE14
53+
54+
#define GYRO_2_SPI_BUS BUS_SPI4
55+
#define GYRO_2_CS_PIN PE15
56+
#define GYRO_2_EXTI_PIN PE11
57+
#define GYRO_2_ALIGN CW90_DEG
58+
59+
// Motor/servo DMA note: SERVO4_PIN (PD15/TIM4_CH4) has no per-channel DMAMUX
60+
// request on this MCU; USE_DSHOT_DMAR repoints TIM4_CH4 at the TIM4_UP burst
61+
// request so the channel keeps a valid DMA path. This makes all DSHOT-capable
62+
// outputs use one shared burst DMA stream per timer
63+
#define USE_DSHOT_DMAR
64+
65+
// *************** SPI2: OSD *****************
66+
#define USE_SPI_DEVICE_2
67+
#define SPI2_SCK_PIN PB13
68+
#define SPI2_MISO_PIN PB14
69+
#define SPI2_MOSI_PIN PB15
70+
71+
#define USE_MAX7456
72+
#define MAX7456_SPI_BUS BUS_SPI2
73+
#define MAX7456_CS_PIN PB12
74+
75+
// *************** SPI3: Flash ***************
76+
#define USE_SPI_DEVICE_3
77+
#define SPI3_SCK_PIN PB3
78+
#define SPI3_MISO_PIN PB4
79+
#define SPI3_MOSI_PIN PB5
80+
81+
#define USE_FLASHFS
82+
#define USE_FLASH_M25P16
83+
#define M25P16_SPI_BUS BUS_SPI3
84+
#define M25P16_CS_PIN PD7
85+
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
86+
87+
// *************** I2C1: Mag (external) *********************
88+
#define USE_I2C
89+
#define USE_I2C_DEVICE_1
90+
#define I2C1_SCL PB8
91+
#define I2C1_SDA PB9
92+
93+
#define USE_MAG
94+
#define MAG_I2C_BUS BUS_I2C1
95+
#define USE_MAG_ALL
96+
97+
// *************** I2C2: Baro *********************
98+
#define USE_I2C_DEVICE_2
99+
#define I2C2_SCL PB10
100+
#define I2C2_SDA PB11
101+
102+
#define USE_BARO
103+
#define BARO_I2C_BUS BUS_I2C2
104+
#define USE_BARO_DPS310
105+
106+
// *************** Serial ports *****************************
107+
#define USE_VCP
108+
109+
#define USE_UART1
110+
#define UART1_TX_PIN PB6
111+
#define UART1_RX_PIN PB7
112+
113+
#define USE_UART2
114+
#define UART2_TX_PIN PD5
115+
#define UART2_RX_PIN PD6
116+
117+
#define USE_UART3
118+
#define UART3_TX_PIN PD8
119+
#define UART3_RX_PIN PD9
120+
121+
#define USE_UART4
122+
#define UART4_TX_PIN PC10
123+
#define UART4_RX_PIN PC11
124+
125+
// RX only - hard-wired to ESC telemetry, see config.c
126+
#define USE_UART5
127+
#define UART5_TX_PIN PC12 // Unconnected placeholder: H7 UART5 driver's .af_tx lacks an #ifdef UART5_TX_PIN guard
128+
#define UART5_RX_PIN PD2
129+
130+
#define USE_UART7
131+
#define UART7_TX_PIN PE8
132+
#define UART7_RX_PIN PE7
133+
134+
#define USE_UART8
135+
#define UART8_TX_PIN PE1
136+
#define UART8_RX_PIN PE0
137+
138+
#define SERIAL_PORT_COUNT 8
139+
140+
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX)
141+
#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
142+
#define SERIALRX_PROVIDER SERIALRX_CRSF
143+
#define SERIALRX_UART SERIAL_PORT_USART2
144+
145+
#define GPS_UART SERIAL_PORT_USART8
146+
147+
// Default MSP DisplayPort (HD OSD) port
148+
#define MSP_UART SERIAL_PORT_USART1
149+
150+
#define USE_ESC_SENSOR
151+
152+
// *************** ADC *****************************
153+
#define USE_ADC
154+
#define ADC_INSTANCE ADC1
155+
#define ADC_CHANNEL_1_PIN PC0
156+
#define ADC_CHANNEL_2_PIN PC1
157+
#define VBAT_ADC_CHANNEL ADC_CHN_1
158+
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
159+
160+
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
161+
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
162+
163+
// *************** LED2812 ************************
164+
#define USE_LED_STRIP
165+
#define WS2811_PIN PE5
166+
167+
// *************** PINIO ***************************
168+
#define USE_PINIO
169+
#define USE_PINIOBOX
170+
#define PINIO1_PIN PE2 // VTX PWR box
171+
#define PINIO2_PIN PA8 // CAM 1,2 box
172+
173+
// *************** Blackbox ************************
174+
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
175+
176+
// *************** OTHERS *************************
177+
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
178+
179+
#define TARGET_IO_PORTA 0xffff
180+
#define TARGET_IO_PORTB 0xffff
181+
#define TARGET_IO_PORTC 0xffff
182+
#define TARGET_IO_PORTD 0xffff
183+
#define TARGET_IO_PORTE 0xffff
184+
185+
#define USE_DSHOT
186+
#define MAX_PWM_OUTPUT_PORTS 12

0 commit comments

Comments
 (0)