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

External SPI flash support on STM32H7 #2085

Open
dsdve opened this issue Feb 24, 2025 · 2 comments
Open

External SPI flash support on STM32H7 #2085

dsdve opened this issue Feb 24, 2025 · 2 comments

Comments

@dsdve
Copy link

dsdve commented Feb 24, 2025

As of now, it seems that the BMP supports writing to external (memory-mapped) SPI flash only on RP2040 targets. Is it feasible to extend this to other targets, specifically STM32H7 (H730 and H750)?

The existing SFDP code appears generic enough, so it seems like this would primarily involve updating the target-specific code with a new flash region and relevant drivers. Of course there are some complications like

  • not having a single consistent Quad/Octo-SPI peripheral on all H7s,
  • possibly having to support varying flash configurations (e.g. singular or parallel/"dual" modes),
  • almost definitely (?) having to support varying pin configurations

I currently have a workaround in place, but if such support was generally desired, I would like to eventually work on implementing it on the BMP.

Any suggestions and hints would be greatly appreciated! :)

@dragonmux
Copy link
Member

This code does work on other targets and is used for interfacing with the i.MXRT SPI Flash, RP2040 and RP2350 SPI Flash, Renesas RZ parts SPI Flash, and the LPC43x0 SPI Flash.

Handling the many possible combinations of SPI peripheral usage on the H7s is the min reason this has not yet been been addressed for those parts - however this should be quite doable as long as you can describe how to operate the SPI peripheral to the BMD SPI interface layer (spi.c) - that will take care of Flash discovery from there.

If you can make the support generic to discovering where the SPI Flash is on a part that has multiple controllers, etc, then this would be quite interesting as this is not the first part that's cropped up where this interest has been shown - the SAMD parts have also had interest shown.

@dsdve
Copy link
Author

dsdve commented Feb 25, 2025

I do not think discovering flash without any additional information is feasible, neither in a generic nor in a target specific way. The only way I can see this working is by trying all possible configurations and selecting those that discover something, but this will also cause unwanted (and more or less catastrophic) side effects if the probed pins are otherwise used on the target board.

On the other hand, passing the peripheral/pin configuration should make this rather easy. If there is no other mechanism intended for this, I can see a target-specific command working quite well. The command would set up the peripheral and pins to the point where the SPI interface layer can handle the rest. This is pretty cumbersome though, and not generic at all.

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

No branches or pull requests

2 participants