Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKPORT v1.13] Add Holybro Pixhawk Pi CM4 Baseboard Support #20182

Merged
merged 14 commits into from
Sep 26, 2022

Conversation

julianoes
Copy link
Contributor

Backport of #20086.


if ver hwtypecmp V5X00 V5X01
# V5X010001 ommited because not representable in this hardware format
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is OK - we should ask @Igor-Misic @ThomasDebrunner what ID it is or to reserve it here in the PX4 V5X Spec

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a bad feeling about this, but I'm unsure. We are using V5X010001 (VER 0x10, REV 0x01), that's actually the current gen. Just because VER 0x10 is read from EEPROM (according to the ADC it would be ver 07x), it doesn't change the startup script, right? I believe this would break the build for Skynode

Copy link
Contributor Author

@julianoes julianoes Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicovanduijn so this change is only for the release/v1.13 branch, and will go into v1.13.1. On main this should all be fine. Does that resolve it?

My problem was that I don't know how V5X010001 would map back to the old V5Xabc format.

From what I can see, the counting seems to be 0,1,2,3,...,9,a,10, which would be base 11 which is a bit unusual, but maybe I don't understand it 😄.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's still conted as base16, we just skipped 0b,0c,0d,0e,0f and went to 0x10 after 0x0a to leave space for the remaining resistor space.
e.g. 0x00 - 0x0f : resistors
0x10 - 0xff: eeprom

at least that's my understanding of how it went.
But I can't tell you either how 0x010001 maps to the v5xabc format. I guess that just doesn't work, so we'll have to live with the fact that it won't boot on skynode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, got it, thanks! This is only v1.13, so I assume it doesn't really matter for you/Auterion anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's still conted as base16, we just skipped 0b,0c,0d,0e,0f and went to 0x10 after 0x0a to leave space for the remaining resistor space. e.g. 0x00 - 0x0f : resistors 0x10 - 0xff: eeprom

at least that's my understanding of how it went. But I can't tell you either how 0x010001 maps to the v5xabc format. I guess that just doesn't work, so we'll have to live with the fact that it won't boot on skynode

There are 11 code point that can be read from resistors.
0 - 0xb (0-11) are the values. 0x7 means read the EEPROM
In the EEPROM with current print format the using 3 digits each (see HW_INFO_REV_DIGITS and HW_INFO_VER_DIGITS and
the value are 0x10-0x3E7 (16-999)

Values are displayed and compared in HEX as lllvvvrrr where lll is the label (V5, V6X DH etc) vvv is 3 hex digits for version and rrr is 3 hex digits for revision.

On X series the VER is the Base Board and the Rev is the FMUM.

In the code the #defines for the HW configs may use the abbreviated where thay fit.
#define V5X01 HW_VER_REV(0x0,0x1) that is V5X0000001`
This was done to prevent coupling if we compiled with HW_INFO_xxx_DIGITS 2 or 3 or 5 as the value are still valid.

Copy link
Contributor Author

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self reviewed. I think this is correct.

@dagar
Copy link
Member

dagar commented Sep 10, 2022

We should do a quick check on all these new boards before tagging v1.13.1.

@julianoes
Copy link
Contributor Author

Tested on Pixhawk 6x on CM4 baseboard:

ver all
HW arch: PX4_FMU_V6X
HW type: V6X004004
HW version: 0x004
HW revision: 0x004
FW git-hash: b8fb5dfa517874e193db847854c021bc98381707

3 gyros, 3 accel, 1 mag, 2 baros working

Copy link
Member

@davids5 davids5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julianoes - see inline comments


if ver hwtypecmp V5X00 V5X01
# V5X010001 ommited because not representable in this hardware format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is OK - we should ask @Igor-Misic @ThomasDebrunner what ID it is or to reserve it here in the PX4 V5X Spec

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be dropped. @nicovanduijn Please correct me but the FMUM REV 0 was not shipped other then in prototypes. Once the BMP 388 was moved to i2c2 the FMUM REV e was bumped to 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ that's incorrect, a batch of 40 FMUM REV0 was definitely shipped to early customers. I don't know how many of them are still operational

Copy link
Contributor

@nicovanduijn nicovanduijn Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if this is about being able to support those FMUs (RC13) on the holybro CM4 base board, we can probably ignore it. We shipped out full skynode assemblies and not single FMUs and I believe it to be safe to assume that those will not be mixed with other base boards

boards/px4/fmu-v5x/src/manifest.c Outdated Show resolved Hide resolved
boards/px4/fmu-v5x/src/manifest.c Outdated Show resolved Hide resolved
boards/px4/fmu-v5x/src/manifest.c Outdated Show resolved Hide resolved
boards/px4/fmu-v5x/src/spi.cpp Outdated Show resolved Hide resolved
Comment on lines 231 to 232
//#define V6X50 HW_VER_REV(0x5,0x0) // FMUV6X, HB Mini Rev 0 // never shipped
//#define V6X51 HW_VER_REV(0x5,0x1) // FMUV6X, BMI388 I2C2 HB Mini Rev 1 // never shipped
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for V6X these have to stay for a bit longer

boards/px4/fmu-v6x/src/manifest.c Outdated Show resolved Hide resolved
Comment on lines 166 to 171
//{V6X40, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // HB CM4 base // never shipped
//{V6X41, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2 HB CM4 base // never shipped
{V6X43, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 3
{V6X44, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 4
//{V6X50, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // HB Mini // never shipped
//{V6X51, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // BMP388 moved to I2C2 HB Mini // never shipped
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//{V6X40, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // HB CM4 base // never shipped
//{V6X41, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2 HB CM4 base // never shipped
{V6X43, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 3
{V6X44, hw_mft_list_v0640, arraySize(hw_mft_list_v0640)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 4
//{V6X50, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // HB Mini // never shipped
//{V6X51, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // BMP388 moved to I2C2 HB Mini // never shipped
{V6X40, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // HB CM4 base RC01 FMUM
{V6X41, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // BMP388 moved to I2C2 HB CM4 base RC01 FMUM
{V6X43, hw_mft_list_v0600, arraySize(hw_mft_list_v0600)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 3
{V6X44, hw_mft_list_v0640, arraySize(hw_mft_list_v0600)}, // BMP388 moved to I2C2, HB CM4 base Sensor Set 4
{V6X50, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // HB Mini RC01 FMUM
{V6X51, hw_mft_list_v0650, arraySize(hw_mft_list_v0650)}, // BMP388 moved to I2C2 HB Mini RC01 FMUM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two changes combined seem to only increase flash by 40 bytes or so, so that should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davids5 this suggests to add V6X51 back in but it's not listed in the initSPI below. Does that make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicovanduijn do have any revs greater then RC01 of the V6?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet, but we might in the near future. Is there a community table for the rev and vers for v6x? We should probably also reserve one resistor each to denote " read from EEPROM ". On v5x we have that for ver, but not yet for rev if I'm not mistaken

@@ -84,9 +84,9 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION
}),
}),

initSPIHWVersion(V6X50, {
initSPIHWVersion(V6X43, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add V6X43 and keep V6X50

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that's plus around 700 B of flash, unfortunately.

And note, this PR is just the backport to v1.13.

@julianoes
Copy link
Contributor Author

@davids5 thanks for the review. I have followed your suggestions and added two commits. Note that this is the backport to v1.13, so I have to forwardport 😄 them back to main.

Copy link
Member

@davids5 davids5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this looks good.
@vincentpoont2 have you tested the bases and all the FMUM with all the IMUs versions?

@davids5
Copy link
Member

davids5 commented Sep 14, 2022

@julianoes tested on V6 RC01 HW

sercon: Successfully registered the CDC/ACM serial driver
HW arch: PX4_FMU_V6X
HW type: V6X00
HW version: 0x00000000
HW revision: 0x00000000
FW git-hash: 4ca31bb64ed189863786cc83c53080aaee13f065
FW version: 1.13.0 0 (17629184)
FW git-branch: pr-backport-20086
OS: NuttX
OS version: Release 10.4.0 (168034559)
OS git-hash: 91bece51afbe7da9db12e3695cdbb4f4bba4bc83
Build datetime: Sep 14 2022 11:17:06
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 9.3.1 20200408 (release)
PX4GUID: 00060000000035313536343751050023002a
MCU: STM32H7[4|5]xxx, rev. Y
[hardfault_log] Fault Log is Armed
INFO  [param] selected parameter default file /fs/mtd_params
INFO  [param] importing from '/fs/mtd_params'
INFO  [parameters] BSON document size 1651 bytes, decoded 1651 bytes (INT32:27, FLOAT:51)
INFO  [param] selected parameter backup file /fs/microsd/parameters_backup.bson
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
INFO  [dataman] data manager file '/fs/microsd/dataman' size is 62560 bytes
rgbled #0 on I2C bus 1 (external) address 0x55
Loading airframe: /etc/init.d/airframes/4015_holybro_s500
INFO  [uavcan] Node ID 1, bitrate 1000000
INFO  [px4io] IO FW CRC match
Board sensors: /etc/init.d/rc.board_sensors
INFO  [ina226] Failed to init INA226 on bus 1, but will try again periodically.
ina226 #0 on I2C bus 1 (external) address 0x41
INFO  [ina226] Failed to init INA226 on bus 2, but will try again periodically.
ina226 #1 on I2C bus 2 (external) address 0x41
bmi088_accel #0 on SPI bus 3 rotation 4
bmi088_gyro #0 on SPI bus 3 rotation 4
icm42688p #0 on SPI bus 2 rotation 6
icm20649 #0 on SPI bus 1 rotation 14
bmm150 #0 on I2C bus 4 address 0x10
ist8310 #0 on I2C bus 1 (external) address 0xE rotation 10
bmp388 #0 on I2C bus 4 address 0x77
bmp388 #1 on I2C bus 4 address 0x76

@nicovanduijn
Copy link
Contributor

nicovanduijn commented Sep 15, 2022

Is there a shared table for the ver and rev for v6x somewhere? For v5x I also struggle to find that every time, I feel like this should be somehow in a more visible place. I started maintaining my own for v5x... (which is dumb, I have to admit)
------------ v5x ----------
VER = BASE
[resistors] 0x0000 -> V5x base board
[resistors] 0x0001 -> v5x base without px4io
[resistors] 0x0002 -> Modal AI
[resistors] 0x0003 -> NXP T1 PHY
[resistors] 0x0004 -> HB CM4
[resistors] 0x0005 ->
[resistors] 0x0006 ->
[resistors] 0x0007 -> Use EEPROM
[resistors] 0x0008 -> USB (skynode QS)
[resistors] 0x0009 -> Skynode base RC9 & older (no usb)
[resistors] 0x000a -> No USB Skynode QS
[ EEPROM ] 0x0010 -> Skynode RC11 & up

REV = FMUM
0x0000 -> FMUv5x RC13 (baro on I2C4)
0x0001 -> FMUv5x RC15 (baro on I2C2)
0x0007 -> FMUv5x wild card (scan sensors)

------------- v6x ------------------
TBD

@julianoes
Copy link
Contributor Author

@nicovanduijn should we have some shared Google sheet for that?

@vincentpoont2
Copy link
Contributor

@davids5
Copy link
Member

davids5 commented Sep 15, 2022

It is the HW REV and VER ID tab on the pinouts.

V5X:

image

V6X:
image

@mrpollo - Would you please share the link to the 5x and 6X pinout with comment access

@dagar
Copy link
Member

dagar commented Sep 16, 2022

What's the overall state here? This is a lot of discussion for a simple cherry-picked backport.

@julianoes
Copy link
Contributor Author

@dagar agreed. @davids5 did a thorough review and added a couple of items that I've now addressed, but need to forward port again.

@davids5
Copy link
Member

davids5 commented Sep 20, 2022

@dagar @julianoes - forward port is merged, let's get this in followed by a rebase of #19819

@julianoes
Copy link
Contributor Author

Thanks @davids5, I'm just checking CI again.

@julianoes julianoes force-pushed the pr-backport-20086 branch 2 times, most recently from fa116cb to 24499cf Compare September 23, 2022 05:56
@julianoes julianoes changed the base branch from release/1.13 to pr-fix-device-external-override September 23, 2022 05:56
Base automatically changed from pr-fix-device-external-override to release/1.13 September 23, 2022 08:55
vincentpoont2 and others added 12 commits September 23, 2022 20:57
My assumption is that the bus are numbered < 127.
This saves about 100 bytes of flash.
As I understand it, only Rev 1 and Rev 2 were shipped by HB, and likely
to be used for the Mini and CM4.
As I understand it, only Rev 3 and Rev 4 were shipped by HB for Mini and
CM4, and are likely to be used for it.

It would be nice to have all combinations but it requires quite some
flash in the current implementation.
- Removed commented out config data.
- hw_mft_list_v0540 was the same as hw_mft_list_v0500
- alias from hw_mft_list_v0650 to hw_mft_list_v0600 as it is the same
- add V6X50 again
This fixes the errors showing up at startup for me with a Black Cube.
This was forgotton with all the merges and shuffling previously.
@davids5
Copy link
Member

davids5 commented Sep 26, 2022

@julianoes is this ready to come in now or was there any more you wanted to add?

@julianoes
Copy link
Contributor Author

julianoes commented Sep 26, 2022

@davids5 ok thanks. @vincentpoont2 just tested this on V5X mini as well which was missing until I added the last commit.

I'm merging this now, and then forward porting the commits required for main.
Edit: nevermind, everything seems to be in main already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants