Another way to avoid the calibration is to reuse the hardware timer in the busy loop: https://github.com/apache/incubator-nuttx/blob/master/drivers/timers/arch_alarm.c#L60-L74 https://github.com/apache/incubator-nuttx/blob/master/drivers/timers/arch_timer.c#L122-L144
On Thu, Mar 25, 2021 at 11:42 AM Gregory Nutt <spudan...@gmail.com> wrote: > > > Why not call up_udelay or up_mdelay? The arch/soc should provide a best > > implementation for you. > > I was wondering that too. > > Also, as a side note, it is very important to calibrate the delay loop > using in those functions. If the delay loop is properly calibrated, > these can be very accurate (but I suspect most people no longer > calibrate the delay loop). > > There is an app at apps/examples/calib_udelay that can be used to do that. > >