Skip to content

Commit

Permalink
soc: arm: nordic_nrf: unrevert provide custom busy_wait implementations
Browse files Browse the repository at this point in the history
This reverts commit bd24b31.

While the test case failure described in #14186 is associated with the
cycle-based busy-wait implementation, that test is fragile, and fails
less frequently once the incongruence between ticks-per-second and the
32 KiHz RTC clock are resolved.  It also assumes that the system clock
is more stable than the infrastructure underlying the the busy-wait
implementation, which is not necessarily true.

The gross inaccuracies in the standard busy-wait on Nordic described in
issue #11626 justify restoring the custom solution.

As this applies to all Nordic devices, move the setting to the top-level
Kconfig.defconfig.

See: #11626 (comment)

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
  • Loading branch information
pabigot authored and carlescufi committed May 7, 2019
1 parent c76dd1e commit da3f7fe
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions soc/arm/nordic_nrf/Kconfig.defconfig
Expand Up @@ -17,6 +17,9 @@ config SYS_CLOCK_TICKS_PER_SEC
int
default 128

config ARCH_HAS_CUSTOM_BUSY_WAIT
default y

config BUILD_OUTPUT_HEX
default y

Expand Down
12 changes: 12 additions & 0 deletions soc/arm/nordic_nrf/nrf51/soc.c
Expand Up @@ -59,4 +59,16 @@ static int nordicsemi_nrf51_init(struct device *arg)
return 0;
}

#define DELAY_CALL_OVERHEAD_US 2

void z_arch_busy_wait(u32_t time_us)
{
if (time_us <= DELAY_CALL_OVERHEAD_US) {
return;
}

time_us -= DELAY_CALL_OVERHEAD_US;
nrfx_coredep_delay_us(time_us);
}

SYS_INIT(nordicsemi_nrf51_init, PRE_KERNEL_1, 0);
5 changes: 5 additions & 0 deletions soc/arm/nordic_nrf/nrf52/soc.c
Expand Up @@ -81,4 +81,9 @@ static int nordicsemi_nrf52_init(struct device *arg)
return 0;
}

void z_arch_busy_wait(u32_t time_us)
{
nrfx_coredep_delay_us(time_us);
}

SYS_INIT(nordicsemi_nrf52_init, PRE_KERNEL_1, 0);
3 changes: 0 additions & 3 deletions soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.series
Expand Up @@ -12,9 +12,6 @@ source "soc/arm/nordic_nrf/nrf91/Kconfig.defconfig.nrf91*"
config SOC_SERIES
default "nrf91"

config ARCH_HAS_CUSTOM_BUSY_WAIT
default y

config SYS_POWER_MANAGEMENT
default y

Expand Down

0 comments on commit da3f7fe

Please sign in to comment.