cancel
Showing results for 
Search instead for 
Did you mean: 

Configurations for FMC NOR flash on STM32H7A3

LCris.1
Associate II

HI,

I have a custom board with FMC NOR memory S29GL512S11 controlled by STM32H7A3. I created one external loader to flash the NOR memory and works wells. When I try to use the same configurations with the SYSCLK 280MHz and FMC clock 140MHz I can't have any access to the memory.

I try to find one way to calculate the right timings for both devices to configure the FMC module, but with the memory datasheet and RM0455 I don't understand how I can make the right configuration.

At the moment I have this configuration:

  hnor.Instance  = FMC_NORSRAM_DEVICE;
  hnor.Extended  = FMC_NORSRAM_EXTENDED_DEVICE;
  hnor.Init.NSBank             = FMC_NORSRAM_BANK1;
  //HAL_NOR_MspInit(&hnor); 
  //HAL_NOR_DeInit(&hnor); 
 
  NOR_Timing.AddressSetupTime      = 7;
  NOR_Timing.AddressHoldTime       = 15;
  NOR_Timing.DataSetupTime         = 2;
  NOR_Timing.BusTurnAroundDuration = 3;
  NOR_Timing.CLKDivision           = 16;
  NOR_Timing.DataLatency           = 17;
  NOR_Timing.AccessMode            = FMC_ACCESS_MODE_B;
 
  hnor.Init.NSBank             = FMC_NORSRAM_BANK1;
  hnor.Init.DataAddressMux     = FMC_DATA_ADDRESS_MUX_DISABLE;
  hnor.Init.MemoryType         = FMC_MEMORY_TYPE_NOR;
  hnor.Init.MemoryDataWidth    = NOR_MEMORY_WIDTH;
  hnor.Init.BurstAccessMode    = FMC_BURST_ACCESS_MODE_DISABLE;
  hnor.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
  hnor.Init.WaitSignalActive   = FMC_WAIT_TIMING_BEFORE_WS;
  hnor.Init.WriteOperation     = FMC_WRITE_OPERATION_ENABLE;
  hnor.Init.WaitSignal         = FMC_WAIT_SIGNAL_ENABLE;
  hnor.Init.ExtendedMode       = FMC_EXTENDED_MODE_DISABLE;
  hnor.Init.AsynchronousWait   = FMC_ASYNCHRONOUS_WAIT_DISABLE;
  hnor.Init.WriteBurst         = FMC_WRITE_BURST_DISABLE;
  hnor.Init.ContinuousClock    = FMC_CONTINUOUS_CLOCK_SYNC_ASYNC;
	  hnor.Init.WriteFifo =0x0 ;
  hnor.Init.PageSize = 0x0; 
 
  /* Initialize the NOR controller */
  if(HAL_NOR_Init(&hnor, &NOR_Timing, &NOR_Timing) != HAL_OK)
  {
    /* Initialization Error */
    return 1;
  }
  return 0;

How I can solve this problem?

10 REPLIES 10
Sara BEN HADJ YAHYA
ST Employee

Hello @LCris.1​ ,

According to your ioc file, the FDCAN clock source is PLL1Q so the clock config is supposed to be generated in HAL_FDCAN_MspInit() but in your case, the "Generate Code" option is unchecked in Project Manager -> Advanced Settings so the clock config won't be generated.

0693W00000Lwtt1QAB.pngBy checking the "Generate Code" Option and changing the FDCAN clock source to PLL2Q the clock config will be generated in PeriphCommonClock_Config().

NOTE:

Only peripherals using PLL2, PLL3, PLLSAI1, PLLSAI2 as a source clock are configured in PeriphCommonClock_Config() and only when they are used by more than one peripheral. Otherwise the clock init will be generated in HAL_IPNAME_MspInit or in MX_IPINSTANCE_Init.

I hope this helps 🙂

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.