Content originally posted in LPCWare by rocketdawg on Mon Jan 27 10:28:01 MST 2014
you need to insert NOPs in between the lines of code.
depending upon compiler, some thing like
asm volatile ("mov r0,r0");
will add one clock
EMC_STATICWAITWEN0_bit.WAITWEN = 0xF; //
asm volatile ("mov r0,r0");
asm volatile ("mov r0,r0");
asm volatile ("mov r0,r0");
asm volatile ("mov r0,r0");
EMC_STATICWAITWR0_bit.WAITWR = 0x1F;
will add 4 clocks