We are using IMXRT1050 EVBK SDK for our project development.
With the help of this SDK API's we have implemented low power mode functionality for our project.
But we are observing constant delay of overall 4.5msec while entering and exiting the system idle mode of the processor when we use API's.
When we investigate further to find the cause of constant delay we observe that the driver level functions in API have few while loops and one SDK_DelayAtLeastUs function which are taking time to execute.
Also for one of driver level function SDK_DelayAtLeastUs() the parameters send as 40 and SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY which is 600000000UL. What we understand from function definition is it will generate delay for 40usec, but when we toggle the GPIO pin before and after this function to measure execution time in debug mode it comes as 1.13msec.
I have attached the documents mentioning the function causing constant delay and delay introduce by them.
can you please let us know whether we can reduce these while loop and SDK_DelayAtLeastUs related delays or are these delay are necessary to implement system idle mode functionality?
Note : To measure execution timings for function and while loop delays we toggeled GPIO pin before entering and after exiting the particular function.
Each of these delays are need it to correct function of the MCU:
DCDC_AdjustTargetVoltage(DCDC, 0xe, 0x1) waits until DCDC output voltage is stable.
ClockSetToOverDriveRun(), the delays here is to wait the PLL to engage and stabilize before continue the execution.
ClockSelectXtalOsc(), in the delays in this function I didn't see SDK_DelayAtLeastUs() API but I found the CLOCK_InitExternalClk() that has some delays that help to engage the crystal.