lpcware

lpcopen v2.10 lpc17xx EMC driver, not working with optimalization

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by wella-tabor on Fri Feb 06 01:39:19 MST 2015
Hello,

during the SDRAM initialization, code in the lpcopen emc driver is behaving faulty after the optimization flags are turned on.

It is caused by the "i" variable. This is not declared as volatile and the compiler deletes the useless! loop.
/*FIXME: if Timer driver is ready, it should replace below "for" delay technic */
for (i = 0; i < 1000; i++) {/* wait 100us */
}
pEMC->DYNAMICCONTROL    = 0x00000183;/* Issue NOP command */

Outcomes