AnsweredAssumed Answered

Why are external SDRAM initializations so different on LPCOpen vs. mbed?

Question asked by Brendan McDonnell on Oct 30, 2017
Latest reply on Nov 13, 2017 by Brendan McDonnell

I'm confused by the difference between initialization routines for an external SDRAM in mbed (EALib) vs. LPCOpen examples. I'm using the Embedded Artists LPC4088 QuickStart Board in MCUXpresso IDE v10.0.2 [Build 411] [2017-07-11]. The board has an external 32 MB SDRAM chip.


One the one hand, you have the mbed-based EALib, in which you're ostensibly supposed to call sdram_init() before using the external SDRAM. (See sdram.cpp.) sdram_init() appears to be setting values in quite a few control registers.


On the other hand, you have the example LPCOpen Software for LPC40xx (direct download link), which runs on the same board, but does almost none of that. Looking at the periph_memtest example in there, we see that only SystemCoreClockUpdate() and Board_Init() are called before accessing the memory. The only commonality between these and EALib's sdram_init() is that there is one control register whose value they both modify (LPC_SYSCTL->PCONP).


Why the discrepancy? How is LPCOpen getting by doing so little? Or why is EALib/mbed doing so much unnecessary stuff?