SPRUJF2A March 2026 – March 2026 AM13E23019
The refresh count is based on the external clock speed and the number of rows per bank as well as the refresh period. The RFSH field represents how many external clock cycles remain before an AUTO-REFRESH is required. The normal formula is:
RFSH ≤ (tRefresh_us/ number_rows) / ext_clock_period_µs
A refresh period is normally 64ms, or 64000μs. The number of rows is normally 4096 or 8192. The ext_clock_period is a value expressed in µs and is derived by dividing 1000 by the clock speed expressed in MHz. So, 50MHz is 1000 / 50 = 20ns, or 0.02μs. A typical SDRAM is 4096 rows per bank if the system clock is running at 50MHz with an EPIBAUD register value of 0:
RFSH = (64000 / 4096) / 0.02 = 15.625μs / 0.02μs = 781.25.
The default value in the RFSH field is 750 decimal or 0x2EE to allow for a margin of safety and providing 15μs per refresh. It is important to note that this number must always be smaller or equal to what is required by the above equation. For example, if running the external clock at 25MHz (40ns per clock period), 390 is the highest number that can be used. The external clock can be 25MHz when the system clock is 25MHz or when the system clock is 50MHz and configuring the COUNT0 field in the EPIBAUD register to 1 (divide by 2).
If a number larger than allowed is used, the SDRAM is not refreshed often enough, and data is lost.