-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
stm32: add STM32H7 series octospi storage support #12517
Comments
Thanks @nspsck would you be willing to put this into a pull request please? |
@jimmo I'd love to! I tried to create a pull request but it failed the |
My appologies to not following the Git commit conventions, after carefully read Sending pull requests through, I am still not sure how to properly send a pull request, please help me! Thank you very much in advance! |
Your commit messages need to be reformatted and signed-off. See https://github.com/jimmo/git-and-micropython#i-forgot-to-sign-off-a-commit (which is about fixing the sign-off, but will also help you adjust the commit messages) Note that the sign off requires a valid email address. |
Hi, after a extensive trial period, I've reached at the poin Creating a new PR, which then I realise, that I've used github website to modify the code and create the PR, there are also no branches beside origine/master. Is it better to close the pull request and start new according to the guide at this point? |
So, I've started it all over again and this should work now! |
@nspsck You didn't need to close and re-open the PR as you can just keep working on the same branch in your local checkout, but that's fine. Thanks for making the PR. |
Hi, may I also suggest to add a flag called #if defined(MICROPY_HW_RCC_OSPI_CLKSOURCE)
PeriphClkInitStruct.PeriphClockSelection |= RCC_PERIPHCLK_OSPI;
PeriphClkInitStruct.OspiClockSelection = MICROPY_HW_RCC_OSPI_CLKSOURCE;
#endif I have tested this on my port for the STM32H723. The OSPI clock related settings are as below: //PLL1 550MHz system clock.
#define MICROPY_HW_CLK_PLLM (5)
#define MICROPY_HW_CLK_PLLN (110)
#define MICROPY_HW_CLK_PLLP (1)
// This gives 25 / 5 * 110 / 4 =137.5 MHz on PLL1Q.
#define MICROPY_HW_CLK_PLLQ (4)
#define MICROPY_HW_CLK_PLLR (2)
#define MICROPY_HW_CLK_PLLVCI (RCC_PLL1VCIRANGE_2)
#define MICROPY_HW_CLK_PLLVCO (RCC_PLL1VCOWIDE)
#define MICROPY_HW_CLK_PLLFRAC (0)
// PLL2 200MHz for FMC and OSPI. HSE is 25 MHz.
#define MICROPY_HW_CLK_PLL2M (5)
#define MICROPY_HW_CLK_PLL2N (80)
#define MICROPY_HW_CLK_PLL2P (2)
#define MICROPY_HW_CLK_PLL2Q (2)
// OSPI1 can get clock from PLL1Q or PLL2R, this gives 25 / 5 * 80 / 2 = 200 MHz on PLL2R。
#define MICROPY_HW_CLK_PLL2R (2)
#define MICROPY_HW_CLK_PLL2VCI (RCC_PLL2VCIRANGE_2)
#define MICROPY_HW_CLK_PLL2VCO (RCC_PLL2VCOWIDE)
#define MICROPY_HW_CLK_PLL2FRAC (0)
// Source the clock from PLL2R。
#define MICROPY_HW_RCC_OSPI_CLKSOURCE (RCC_OSPICLKSOURCE_PLL2)
// Divide PLL2R by 2. Hence 100 Mhz for the W25Q64 Flash. This worked flawlessly.
#define MICROPY_HW_OSPI_PRESCALER (2) According to the datasheet of the |
This is a suggested solution to add octospi sotrage support to STM32H7 Series MCUs. Affecting STM32H723 and STM32H7B3 MCU.
The changes has been made to these lines of the
octospi.c
file located atports/stm32/octospi.c
.STATIC_AF_OCTOSPI1_XXX
has been changed toSTATIC_AF_OCTOSPIM_P1_XXX
,OCTOSPI_CR_MSEL_Pos
has been changed toOCTOSPI_CR_FSEL_Pos
andOCTOSPI_CR_DMM_Pos
has been changed toOCTOSPI_CR_DQM_Pos
for STM32H7 series, that is, ifSTM32H7
has been defined. These changes shall have no effects on other H7 MCUs since the others doesn't have Octo-SPI interfaces.The changed section is as below:
Also if this solution is accepted, you might want to change something here located in
ports/stm32/boards/STM32H7B3I_DK/mpconfigboard.h
as well. A suggested change/fix for that section is provided according to the manual. After fixing the incorrect pins, the firmware could be built, but I do not own one of this board, so I couldn't test it.IMPORTANT NOTICE: These modifications has only been tested on a WeActStudio.MiniSTM32H723 board with only 4-pins used from the Octo-SPI1. The result has been validated through the following code:
The text was updated successfully, but these errors were encountered: