Skip to content

Add BCubeF745v2 board#32753

Open
pietrosaccone wants to merge 3 commits into
ArduPilot:masterfrom
pietrosaccone:feature/bcubef745v2
Open

Add BCubeF745v2 board#32753
pietrosaccone wants to merge 3 commits into
ArduPilot:masterfrom
pietrosaccone:feature/bcubef745v2

Conversation

@pietrosaccone

@pietrosaccone pietrosaccone commented Apr 12, 2026

Copy link
Copy Markdown

Summary

Add support for the B-CUBE F745 V2 flight controller.

Classification & Testing

  • Checked by a human programmer
  • Tested on hardware
  • Logs available on request

Hardware Testing Description:

  • Configured and successfully compiled with waf for the BCubeF745v2 target.
  • Flashed the bootloader .bin/.hex locally and verified board boots correctly.
  • Checked UART ports communication (MAVLink and GPS on physical pads).
  • Verified I2C bus with an external compass and internal Baro (DPS310).
  • Tested IMU (ICM-42688-P) orientation.
  • Verified motor mapping and DShot output correctly drives ESCs physically wired to the pads.
  • Flight tested on a real multirotor frame; the craft arms, hovers, and flies correctly in Stabilize, Altitude Hold, and Loiter modes.

Description

This Pull Request introduces the hardware definition and bootloader for the B-CUBE F745 V2.

The board features:

  • MCU: STM32F745
  • IMU: Invensense ICM-42688-P (SPI4)
  • Baro: DPS310 (I2C1)
  • OSD: AT7456E (SPI2)
  • Flash: 16MB Blackbox
  • PWM: 6 Outputs (M1-M4 and M6 supporting DShot/Bi-Dir DShot, M5 PWM only)
  • Serial: 6 UARTs (Serial 6 defaulted as RCIN)

Included are the board_types.txt update, hwdef.dat, hwdef-bl.dat, comprehensive README.md (conforming to the ardupilot_wiki board template, listing GPIOs, Timer groups for DShot compatibility, and explicit UART mappings) with board image and bootloaders.

Copilot AI review requested due to automatic review settings April 12, 2026 16:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds ArduPilot ChibiOS hardware/bootloader definitions for the B-CUBE F745 V2 flight controller target.

Changes:

  • Introduces new hwdef.dat / hwdef-bl.dat for BCubeF745v2 (MCU/pins/peripherals, storage, sensors, OSD).
  • Adds board documentation (README.md) describing interfaces, UART mapping, PWM groups, GPIOs, and flashing.
  • Registers a new bootloader artifact and board ID (board_types.txt) for APJ / bootloader builds.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Main board pin/peripheral mapping, sensor/OSD config, DMA priorities, storage/logging flags
libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef-bl.dat Bootloader-specific minimal pin config (USB, LED/buzzer, motor outputs, CS pins)
libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md User-facing board documentation (specs, serial mapping, PWM groups, flashing notes)
Tools/bootloaders/BCubeF745v2_bl.hex Prebuilt bootloader image for the target
Tools/AP_Bootloader/board_types.txt Adds new AP_HW_BCUBEF745V2 board ID mapping

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef-bl.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch 3 times, most recently from 8fb4369 to 68c2ca9 Compare April 13, 2026 11:40
@proficnc

Copy link
Copy Markdown
Contributor

Just a comment on naming.. we love other boards turning up, but "Cube" is well and truly a CubePilot thing, are you able to please rename this before merging?

@pietrosaccone

Copy link
Copy Markdown
Author

Hi @proficnc, I totally understand the concern regarding the 'Cube' naming and CubePilot's branding. However, since the board is commercially sold under this name (link here), I was worried that changing it might make it harder for users to identify. Do you think the current name could be misleading? If so, do you have any suggestions for an alternative that would allow users to identify the hardware correctly without overlapping your naming?

@pietrosaccone pietrosaccone changed the title AP_HAL_ChibiOS: Add support for BCubeF745v2 Add BCubeF745v2 board Apr 20, 2026
@pietrosaccone

Copy link
Copy Markdown
Author

Hi, just a quick update on this PR.

I’ve rebased it on top of the latest master to keep it up to date.

Please let me know if there’s anything I should adjust to help with the review.

Thanks!

@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch from 37f908b to b7a6076 Compare May 10, 2026 20:07
@pietrosaccone

Copy link
Copy Markdown
Author

Hi, just a gentle follow-up on this PR.

@Hwurzburg if you have a chance to take a look, I’d appreciate any feedback.
I’ve already rebased the branch on the latest master and I’m available for any required changes.

Thanks!

@Hwurzburg

Hwurzburg commented May 10, 2026 via email

Copy link
Copy Markdown
Contributor

andyp1per added a commit to fossuav/aap that referenced this pull request May 12, 2026
/hwdef-check reviews a new-board hwdef PR end-to-end: fetches the PR
via gh, makes a temporary worktree, runs deterministic checks (files,
APJ_BOARD_ID, commit structure, hwdef.dat patterns, DMA allocation)
plus a playbook pass, and drafts a review comment for the user to
approve before posting.

Testing against ArduPilot/ardupilot#32753 caught two hwdef-playbook
bugs that the new skill would have propagated:

- Default STM32_ST_USE_TIMER is TIM2 on F1/F3/F4/F7/G4/L4 and TIM5
  on H7 (per libraries/AP_HAL_ChibiOS/hwdef/common/stm32*_mcuconf.h).
  Previous text had the values swapped and conflated "recommendation
  when default conflicts with PWM" with "default", which led the
  reviewer to a false-positive must-fix.

- GPS_DRV_OPTIONS is a single global AP_GPS parameter and the
  "force ublox 115200" bit is 2 (value 4), not 1. Don't recommend
  it on a board where at least one GPS port has DMA — it would
  needlessly throttle the working port.

Permissions added for the skill are scoped: gh pr view/diff/list/
status and rm -f /tmp/* in shared settings; gh pr checkout/comment,
git worktree/fetch/rev-parse/submodule only inside the skill's
allowed-tools so destructive gh and git operations still prompt.
@andyp1per

Copy link
Copy Markdown
Contributor

Automated hwdef review (/hwdef-check)

Worktree: ../ardupilot-hwdef-check-pr32753 · base: origin/master · new board: BCubeF745v2

Build

  • ./waf configure --board BCubeF745v2: pass
  • HAL_ANALOG_PINS resolves: BATT_VOLT_PIN=13, BATT_CURR_PIN=12, RSSI_PIN=15

Must-fix

  • Commit prefixd9edd2d13c "Tools: add board ID for BCubeF745v2" touches only Tools/AP_Bootloader/board_types.txt; per the root playbook (Commit Conventions) and hwdef playbook §6.6 it should be prefixed AP_Bootloader: (e.g. AP_Bootloader: add BCubeF745v2 board ID).
  • README I2C count is wrongREADME.md:27 lists "2 I2C buses (I2C1 and I2C4)", but hwdef.dat only defines I2C_ORDER I2C1 and no I2C4 pins. Either drop I2C4 from the README or add the I2C4 pins.
  • README dataflash size is wrongREADME.md:16 says "16MB Blackbox flash (M25P16…)". M25P16 is 16 Mbit = 2 MByte. Change to 2 MB (or 16 Mbit).
  • README BIDIR claim for M6 is wrongREADME.md:69 claims "Outputs 1-4 and 6 support DShot and Bi-Directional DShot". M6 is TIM5_CH4 alone (no CH3 pair) and is not marked BIDIR in hwdef.dat; it supports DShot but not bi-directional DShot. Adjust the wording (or wire up a TIM5 pair).

Should-fix

  • Stale commenthwdef.dat has # PA10 IO-debug-console near the top, but PA10 is then assigned as USART1_RX (NODMA) further down. Looks like a copy-paste leftover; drop it.
  • Section headers — playbook §10.1 expects # ---------------- MCU & System ---------------- style dividers. The file currently mixes single-line comments only; adding the standard sections would match other recent boards.
  • Battery voltage rangeREADME.md:33 says "3-8S LiPo (11.4V - 36V)". 8S max is 33.6 V; 36 V would imply 9S. Tweak the upper bound.

Notes

  • DMA sharing flagged by the tooling is intentional/unavoidable on F745: SPI1_TX↔TIM1_UP (dataflash logging vs M2/M3 BIDIR DShot pair) and SPI2_TX↔USART3_TX (OSD vs GPS TX). Worth being aware that heavy in-flight logging could contend with motor BIDIR feedback; not a blocker.
  • DEFAULT_SERIAL6_BAUD 115 is set for the RCIN port; RCIN auto-bauds, so this define has no effect — leaving it is harmless but it can be removed.
  • Re-enabling AP_BARO_PROBE_EXTERNAL_I2C_BUSES after minimize_fpv_osd.inc is a deliberate choice — it lets users attach an extra baro to the only I2C bus that already carries the on-board DPS310. Calling out the intent in the comment would help future readers.
  • README/hwdef.dat use both "AT7456E" (README) and "MAX7456_CS" (hwdef pin label); per playbook §6.4 the two are compatible, no change needed.

Generated by Claude via /hwdef-check. Not a substitute for a human review pass.

@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch 3 times, most recently from dfe8889 to b8a0ecb Compare May 12, 2026 11:58
@pietrosaccone

Copy link
Copy Markdown
Author

Hi @andyp1per,
thanks for the review. I have applied all the requested fixes and cleaned up the commit history.
Ready for another look!

@Hwurzburg Hwurzburg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Several issues...pinout/wiring diagram has many conflicts with hwdef:

  • UART2 is shown in image as RC input, not UART 6
  • UART3 is the first GPS, so first system GPS must be marked attached, unless you default its protocol in hwdef to NONE
  • UART7 default protocol should be set to ESCTelemetry
  • UART6 is shown on the DisplayPort connector...whichever UART is actually on that
    connector should have is default protocol set to MSP_DisplayPort
  • I cannot find the RSSI in pin on the image

once these are addressed, I can review the Readme for consistency and required documentation

Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch from b8a0ecb to cc95807 Compare May 12, 2026 20:48
@pietrosaccone pietrosaccone requested a review from Hwurzburg May 12, 2026 20:55
@pietrosaccone

Copy link
Copy Markdown
Author

Hi @Hwurzburg, I have applied all the requested fixes.
Ready for another review.
Thanks

Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md
Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md

@Hwurzburg Hwurzburg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you also need to create a defaults.parm file with:

SERVO7_FUNCTION 120

OSD_TYPE2 5

Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/hwdef.dat
@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch 2 times, most recently from 94cee63 to 312da19 Compare May 25, 2026 21:49
@pietrosaccone

Copy link
Copy Markdown
Author

Hi @Hwurzburg , Thanks for the review! I have applied the requested fixes.

@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch 2 times, most recently from 1242f52 to d0ccdf1 Compare May 25, 2026 21:58
@andyp1per

Copy link
Copy Markdown
Contributor

Automated hwdef review (/hwdef-check)

PR 32753 · base upstream/master · new board BCubeF745v2

Build

  • ./waf configure --board BCubeF745v2: pass

Must-fix

  • defaults.param is misnamed and will not be loaded. Every other hwdef in the tree uses defaults.parm (no second m), and that is the only filename the build system bakes into the firmware. As shipped, SERVO7_FUNCTION 120 (NeoPixel) and OSD_TYPE2 5 (HD MSP DisplayPort) won't be applied on a fresh install - the README advertises both as defaults, so the file rename is required for the docs to be true. Rename to defaults.parm.
  • README PWM/DShot capability disagrees with hwdef:
    • hwdef marks only PWM(3) (PE11/TIM1_CH2) and PWM(4) (PB0/TIM3_CH3) as BIDIR. README claims "Outputs 1-4 support DShot and Bi-Directional DShot" and "5 with DShot and 4 with Bi-Dir DShot". Either add BIDIR to PWM(1) and PWM(2) or correct the README to "outputs 3 and 4 support bi-directional DShot".

Should-fix

  • README "Compass" section: "an exteranl compass can connected" -> "an external compass can be connected".
  • README "Interfaces" lists "1 I2C buses" -> "1 I2C bus".
  • The hwdef comment on PE9 TIM1_CH1 ... # M2 CH1 and CH2 can share ICU Channel for BIDIR reads as a TODO/note rather than a definition. If BIDIR really is supported on PWM(2), enable it; if not, drop the line.
  • ROMFS_WILDCARD libraries/AP_OSD/fonts/font0.bin only ships font0, which is uncommon. If this is a flash-saving choice for this F745 build please add a one-line comment so a future contributor doesn't "fix" it.

Notes

  • The DMA-sharing list (TIM1_UP/SPI1_TX, SPI2_TX/USART3_TX, TIM4_UP/USART2_TX) is expected on F745 - DMA_PRIORITY ADC* USART6* TIM1* TIM3* SPI4* SPI1* plus DMA_NOSHARE SPI4_RX correctly protects the IMU and motor groups.
  • The NODMA on UART7 with the comment about SPI2 conflict is correct (USART3_TX / SPI2_TX share a stream).
  • STM32_LSECLK / STM32_LSEDRV in hwdef-bl.dat are unusual unless RTC is in use; if there's no RTC requirement they can be dropped to keep the bootloader minimal, but they're harmless.
  • Commit structure (AP_Bootloader: / bootloaders: / AP_HAL_ChibiOS: separated) follows the convention. The bootloaders: BcubeF745v2 subject has a casing typo (BcubeF745v2 vs board name BCubeF745v2) - minor.

Generated by Claude via /hwdef-check. Not a substitute for a human review pass.

@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch 2 times, most recently from 990fd57 to 384d951 Compare May 26, 2026 14:45
@pietrosaccone

Copy link
Copy Markdown
Author

Hi @andyp1per , thanks for the review!

I've applied all the requested changes. Regarding outputs 1 and 2 — even though the supplier's datasheet lists them as bi-directional, testing confirmed they actually aren't, so I've removed the related notes from the README.

All other suggestions have been addressed as well.

As for libraries/AP_OSD/fonts/font0.bin, this file is used by include ../include/minimize_fpv_osd.inc to free up usable space, as documented.

@pietrosaccone pietrosaccone requested a review from Hwurzburg May 27, 2026 11:46

@Hwurzburg Hwurzburg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

my changes were either not implemented or were removed....

@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch 2 times, most recently from 5e37107 to 71836ff Compare May 27, 2026 15:06
@pietrosaccone

Copy link
Copy Markdown
Author

I'm sorry, some changes to the hwdef.dat file were missed after the latest review. The other changes had actually been applied.
I've applied latest fix.
Thanks.

@pietrosaccone pietrosaccone requested a review from Hwurzburg May 27, 2026 15:22
@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch from 71836ff to e2eddc6 Compare May 28, 2026 07:27

@Hwurzburg Hwurzburg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

needs unresolved requested changes addressed also

Comment thread libraries/AP_HAL_ChibiOS/hwdef/BCubeF745v2/README.md Outdated
@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch from e2eddc6 to 787d64d Compare May 28, 2026 15:08
@pietrosaccone pietrosaccone requested a review from Hwurzburg May 28, 2026 15:15

@Hwurzburg Hwurzburg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

still did not address all my requested changes! getting a bit tiring

@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch from 787d64d to baead5c Compare May 28, 2026 15:46
@pietrosaccone pietrosaccone force-pushed the feature/bcubef745v2 branch from baead5c to 1d4110a Compare May 28, 2026 16:00
@pietrosaccone

Copy link
Copy Markdown
Author

Sorry, my mistake. Two requested fixes were missed because of a misunderstanding on my side, and another fix was still in staging and had not been pushed yet. I've now addressed everything. Thanks for the review and for your patience.

FLASH_RESERVE_START_KB 0

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why 96?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The STM32F745 has a non-uniform flash sector layout: sectors 0–3 are 16 KB each (64 KB total), sector 4 is 64 KB, and sectors 5–11 are 128 KB each. Since flash erase operates on a full sector at a time, the bootloader and firmware must not share the same sector, otherwise erasing one would wipe the other.
Sectors 0–3 (64 KB) are reserved for the bootloader. The extra 32 KB of padding up to 96 KB acts as a buffer inside sector 4, ensuring the bootloader has room to grow without ever touching the firmware region. The firmware itself starts at sector 5 (0x08020000 = 128 KB), which is a clean sector boundary safe to erase independently.

This is the same for other boards using the same microcontroller, such as BlitzF745 or FlywooF745.

# save some flash
include ../include/minimize_fpv_osd.inc

# minimize_fpv_osd.inc disables external baro probing; re-enable for this board

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why would you do that by default?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I’m using minimize_fpv_osd.inc because there is not enough flash memory available and the build fails otherwise.

I have to re-enable AP_BARO_PROBE_EXTERNAL_I2C_BUSES because, for some reason, when I connect the external compass, it gets detected correctly but the barometer stops working. After several tests, and after looking at how similar issues were handled on other boards, this solution consistently fixes the problem.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Hwurzburg @andyp1per any idea how this all works?!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not a clue...maybe @andyp1per or @tridge does

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.

6 participants