2018-02-18 10:46 AM
Hi, I've been dissecting the FMC_SDRAM example that comes with the STM32CubeF4 package. I'm using the STM32F429 Discovery board. The SDRAM chip it has on it is an ISSI IS42S16400J-7TL.
One thing I don't understand are some of the comments in the main.c file of the FMC_SDRAM example with respect to timing configurations. The code sets up the AHB to run at 180 MHz, but a comment in the code says:
/* Timing configuration for 90 MHz of SDRAM clock frequency (180MHz/2) */
I don't understand why they're saying the configuration is for 90 MHz when the clock is configured to 180 MHz.
Additionally, when configuring the SDRAM timings, it will make comments like in the following code:
/* TXSR: min=70ns (6x11.90ns) */
SDRAM_Timing.ExitSelfRefreshDelay = 7; // 7 clock cycles
I have the ISSI IS42S16400J datasheet and understand the 'Exit Self-Refresh to Active Time' is 70 ns. However, I don't understand what is meant by the '
6 x 11.90ns
' comment and how they come up with 7 clock cycles as the setting.At 180 MHz, I would expect a single clock cycle to be 5.55 ns (i.e. 1 second divided by 180,000,000) and therefore the
SDRAM_Timing.ExitSelfRefreshDelay
to get set to 13 clock cycles.Can someone please tell me what I'm misunderstanding here? Thank you.
#stm32-f4 #sdram #fmc ##stm32f429Solved! Go to Solution.
2018-02-18 11:53 AM
The F429-DISCO is using 100 or 133 MHz SDRAM, you can clock that at 90 MHz, not at 180 MHz. The external bus runs at half the CPU speed, the pin drivers aren't rated >100 MHz. You might also note that the SDRAM pins are not configured with the maximum slew-rate settings. The AHB is the internal bus.
1/90 MHz = 11.11 ns
1/84 MHz = 11.90 ns
11.11 * 6 = 66.66, less than 70 ns, and the part wants >= 70ns
So for a 90 MHz bus you'll need 7 clocks cycles, for an 84 MHz one 6 will meet the goals.
A lot of the code comes from the fact that 168 MHz was used in the F4 series, and later bumped to 180 MHz for the F42x parts.
2018-02-18 11:53 AM
The F429-DISCO is using 100 or 133 MHz SDRAM, you can clock that at 90 MHz, not at 180 MHz. The external bus runs at half the CPU speed, the pin drivers aren't rated >100 MHz. You might also note that the SDRAM pins are not configured with the maximum slew-rate settings. The AHB is the internal bus.
1/90 MHz = 11.11 ns
1/84 MHz = 11.90 ns
11.11 * 6 = 66.66, less than 70 ns, and the part wants >= 70ns
So for a 90 MHz bus you'll need 7 clocks cycles, for an 84 MHz one 6 will meet the goals.
A lot of the code comes from the fact that 168 MHz was used in the F4 series, and later bumped to 180 MHz for the F42x parts.
2018-02-19 08:43 PM
Thank you, Clive! Awesome answer as always