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

Add Holybro Pixhawk Pi CM4 Baseboard Support #20086

Merged
merged 10 commits into from
Sep 9, 2022

Conversation

vincentpoont2
Copy link
Member

@vincentpoont2 vincentpoont2 commented Aug 22, 2022

Add Holybro Pixhawk PI CM4 Baseboard Support (FMUvXX VER 4) on FMUv5X and FMUv6X.

@vincentpoont2
Copy link
Member Author

@davids5 Do you see any issue with this PR? I am not sure how to get rid of the Flash overflow to test the FW.

@vincentpoont2
Copy link
Member Author

FMUv5x & 6X Nuttx Auto-build are getting errors. Would you be able to assist us on getting a FW to test this?

@julianoes
Copy link
Contributor

I've rebased an force-pushed this. Hopefully now it doesn't overflow flash.

@vincentpoont2
Copy link
Member Author

Summary
VER = Baseboard REV (Controlled by Resistors on Baseboard)
REV = FMUM REV (Controlled by Resistors on FMUM)

Holybro VER (Both v5x & v6x, because the base should work on both FMUM)
0 = Holybro Standard Base
4 = Holybro Pi CM 4 Baseboard
5 = Holybro Mini-Baseboard

Holybro REV
v5x = 1, 2
v6x = 3, 4

@julianoes
Copy link
Contributor

@dagar I tried to disable the variants which were not shipped. I'm not entirely sure on all the variants out there though.
For now I've commented the variants out but I'm happy to remove them as well, up to you.

uint32_t power_enable_gpio{0}; ///< GPIO (if non-zero) to control the power of the attached devices on this bus (0 means power is off)
int8_t bus{-1}; ///< physical bus number (1, ...) (-1 means this is unused)
Copy link
Contributor

Choose a reason for hiding this comment

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

@dagar let me know if this looks sane.

I could reduce flash by about 3000 bytes by using uint8_t for power_enable_gpio as well as the spi_drdy_gpio_t, and cs_gpio but stuff stopped working, so that probably went too far.

I also wonder whether we should set SPI_BUS_MAX_DEVICES based on the actual configuration somehow to reduce the footprint of this.

Also, some of the SPI configurations are completely identical but given the data structure and constexpr generation we have to duplicate it. Any idea how to work around that?

@julianoes
Copy link
Contributor

@dagar any chance we can merge this, and backport it to 1.3, without passing flash checks?

vincentpoont2 and others added 10 commits September 8, 2022 13:31
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.
@dagar dagar merged commit ed10146 into PX4:main Sep 9, 2022
@julianoes
Copy link
Contributor

Thanks @dagar. I'll backport it to v1.13.

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

Successfully merging this pull request may close these issues.

3 participants