In the function void "SDK_DelayAtLeastUs(uint32_t delayTime_us, uint32_t coreClock_Hz)" the notes state: "If precise delay is needed, please enable DWT delay". This appears to be done by defining SDK_DELAY_USE_DWT and DWT. I don't see these defines documented anywhere. Why isn't DWT enabled by default? Are there any side effects to enabling DWT? Thanks.
How can we enable the DWT option for precise delay ?
I have working on Interfacing the ultra-sonic sensor with i.mx93 (mcimx9352-evk) , In that exactly 10 us we need trigger the pin ?
Because of that i used function like this
void SendTrigPulse(void)
{
RGPIO_PinWrite(BOARD_RGPIO, TRIG_PIN, 1);
SDK_DelayAtLeastUs(10, SystemCoreClock);
RGPIO_PinWrite(BOARD_RGPIO, TRIG_PIN, 0);
}
This delay give incorrect micro second value ?
Thanks in advance!
Hi @michaeldkfowler ,
DWT is a part of ARM debug architecture. You can refer to ARM®v7-M Architecture
Reference Manual for more detail.
If you use DWT to count, the code will read DWT->CYCNT register which increase every CPU clock. You can use DWT to count time. But I think here the default way is enough.
Regards,
Jing