Hi, I am using StopWatch_DelayUs API to make delay in LPC1830 MCU application.
I use 5us delay, but the measure is ~120us ( to use GPIO high low), it seems this API is not correct.
But if I use the lpc_chip_18xx StopWatch_DelayMs to make "5ms" delay. After measure confirm, it is correct.
Why does the StopWatch_DelayUs not work?
Does LPC1830 not support Us delay?
BTW: my application is debug mode, should I use "release" mode? Does it improve the application performance?
Thanks
Ken
Hi,
Unfortunately I cannot to reproduce your issue. I tested using the blinky example from LPCOpen.
You need to consider the time that the instruction to turn/off the PIN requires, this time is not important when you use a (ms) delay, however when you use a (us) delay then this time it is significant.
I used the OM13076 lpcxpresso 18xx board.
Attached you can find my code.
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sol
Thanks for your checking.
I find the cause about "us delay" problem, if I use LPC1857, it works correctly, and if I use LPC1830 it works NG.
Because the LPC1857 has internal flash and LPC1830 use external flash, I think the instruction fetch is a factor.
After I put the code into SRAM or Config project to Release mode with optimize option, it works correctly.
Thanks
Ken