Skip to content

Commit cc47038

Browse files
committed
Support v5X build variants
This adds support for the different implementation variants of the v5X standard.
1 parent 4d55473 commit cc47038

File tree

4 files changed

+78
-13
lines changed

4 files changed

+78
-13
lines changed

boards/px4/fmu-v5x/init/rc.board_sensors

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,52 @@ board_adc start
88
ina226 -X -b 1 -t 1 -k start
99
ina226 -X -b 2 -t 2 -k start
1010

11-
# Internal SPI BMI088
12-
bmi088 -A -R 4 -s start
13-
bmi088 -G -R 4 -s start
11+
if ver hwtypecmp V5X90 V5X91 V5Xa0 V5Xa1
12+
then
13+
#SKYNODE base fmu board orientation
1414

15-
# Internal SPI bus ICM42688p
16-
icm42688p -R 6 -s start
15+
# Internal SPI BMI088
16+
bmi088 -A -R 2 -s start
17+
bmi088 -G -R 2 -s start
1718

18-
# Internal SPI bus ICM-20602 (hard-mounted)
19-
icm20602 -R 10 -s start
19+
# Internal SPI bus ICM42688p
20+
icm42688p -R 4 -s start
2021

21-
# Internal magnetometer on I2c
22-
bmm150 -I start
22+
# Internal SPI bus ICM-20602 (hard-mounted)
23+
icm20602 -R 8 -s start
24+
25+
# Internal magnetometer on I2c
26+
bmm150 -I -R 6 start
27+
28+
else
29+
#FMUv5Xbase board orientation
30+
31+
# Internal SPI BMI088
32+
bmi088 -A -R 4 -s start
33+
bmi088 -G -R 4 -s start
34+
35+
# Internal SPI bus ICM42688p
36+
icm42688p -R 6 -s start
37+
38+
# Internal SPI bus ICM-20602 (hard-mounted)
39+
icm20602 -R 10 -s start
40+
41+
# Internal magnetometer on I2c
42+
bmm150 -I start
43+
44+
fi
2345

2446
# Possible internal Baro
25-
bmp388 -I -a 0x77 start
26-
bmp388 -I start
2747

28-
# Baro on I2C3
29-
ms5611 -X start
48+
# Disable startup of internal baros if param is set to false
49+
if param compare SENS_INT_BARO_EN 1
50+
then
51+
bmp388 -I -a 0x77 start
52+
if ver hwtypecmp V5X91 V5Xa1
53+
then
54+
bmp388 -X -b 2 start
55+
else
56+
bmp388 -I start
57+
fi
58+
59+
fi

boards/px4/fmu-v5x/nuttx-config/scripts/script.ld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ SECTIONS
127127
_einit = ABSOLUTE(.);
128128
} > FLASH_AXIM
129129

130+
/*
131+
* Construction data for parameters.
132+
*/
133+
__param ALIGN(4): {
134+
__param_start = ABSOLUTE(.);
135+
KEEP(*(__param*))
136+
__param_end = ABSOLUTE(.);
137+
} > FLASH_AXIM
130138

131139
.ARM.extab : {
132140
*(.ARM.extab*)

boards/px4/fmu-v5x/src/board_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@
434434

435435
#define BOARD_NUM_IO_TIMERS 5
436436

437+
437438
#define PX4_I2C_BUS_MTD 4,5
438439

439440
__BEGIN_DECLS

boards/px4/fmu-v5x/src/init.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,31 @@ __EXPORT int board_app_initialize(uintptr_t arg)
286286

287287
px4_platform_configure();
288288

289+
int hw_version = board_get_hw_version();
290+
291+
if (hw_version == 0x9 || hw_version == 0xa) {
292+
static MCP23009 mcp23009{3, 0x25};
293+
294+
// No USB
295+
if (hw_version == 0x9) {
296+
// < P8
297+
ret = mcp23009.init(0xf0, 0xf0, 0x0f);
298+
// >= P8
299+
//ret = mcp23009.init(0xf1, 0xf0, 0x0f);
300+
}
301+
302+
if (hw_version == 0xa) {
303+
// < P6
304+
//ret = mcp23009.init(0xf0, 0xf0, 0x0f);
305+
// >= P6
306+
ret = mcp23009.init(0xf1, 0xf0, 0x0f);
307+
}
308+
309+
if (ret != OK) {
310+
led_on(LED_RED);
311+
return ret;
312+
}
313+
}
314+
289315
return OK;
290316
}

0 commit comments

Comments
 (0)