2023-10-25 04:26 AM
Hi All,
I have a 407 connected to an FPGA using the FSMC interface.
When I compile my device configuration from ST Cube, the WaitSignalPolarity value in the MX_FSMC_Init routine is always set to: FSMC_WAIT_SIGNAL_POLARITY_LOW. On my system I need this setting to be FSMC_WAIT_SIGNAL_POLARITY_HIGH, but cannot find a way of setting this value through CubeMX.
Has anyone else found this issue or know how to fix it? Its getting a real pain having to manually update the source code before recompiling.
Kind Regards,
Tony
2023-10-31 08:27 AM - edited 2023-11-15 01:48 AM
Hello @Toneski
Could you please share a screenshot of the FMC peripheral registers?
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.
2023-11-26 03:43 AM
Hi,
How do you mean a screen shot? As a capture from within a debug session or a configuration settings view.
In case you need how the FSMC is setup, I attach the code that I use for configuration:-
hsram1.Init.NSBank = FSMC_NORSRAM_BANK1;
hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_ENABLE;
hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_PSRAM;
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_ENABLE;
hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_HIGH;
hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram1.Init.WriteBurst = FSMC_WRITE_BURST_ENABLE;
hsram1.Init.PageSize = FSMC_PAGE_SIZE_NONE;
This is how I need the FSMC setup. After re-compiling the code from the IDE, I get exactly the same, but with:-
hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
Set.
Applogies for the delay in replying - I've only just noticed.
Regards,
2023-11-28 04:09 AM
Yess @Toneski . This would be helpful to follow up on this case.
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.
2023-11-28 06:12 AM
2023-11-28 06:16 AM
...Another copy, but with BCR1 expanded.
2023-11-29 01:35 AM
Hello @Toneski
Could you check that the memory being used, actually, our controller does not support cross boundary page for Cellular RAM 1.5.
Also, using multiplexed IOs PSRAM, could you please check the address bus A[25,16].
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.
2023-11-29 01:55 AM
Hi @FBL,
I am not using memory through the FSMC (well - none that is directly usable as memory for the CPU) - as per the initial post, I am accessing an FPGA through the FSMC.
Everything I need can be accessed through a 64K page, so I haven't investigated A[25:16] - as long as the FSMC triggers the external chip select when accessing 0x6000xxxx I'm happy.
Everything works fine, except that the WaitSignalPolarity value in the MX_FSMC_Init routine is always set to: FSMC_WAIT_SIGNAL_POLARITY_LOW.
Would it be possible to have this setting to be FSMC_WAIT_SIGNAL_POLARITY_HIGH - I cannot find a way of setting this value through CubeMX.
Does this help at all?
Regards,
Toneski
2023-11-29 05:49 AM - edited 2023-11-29 05:52 AM
Hello again @Toneski
Could you please share your IOC file? For instance, you can force it in user defined code. It should not get changed after regenerating the code.
/* USER CODE BEGIN FSMC_Init 2 */
hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_HIGH;
if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK)
{
Error_Handler( );
}
/* USER CODE END FSMC_Init 2 */
Which CubeIDE version do you use?
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.
2023-11-29 07:06 AM
Hi @FBL,
I thought about setting it within a USER CODE segment, but there isn't one between the value getting set and the call to HAL_SRAM_Init as shown here...
hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_ENABLE;
hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_HIGH;
hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram1.Init.WriteBurst = FSMC_WRITE_BURST_ENABLE;
hsram1.Init.PageSize = FSMC_PAGE_SIZE_NONE;
/* Timing */
Timing.AddressSetupTime = 15;
Timing.AddressHoldTime = 15;
Timing.DataSetupTime = 255;
Timing.BusTurnAroundDuration = 0;
Timing.CLKDivision = 4;
Timing.DataLatency = 2;
Timing.AccessMode = FSMC_ACCESS_MODE_A;
/* ExtTiming */
if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK)
{
Error_Handler( );
}
/* USER CODE BEGIN FSMC_Init 2 */
I am using CubeIDE Version: 1.13.1 - Build: 17479_20230728_0839 (UTC)
I've attached my IOC file...
Regards,
Toneski.