How can I get minimum nanosecond delay with a Nucleo F446RE using a Cortex M4 180 Mhz?
Hi everyone,
I am using a nucleo F446RE using a Cortex M4 180 Mhz, and I have a problem when I try to get nano second delays.
void delay (uint16_t delay)
{
__HAL_TIM_SET_COUNTER(&htim1,0);
while(__HAL_TIM_GET_COUNTER(&htim1)<delay);
}In the main, while(1):
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_1);
delay(1);I used this function to set the delay according to the clock. I set up the APB2 clock corresponding to the timer 1 at 100 MHz, logically the function delay(1) would get me a delay of 10 ns, but the problem is that I only have a minimum value of 530 ns delay.
What would be a better method to get a minimum delay without using assembly language?
