Hi all,
I'm creating a new applicaion using SDK_DelayAtLeastUs, while in it
void SDK_DelayAtLeastUs ( uint32_t delayTime_us,
uint32_t coreClock_Hz
)
coreClock_Hz is nothing but the BOARD_BOOTCLOCKRUN_CORE_CLOCK --> which is by default 600000000U.
Yet the delay is not working as it should. Why is it so? All I'm trying is a simple LED Toggle!!
while(1) {
GPIO_WritePinOutput(GPIO1,9,0);
SDK_DelayAtLeastUs(1000, BOARD_BOOTCLOCKRUN_CORE_CLOCK);
GPIO_WritePinOutput(GPIO1,9,1);
SDK_DelayAtLeastUs(1000, BOARD_BOOTCLOCKRUN_CORE_CLOCK);
}
PS : - GPIO_WritePinOutput works fine though.
Hi @GanesanGuru ,
How do you test it is not working?
I have checked it on my side, it works OK:
My test code is based on the RT1060 SDK led_blinky code,:
int main(void)
{
/* Board pin init */
BOARD_ConfigMPU();
BOARD_InitBootPins();
BOARD_InitBootClocks();
/* Update the core clock */
SystemCoreClockUpdate();
/* Set systick reload value to generate 1ms interrupt */
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}
SDK_DelayAtLeastUs(1000000,BOARD_BOOTCLOCKRUN_CORE_CLOCK);
while (1)
{
/* Delay 1000 ms */
// SysTick_DelayTicks(1000U);
SDK_DelayAtLeastUs(1000000,BOARD_BOOTCLOCKRUN_CORE_CLOCK);
if (g_pinSet)
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 0U);
g_pinSet = false;
}
else
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1U);
g_pinSet = true;
}
}
}
Then the delay is about 1s.
Please note, your import time is us, so, in fact, your code 1ms, if you just check the GPIO with your eye, not the oscilloscope, you will can't find it.
You can test with 1s, then test it again.
Wish it helps you!
Best Regards,
Kerry