cancel
Showing results for 
Search instead for 
Did you mean: 

OSPI Clock Configuration on STM32U5A9J-DK

sohm
Associate II

Hi,

I am currently working on configuring the OSPI clock for the STM32U5A9J-DK board, and I have some questions regarding the configuration.

From my understanding, based on the Clock Configuration tab in the STM32CubeIDE (.ioc file), the clock going to the OSPI is 48MHz, which can be derived from either MSLK, SYSCLK, PLL1Q, or PLL2Q. In my case, as shown in the attached image1, the clock source is SYSCLK.

Now, the actual clock output on the CLK pin of OSPI is further divided by the Clock Prescaler. In this particular case, the OSPI clock is SYSCLK/2 = 24MHz (as I have set the prescaler to 2) as attached image2.

In the application, I am using the following initialization:

/* USER CODE END OCTOSPI1_Init 1 */

/* OCTOSPI1 parameter configuration*/

hospi1.Instance = OCTOSPI1;

hospi1.Init.FifoThreshold = 1;

hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;

hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MICRON;

hospi1.Init.DeviceSize = 25;

hospi1.Init.ChipSelectHighTime = 2;

hospi1.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;

hospi1.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;

hospi1.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;

hospi1.Init.ClockPrescaler = 2;

hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;

hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_ENABLE;

hospi1.Init.ChipSelectBoundary = 0;

hospi1.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_USED;

hospi1.Init.MaxTran = 0;

hospi1.Init.Refresh = 0;

if (HAL_OSPI_Init(&hospi1) != HAL_OK)

{

Error_Handler();

}

My question is:
Is it possible to reconfigure the OSPI clock from the application? Specifically, is there any API that allows reconfiguring the
OSPI clock on the fly, without having to reinitialize the entire OSPI with HAL_OSPI_Init()? Or is HAL_OSPI_Init()
the only available option to change the clock settings?

2 REPLIES 2
SofLit
ST Employee

Hello @sohm ,

Please kindly use </> button to paste your code. I'm editing your post than ..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

One could read the Reference Manual and program the peripheral registers directly..

Should be RCC register related to the clocking sources, and dividers in the peripheral itself. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..