Skip to main content
Associate III
Mar 28, 2026 5:31 PM UTC
Solved

FMC Continuous Mode not working

My FMC clock, set to continuously generated, only cycles during a bus transaction.

On my STM32N657I0H3Q, I have the following setup:

FMC enabled in application
Chip Select NE1
Muxed PSRAM
Data/Address: 16 bits
Clock: Burst Read Write
AddressValid: Yes
Wait: Synchronous

Then, in the configuration, I have "CLK generated continuously" set. 

I have confirmed all of these settings in the resulting fmc.c code. I've also verified at runtime that 

hsram1.Instance->BTCR[FMC_NORSRAM_BANK1] = 0x183997

(Where 1<<20 -- 0x1000000 is continuous clock generation).

Meanwhile, my oscilloscope shows the FMC_CLK waveform:

20.png

Clearly not continuous! 

FA1234Best answer
Associate III
Nov 19, 2026 8:03 AM UTC

Just FYI, this is indeed a bug in the STM32N657 HAL (actually LL, but HAL depends on it) which caused the clock to not run continuously. 

See Drivers/STM32N6xx_HAL_Driver/Src/stm32n6xx_ll_fmc.c in FMC_NORSRAM_Init() and FMC_NORSRAM_Timing_Init() seem to have definitions from the H7 rather than an N6. 

Bottom line, I overrode these with the following code in my fmc.c:

  if (hsram1.Init.ContinuousClock == FMC_CONTINUOUS_CLOCK_SYNC_ASYNC)
{
CLEAR_BIT(FMC_Common_R->CFGR, FMC_CFGR_CCLKEN);
CLEAR_BIT(FMC_Common_R->CFGR, FMC_CFGR_FMCEN);
__DSB();

CLEAR_BIT(FMC_Bank1_R->BTCR[FMC_NORSRAM_BANK1], FMC_BCRx_CSCOUNT);
MODIFY_REG(FMC_Common_R->CFGR, FMC_CFGR_CLKDIV,
(Timing.CLKDivision - 1U) << FMC_CFGR_CLKDIV_Pos);
__DSB();

SET_BIT(FMC_Common_R->CFGR, FMC_CFGR_CCLKEN);
__DSB();
SET_BIT(FMC_Common_R->CFGR, FMC_CFGR_FMCEN);
__DSB();
}


 

4 replies

SMSAD.1
ST Employee
Mar 29, 2026 6:38 PM UTC

Hello FA1234

The “CLK generated continuously” bit: it doesn’t necessarily mean “a free‑running clock forever regardless of activity.” What you’re seeing (CLK toggling only during bus transactions, even with the continuous bit set) is in fact expected in many configurations.

In other words, continuous means “continuous during accesses / bursts,” not “oscillating 24/7 whenever FMC is enabled.”

Best regards

FA1234Author
Associate III
Mar 29, 2026 7:01 PM UTC

Are you sure? This is definitely not the behavior of an STM32H7R3--it toggles continuously, freerunning. 

Also, if your interpretation is correct, what does NOT continuously running mean? There would be no difference--the clock would only toggle during bursts/accesses. So, you're saying that both continuous and not continuous would be identical on the bus?

Can you provide a reference showing that continuous and not continuous are the same thing? Or showing the FMC bus will only toggle the clock during transactions no matter what settings are used? And can you explain why an STM32H7R3 has a continuous clock but the STM32N6 does not?

Thanks for your response!

FA1234AuthorBest answer
Associate III
Nov 19, 2026 8:03 AM UTC

Just FYI, this is indeed a bug in the STM32N657 HAL (actually LL, but HAL depends on it) which caused the clock to not run continuously. 

See Drivers/STM32N6xx_HAL_Driver/Src/stm32n6xx_ll_fmc.c in FMC_NORSRAM_Init() and FMC_NORSRAM_Timing_Init() seem to have definitions from the H7 rather than an N6. 

Bottom line, I overrode these with the following code in my fmc.c:

  if (hsram1.Init.ContinuousClock == FMC_CONTINUOUS_CLOCK_SYNC_ASYNC)
{
CLEAR_BIT(FMC_Common_R->CFGR, FMC_CFGR_CCLKEN);
CLEAR_BIT(FMC_Common_R->CFGR, FMC_CFGR_FMCEN);
__DSB();

CLEAR_BIT(FMC_Bank1_R->BTCR[FMC_NORSRAM_BANK1], FMC_BCRx_CSCOUNT);
MODIFY_REG(FMC_Common_R->CFGR, FMC_CFGR_CLKDIV,
(Timing.CLKDivision - 1U) << FMC_CFGR_CLKDIV_Pos);
__DSB();

SET_BIT(FMC_Common_R->CFGR, FMC_CFGR_CCLKEN);
__DSB();
SET_BIT(FMC_Common_R->CFGR, FMC_CFGR_FMCEN);
__DSB();
}


 

ST Technical Moderator
Nov 19, 2026 1:51 PM UTC

Hello ​@FA1234 

Thank you for bringing this issue to our attention.

I reported this internally.

Internal ticket number: CDM0067634 (This is an internal tracking number and is not accessible or usable by customers).

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om