Skip to main content
Explorer
July 20, 2025
Question

STM32H7 Enabling and disabling FMC

  • July 20, 2025
  • 2 replies
  • 364 views

Hello,

I'm using a specific board where the STM32 cohabit with another "master" device on the parralel bus.

One time the STM32 is the master and "drive" the external RAM and one time the other device "drive" this RAM.

My first thought was to disable the FMC and put all pins in disable (input ?) mode when the STM32 is not the master.

And when the STM32 become the master again, put th GPIO back in alternate mode and re enable the FMC.

Something like this to disable the FMC:

__FMC_DISABLE();
LL_GPIO_SetPinMode(GPIO_FMC_A0_Port,GPIO_FMC_A0_Pin,LL_GPIO_MODE_INPUT);
LL_GPIO_SetPinMode(GPIO_FMC_A1_Port,GPIO_FMC_A1_Pin,LL_GPIO_MODE_INPUT);
.....

 

And to reenable it, something like :

LL_GPIO_SetPinMode(GPIO_FMC_A0_Port,GPIO_FMC_A0_Pin,LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetPinMode(GPIO_FMC_A1_Port,GPIO_FMC_A1_Pin,LL_GPIO_MODE_ALTERNATE);
.....
__FMC_ENABLE();

 

Obviously, if I'm here this is because it's not working as expected...

When the FMC is disabled, the other device canno't access the RAM. Looks like the pins are not released from FMC mode.

This is not an hardware issue because if the FMC is not intialized (MX_FMC_Init() not launched), the other device can access the RAM. And if I didn't try to disable the FMC, the STM32 is always capable of accessing the RAM.

I've searched more than a week or two and canno't find what could be wrong.

Any advice ? I know that my usage could be a little weird but I canno't to otherwise.

Thanks

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    July 21, 2025

    Hello @Alex_J ;

     

    Could you please give more details. What are the references of other device and the external RAM?

     

    Thank you.

    Kaouthar

    Super User
    July 21, 2025

    Setting pins as input will prevent the STM32 from driving them. If something still isn't working, not sure it's on the STM32 side.