StopWatch_DelayUs function is not correct in LPC1830

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

StopWatch_DelayUs function is not correct in LPC1830

1,141 次查看
kensu
Contributor V

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.

pastedImage_1.png

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

标签 (1)
标记 (2)
0 项奖励
回复
2 回复数

932 次查看
soledad
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

932 次查看
kensu
Contributor V

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

0 项奖励
回复