Content originally posted in LPCWare by mdittrich on Mon Feb 04 08:52:00 MST 2013
So I tried running spifi_init() before and after the SDRAM/EMC init routine thinking that might do something the LPC4350 bootloader was doing, but it did not change the behavior, no magic to be found.
I then found that reads from 0x28000000 were not failing (crashing everything) in my reset ISR, and they also did not fail immediately after SDRAM/EMC init, under debugger or not. I found that the crash-on-read only happened after my uart init routine, specifically after a
<code>
LPC_RGU->RESET_CTRL1 = 1ul << 12;
</code>
for UART0. Removing that line allows reads from 0x28000000 to not crash things. All previous tests from my first post were ran after uart init. I had code that polled LPC_RGU->RESET_ACTIVE_STATUS1 & (0x1ul << 12) after the RESET_CTRL1 write, I had code that just waited 100us after it, both would still crash upon SDRAM reads (though UART0 has always worked fine, even without the RGU reset).
I might be doing something wrong, but I didn't find anything in the user manual / errata that warns against something like this. The errata has an IRC calibration issue when at extreme temps (room temp for these tests), and the user manuals says the RGU runs off the IRC. I'm guessing some of my CGU init code might be messing with things?
I was never able to determine the failure mode, my hardfault handler would reliably fire (under debugging or not (kick characters out UART0 in a while(1) when not debugging)) with a precise data bus fault when reading from spifi/0x14000000 before doing a spifi_init(), but I do not get characters for the "0x28000000 read after UART0 RGU reset" case and the failure does not happen when debugging.
I'm curious what I am doing wrong, but will just be avoiding the RGU for the time being (curiously none of the example code in git repo ever uses an RGU reset that I can find).
Thanks,
MD