Update STM32F7xx HAL to v1.3.3#11514
Open
daijoubu wants to merge 9 commits intoiNavFlight:maintenance-10.xfrom
Open
Update STM32F7xx HAL to v1.3.3#11514daijoubu wants to merge 9 commits intoiNavFlight:maintenance-10.xfrom
daijoubu wants to merge 9 commits intoiNavFlight:maintenance-10.xfrom
Conversation
Drop-in replacement of STM32F7xx HAL driver and CMSIS Device headers from STM32CubeF7. Updates from v1.2.2 (2017) to v1.3.3 (2025), incorporating: - 8+ years of bug fixes and errata workarounds - SD card reliability improvements - I2C transmission stalled workaround - UART DMA race condition fixes - USB connection/disconnect handling - ETH receive process rework API verified compatible - no code changes required. Existing HAL config file at src/main/target/stm32f7xx_hal_conf.h remains unchanged. This update is applied on top of DroneCAN integration (PR iNavFlight#11313). Related: iNavFlight#11299 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change __FPU_PRESENT cmake definitions from =1 to =1U in cortex-m7.cmake and cortex-m4f.cmake. The device headers define it as 1U; GCC treats 1 and 1U as different token strings and warns on redefinition. The cmake flag must be kept (CMSIS DSP math library requires it). Fix ART_ACCLERATOR_ENABLE (misspelled) → ART_ACCELERATOR_ENABLE in stm32f7xx_hal_conf.h to avoid redefinition with the legacy alias added in HAL v1.3.3 (stm32_hal_legacy.h:4402). Both warnings repeated across all 528 STM32F7 compilation units and are now fully resolved. MATEKF765SE builds cleanly.
Two vendor files in STM32F7xx HAL v1.3.3 produce -Wunused-parameter warnings that fail CI builds with -DWARNINGS_AS_ERRORS=ON: - stm32f7xx_ll_rcc.h: inline function with unused LPTIMx parameter (fires in every translation unit that includes the header) - stm32f7xx_ll_rcc.c: LL_RCC_GetSPDIFRXClockFreq unused parameter Fix 1: Add SYSTEM_INCLUDE_DIRECTORIES support to add_stm32_executable and target_stm32 in stm32.cmake, and route STM32F7_INCLUDE_DIRS through it in stm32f7.cmake. This causes the HAL/CMSIS include dirs to be added with -isystem, suppressing warnings from vendor headers. Fix 2: Set COMPILE_OPTIONS "-Wno-unused-parameter" on stm32f7xx_ll_rcc.c via set_source_files_properties inside target_stm32f7xx(), scoped to the caller's directory where add_executable() runs.
HAL v1.3.3 changed HAL_CAN_Init() to OR the SyncJumpWidth, TimeSeg1, and TimeSeg2 fields directly into the BTR register, expecting them to be pre-shifted to their correct bit positions (TS1@16, TS2@20, SJW@24). The driver was passing raw 0-based counts (e.g. 6 for 7TQ), which the old HAL would shift internally. With HAL v1.3.3, these unshifted values landed in the BRP prescaler field, producing completely wrong bit timing that caused immediate bus errors and prevented all CAN transmission. Fix: shift the computed timing values to their BTR register positions using the CAN_BTR_TS1_Pos, CAN_BTR_TS2_Pos, and CAN_BTR_SJW_Pos constants before assigning to hcan1.Init.
…ame transfers processCanardTxQueue() was only called once at the top of the state before RX processing. Response frames queued by RX handlers (e.g. GetNodeInfo) were not drained until the next 2ms task cycle. With NodeStatus occupying one of three STM32 CAN TX mailboxes, only two response frames could be sent before the mailboxes filled, preventing multi-frame EOT from being transmitted. Add processCanardTxQueue() after the RX loop and after process1HzTasks() so any frames queued in the same cycle are sent immediately.
Updates CAN current/vbat sources, can_speed allowed values, DRONECAN GPS protocol, and OSD_REFRESH debug mode.
stm32cubef7_extract/cmsis_device_f7 and stm32cubef7_extract/stm32f7xx_hal_driver were tracked as gitlink entries (mode 160000) with an empty .gitmodules, causing CI to fail with "No url found for submodule path" during post-job cleanup. Removed embedded .git directories and re-added the HAL sources as regular tracked files (mode 100644).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the STM32F7xx HAL library from v1.2.2 to v1.3.3 for STM32F7-based flight controllers (e.g. MATEKF765, MATEKF765SE).
Changes
HAL_CAN_AddTxMessagenon-blocking interface, new header object structure)WARNINGS_AS_ERRORSdocs/Settings.mdto reflect CAN-related setting additions (CAN current/vbat sources, DRONECAN GPS protocol,can_speedallowed values)fatal: No url found for submodule patherrorTesting
Tested on MATEKF765SE hardware:
AutoBusOff=ENABLEconfirmed in HAL init; hardware auto-recovers without firmware interventiondronecanUpdate(); transitions handled correctlyTest plan