added changes to max7456.c to add setting speed and removing spi_mod_0 flag with defines from target.h file#11396
Conversation
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
Review Summary by QodoAdd configurable SPI speed and manual mode override for MAX7456
WalkthroughsDescription• Add configurable SPI speed support via MAX7456_SPI_SPEED define • Implement manual SPI mode configuration for STM32H7 targets • Replace hardcoded BUS_SPEED_STANDARD with dynamic speed setting • Support custom hardware configurations without modifying common_hardware Diagramflowchart LR
A["max7456Init"] --> B["max7456ApplyBusSpeed"]
A --> C["max7456SpiModeOverride"]
B --> D["MAX7456_SPI_SPEED define"]
B --> E["BUS_SPEED_STANDARD fallback"]
C --> F["STM32H7 + MAX7456_MANUAL_SPI_CONFIG"]
C --> G["SPI CR1/CFG2 register config"]
File Changes1. src/main/drivers/max7456.c
|
Code Review by Qodo
1.
|
|
Thanks for submitting this! You mentioned "specific STM32H7-based targets" -- any that are currently publicly available? Or is this new hardware you're working on? |
|
Thanks for the review! I have updated the code to address the 2 Qodo bot's points: SPI state and validation. Regarding the Mode 3 override: Without this override, the OSD simply does not initialize on these H7 targets because the bus remains stuck in the default Mode 0 configuration. |
|
Test firmware build ready — commit Download firmware for PR #11396 233 targets built. Find your board's
|
|
The speed part seems reasonable to me. Regarding mode 0 vs mode 3: In the HummingbirdF305 and OmnibusF7 target.c you will see lines like this: BUSDEV_REGISTER_SPI(busdev_max7456, DEVHW_MAX7456, MAX7456_SPI_BUS, MAX7456_CS_PIN, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0); As opposed to: You might try that. It should default to mode 3. |
|
Thanks for pointing those targets out. I tested the registration without DEVFLAGS_SPI_MODE_0 as you suggested, and it works on our H7 hardware. It is definitely a much cleaner approach to handle this issue. I have updated the PR to remove the max7456SpiModeOverride function, but keep max7456ApplyBusSpeed. |
This PR introduces the ability to override default SPI parameters for the MAX7456 OSD chip. These changes are necessary to support specific STM32H7-based targets and custom hardware configurations where the standard DEVFLAGS_SPI_MODE_0 or BUS_SPEED_STANDARD are insufficient or incompatible with the hardware routing.