Skip to content

Fix SDRAM timing setup during initialization#457

Open
pat-rogers wants to merge 1 commit intoAdaCore:masterfrom
pat-rogers:sdram_timing_fixes
Open

Fix SDRAM timing setup during initialization#457
pat-rogers wants to merge 1 commit intoAdaCore:masterfrom
pat-rogers:sdram_timing_fixes

Conversation

@pat-rogers
Copy link
Copy Markdown
Contributor

@pat-rogers pat-rogers commented Mar 24, 2026

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:

  • add new SDRAM constants for the sake of the SDRAM initialization

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
@pat-rogers
Copy link
Copy Markdown
Contributor Author

pat-rogers commented Apr 14, 2026

The change to stm32-board.ads doesn't seem to be taken into account by the CI builder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant