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

Fix stm32h730 hardcoded target IO #13604

Merged

Conversation

hydra
Copy link
Contributor

@hydra hydra commented Apr 29, 2024

This should be able to be overridden by targets. e.g. ones that use OctoSPI IO data lines 4-7 instead of 0-3.

Some history: Initial H730 targets always had their TARGET_IO_* defines in their target.h files, but these were moved to the STM32H730 target at some point, but this causes compiler errors when the target redefines them.

This should be able to be overridden by targets.  e.g. ones that  use
octospi IO lines 4-7 instead of 0-3.
Copy link

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13604 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

@ledvinap
Copy link
Contributor

@hydra : Strange thing is that IO_TAG(QUADSPI1_BK1_IO0_PIN) even compiles - the code was designed to generate error if such pin is used (pin not in port mask).

@hydra
Copy link
Contributor Author

hydra commented Apr 29, 2024

@hydra : Strange thing is that IO_TAG(QUADSPI1_BK1_IO0_PIN) even compiles - the code was designed to generate error if such pin is used (pin not in port mask).

The target I was testing on, the SPRacingH7EF (betaflight/config#408) while having and using OctoSPI, does not enable the OctoSPI peripheral in BF itself.
That code has been pending for a couple of years, though I'll probably get round to adding support for OctoSPI (on IO4-7) in memory mapped mode + config storage in memory mapped mode + SPI flash for logging, at some point.

@hydra
Copy link
Contributor Author

hydra commented Apr 29, 2024

here's some proof it works:

# version
# Betaflight / STM32H730 (SP7E) 4.5.0 Apr 29 2024 / 14:22:26 (8bce68bb03) MSP API: 1.46
# board: manufacturer_id: SPRO, board_name: SPRACINGH7EF

# status
MCU H730 Clock=520MHz, Vref=3.32V, Core temp=59degC
Stack size: 2048, Stack address: 0x2000f000
Configuration: CONFIGURED, size: 4223, max available: 65536
Devices detected: SPI:2, I2C:0
Gyros detected: gyro 1, gyro 2 locked dma
GYRO=ICM42688P, ACC=ICM42688P
OSD: SPRACINGOSD (30 x 16)
System Uptime: 524 seconds, Current Time: 2024-04-29T13:07:08.746+00:00
CPU:21%, cycle time: 125, GYRO rate: 8000, RX rate: 15, System rate: 9
Voltage: 1168 * 0.01V (3S battery - OK)
I2C Errors: 10
FLASH: JEDEC ID=0x00ef4015 2M
GPS: NOT ENABLED
Arming disable flags: RXLOSS ANGLE CLI MSP NO_ACC_CAL

Binaries for testing, for those that have the H7EF:
betaflight_4.4.0_SPRACINGH7EF_b69371321c.zip

@ledvinap
Copy link
Contributor

@hydra: It was quick grep, so the code is (probably) unused.

Copy link
Contributor

@ledvinap ledvinap left a comment

Choose a reason for hiding this comment

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

This should be revisited if more targets need exclusive pins.
Maybe something like `
#define TARGET_IO_PORTB (0xffff & ~OCTOSPI_RESERVED_PORTB)

@hydra
Copy link
Contributor Author

hydra commented Apr 29, 2024

This should be revisited if more targets need exclusive pins. Maybe something like ` #define TARGET_IO_PORTB (0xffff & ~OCTOSPI_RESERVED_PORTB)

That make make sense at some point in the future. For now this PR's simple change will suffice and will let target authors have the same flexibility they previously had while providing sensible defaults in the base target.

@haslinghuis haslinghuis modified the milestone: 4.6 Apr 29, 2024
@haslinghuis haslinghuis merged commit a000913 into betaflight:master Apr 29, 2024
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants