EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2

Detailed Description

Implements active wait microsecond delay.

The delay is implemented as a loop coded in assembly. The delay loop must be calibrated by calling UDELAY_Calibrate() once. The calibration algorithm is taken from linux 2.4 sources (bogomips).

The delay is fairly accurate, the assembly coding will not be optimized by the compiler. The delay function should not be used for longer delays than 1000 us. Calling the delay function with > 1000 will give unpredictable results. Recalibrate the loop when HFCORECLK is changed.

The calibration uses the RTC clocked by LFRCO to measure time. Better accuracy can be achieved by adding #define UDELAY_LFXO (i.e. add -DUDELAY_LFXO on the commandline). The LFXO oscillator is then used for delay loop calibration.

The calibration function will restore RTC upon exit.

Functions

void UDELAY_Calibrate (void)
 Calibrates the microsecond delay loop.
 
void UDELAY_Delay (uint32_t usecs)
 Microsecond active wait delay routine. More...
 

Function Documentation

void UDELAY_Delay ( uint32_t  usecs)

Microsecond active wait delay routine.

Note
The delay function should not be used for longer delays than 1000 us. Calling the delay function with > 1000 will give unpredictable results.
Parameters
[in]usecsNumber of microseconds to delay.

Definition at line 284 of file udelay.c.