Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding workaround for nrf52 anomaly 89 #180

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions nrfx/drivers/src/nrfx_spim.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,12 @@ void nrfx_spim_uninit(nrfx_spim_t const * p_instance)
}
#endif

#if NRFX_CHECK(NRFX_SPIM_NRF52_ANOMALY_89_WORKAROUND_ENABLED)
p_instance->p_reg->POWER = 0;
p_instance->p_reg->POWER;
p_instance->p_reg->POWER = 1;
#endif

#if NRFX_CHECK(NRFX_PRS_ENABLED)
nrfx_prs_release(p_instance->p_reg);
#endif
Expand Down
5 changes: 5 additions & 0 deletions nrfx/drivers/src/nrfx_twim.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ void nrfx_twim_disable(nrfx_twim_t const * p_instance)

p_cb->int_mask = 0;
nrfy_twim_stop(p_instance->p_twim);
#if NRFX_CHECK(NRFX_TWIM_NRF52_ANOMALY_89_WORKAROUND_ENABLED)
p_instance->p_twim->POWER = 0;
p_instance->p_twim->POWER;
p_instance->p_twim->POWER = 1;
#endif
p_cb->state = NRFX_DRV_STATE_INITIALIZED;
p_cb->busy = false;
NRFX_LOG_INFO("Instance disabled: %d.", p_instance->drv_inst_idx);
Expand Down
8 changes: 6 additions & 2 deletions nrfx/mdk/nrf52.h
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,8 @@ typedef struct { /*!< (@ 0x40003000) SPIM0 Struct
__IM uint32_t RESERVED13[26];
__IOM uint32_t ORC; /*!< (@ 0x000005C0) Over-read character. Character clocked out in
case and over-read of the TXD buffer. */
__IM uint32_t RESERVED15[654];
__IOM uint32_t POWER; /*!< (@ 0x00000FFC) Peripheral power control */
} NRF_SPIM_Type; /*!< Size = 1476 (0x5c4) */


Expand Down Expand Up @@ -1339,7 +1341,9 @@ typedef struct { /*!< (@ 0x40003000) TWIM0 Struct
__IOM TWIM_TXD_Type TXD; /*!< (@ 0x00000544) TXD EasyDMA channel */
__IM uint32_t RESERVED14[13];
__IOM uint32_t ADDRESS; /*!< (@ 0x00000588) Address used in the TWI transfer */
} NRF_TWIM_Type; /*!< Size = 1420 (0x58c) */
__IM uint32_t RESERVED15[668];
__IOM uint32_t POWER; /*!< (@ 0x00000FFC) Peripheral power control */
} NRF_TWIM_Type; /*!< Size = 4096 (0x1000) */



Expand Down Expand Up @@ -2121,7 +2125,7 @@ typedef struct { /*!< (@ 0x4001E000) NVMC Structu
__IM uint32_t READY; /*!< (@ 0x00000400) Ready flag */
__IM uint32_t RESERVED1[64];
__IOM uint32_t CONFIG; /*!< (@ 0x00000504) Configuration register */

union {
__IOM uint32_t ERASEPAGE; /*!< (@ 0x00000508) Register for erasing a page in Code area */
__IOM uint32_t ERASEPCR1; /*!< (@ 0x00000508) Deprecated register - Register for erasing a
Expand Down
18 changes: 18 additions & 0 deletions nrfx/templates/nrfx_config_nrf52832.h
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,15 @@
#define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0
#endif

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

/**
* @brief NRFX_SPIM_CONFIG_LOG_LEVEL
*
Expand Down Expand Up @@ -1353,6 +1362,15 @@
#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