From f76f5e172fc7c177b042df64d6aa040d2864cef3 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Mon, 13 Jun 2016 14:50:28 -0400 Subject: Use a delay loop, so sdram can be initialized from the startup code, before the clock is running. --- stm-sdram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stm-sdram.c b/stm-sdram.c index 0ec8065..52bab98 100644 --- a/stm-sdram.c +++ b/stm-sdram.c @@ -51,7 +51,7 @@ HAL_StatusTypeDef sdram_init(void) static int initialized = 0; if (initialized) { - return; + return HAL_OK; } initialized = 1; @@ -184,6 +184,8 @@ HAL_StatusTypeDef _sdram_init_params(SDRAM_HandleTypeDef *sdram1, SDRAM_HandleTy HAL_StatusTypeDef ok; // status FMC_SDRAM_CommandTypeDef cmd; // command +#define HAL_Delay(n) for (int i = 0; i < 1000 * n; ++i) + /* * enable clocking */ -- cgit v1.2.3