aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-06-13 14:50:28 -0400
committerPaul Selkirk <paul@psgd.org>2016-06-13 14:50:28 -0400
commitf76f5e172fc7c177b042df64d6aa040d2864cef3 (patch)
tree66c23a0ea3d158c154df0d92dfcfdac81a657e09
parent2a14d36ebd7bde9a3a6c98871050b14b54598389 (diff)
Use a delay loop, so sdram can be initialized from the startup code, before the clock is running.
-rw-r--r--stm-sdram.c4
1 files changed, 3 insertions, 1 deletions
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
*/