Nano second Precision using a hardware timer on STM32L4S5ZI
Hi,
I am working with STM32L4S5ZI MCU and I have a custom board with the same.
I am evaluating the hardware timer and as part of my project I need time in nano seconds for some time constrained work. Right now I am using Timer3 and below is my sample code with which I am able to get the counter value between a start and stop of the timer.
Can I derive the time with nano second precision using these timers on the chip? And I need to do this specifically with a timer and not using any other means like a DWT.
Please let me know if there is a way to do this. Thanks a lot.
int i =1;
regValue = TIM3->CNT;
printf("Timer value %d\n", regValue);
HAL_TIM_Base_Start(&htim3);
printf("Timer cycle %d\n", i);
i++;
HAL_TIM_Base_Stop(&htim3);
regValue = TIM3->CNT;
printf("Timer value %d\n\n", regValue);