Fix SDRAM timing setup during initialization#457
Merged
Conversation
We now compute them from the datasheet constants. Specifically, in procedure Initialize: * ExitSelfRefreshDelay, SelfRefreshTime, and RowCycleDelay were all derived from a single SDRAM_Min_Delay_In_ns constant, collapsing three distinct timing constraints (TXSR, TRAS, TRC) into one value. SelfRefreshTime was also hardcoded to 4 cycles, valid only at 90 MHz SDCLK. * Replace with per-parameter ceiling division over named board constants (SDRAM_TXSR_In_Ns, SDRAM_TRAS_In_Ns, SDRAM_TRC_In_Ns) so each constraint is satisfied independently at any clock frequency. STM32.Board spec: * add new SDRAM constants for the sake of the SDRAM initialization
d595410 to
3015b94
Compare
Contributor
Author
|
@jklmnn The change to stm32-board.ads doesn't seem to be taken into account by the CI builder, so as a result the change to stm32-sdram.adb fails. |
Member
|
F429/F469/F769 previously had a single SDRAM_Min_Delay_In_ns; replace with the same SDRAM_TRAS_In_Ns / SDRAM_TRC_In_Ns / SDRAM_TXSR_In_Ns trio that the shared SDRAM driver expects. F746 comment block reworked to cite the actual on-board part (Micron MT48LC4M32B2B5-6A) and the ST BSP source; tXSR corrected from 70 to 67 to match the Micron datasheet.
jklmnn
requested changes
May 4, 2026
Comment on lines
+138
to
+139
| SDRAM_TRAS_In_Ns : constant := 42; -- TRAS | ||
| SDRAM_TRC_In_Ns : constant := 70; -- TRC |
Member
There was a problem hiding this comment.
These two lines have trailing spaces. Removing these should fix the CI.
Bump copyright year to 2026 on F429/F469/F769 stm32-board.ads Companion to the SDRAM timing edits in this PR; F746 was already at 2026.
ef9ade7 to
dadf476
Compare
jklmnn
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stm32-sdram.adb:
We now compute initialization values from the datasheet constants. Specifically, in procedure Initialize:
ExitSelfRefreshDelay, SelfRefreshTime, and RowCycleDelay were all derived from a single SDRAM_Min_Delay_In_ns constant, improperly collapsing three distinct timing constraints (TXSR, TRAS, TRC) into one value.
SelfRefreshTime was also hardcoded to 4 cycles, valid only at 90 MHz SDCLK.
We replace those with per-parameter ceiling division over named board constants (SDRAM_TXSR_In_Ns, SDRAM_TRAS_In_Ns, SDRAM_TRC_In_Ns) so each constraint is satisfied independently at any clock frequency.
stm32-board.ads: