Skip to content

Commit

Permalink
nrf52: i2c_twim: Fix static 400uA current
Browse files Browse the repository at this point in the history
Hardware error described here:
https://docs.nordicsemi.com/bundle/errata_nRF52832_Rev3/page/ERR/nRF52832/Rev3/latest/anomaly_832_89.html

When using GPIOTE and TWIM and PM_DEVICE, then the device must be
turned off and then on again after suspending, otherwise there is a
constant 400uA current draw.

Signed-off-by: Fabian Pflug <[email protected]>
  • Loading branch information
gumulka committed Oct 9, 2024
1 parent 66ff30e commit 41b8354
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/hal_nordic/nrfx/nrfx_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,10 @@
CONFIG_NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE
#endif

#ifdef CONFIG_NRF52_ANOMALY_89_WORKAROUND
#define NRFX_TWIM_NRF52_ANOMALY_89_WORKAROUND_ENABLED 1
#endif

#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
#include "nrfx_config_bsim.h"
#endif
Expand Down
10 changes: 10 additions & 0 deletions modules/hal_nordic/nrfx/nrfx_config_nrf52832.h
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,16 @@
#define NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0
#endif

/**
* @brief NRFX_TWIM_NRF52_ANOMALY_89_WORKAROUND_ENABLED - Enables nRF52 Anomaly 89 workaround for
* TWIM.
*
* Boolean. Accepted values 0 and 1.
*/
#ifndef NRFX_TWIM_NRF52_ANOMALY_89_WORKAROUND_ENABLED
#define NRFX_TWIM_NRF52_ANOMALY_89_WORKAROUND_ENABLED 0
#endif

/**
* @brief NRFX_TWIM_CONFIG_LOG_LEVEL
*
Expand Down
5 changes: 5 additions & 0 deletions soc/nordic/nrf52/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ if(CONFIG_SOC_NRF52832)
message(WARNING "NRF52_ANOMALY_109_WORKAROUND disabled with SPIS, SPIM, TWIM or PWM enabled. This will occasionally cause the first byte transmitted to be incorrect")
endif()
endif()
if(NOT CONFIG_NRF52_ANOMALY_89_WORKAROUND)
if (CONFIG_NRFX_TWIM AND CONFIG_NRFX_GPIOTE)
message(WARNING "NRF52_ANOMALY_89_WORKAROUND disabled with TWIM and GPIOTE enabled. This can cause a static current draw of 400uA")
endif()
endif()
endif()
10 changes: 10 additions & 0 deletions soc/nordic/nrf52/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,14 @@ config NRF52_ANOMALY_109_WORKAROUND_EGU_INSTANCE
help
EGU instance used by the nRF52 Anomaly 109 workaround for PWM.

config NRF52_ANOMALY_89_WORKAROUND
bool "Anomaly 89 workaround"
default y
depends on SOC_NRF52832
depends on NRFX_TWIM || NRFX_SPIM
depends on NRFX_GPIOTE
help
This helps in reducing the 400uA to 450uA static current consumption when
GPIOTE and TWIM is enabled.

endif # SOC_SERIES_NRF52X
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ manifest:
groups:
- hal
- name: hal_nordic
revision: 4a3ba8eaca8f5255f550db7bc54dc3e23212da64
revision: pull/180/head
path: modules/hal/nordic
groups:
- hal
Expand Down

0 comments on commit 41b8354

Please sign in to comment.