Skip to content

Commit

Permalink
nrfx_qspi: Correct use of workaround for anomaly 215 and 43 in nrfx_qspi
Browse files Browse the repository at this point in the history
The code that accesses QSPI registers above 0x600 needs to apply
workaround for anomaly 215 on nRF52840 or anomaly 43 on nRF5340.

The commit removes check if a custom instruction long transfer
is ongoing from deactivate function. The check could trigger
anomalies and now it's user responsibility to be sure that custom
instruction long transfer has ended otherwise it will be interrupted.

Change affects behaviour of nrfx_qspi_uinit() and nrfx_qspi_deactivate()
what is mentioned in documentation for that functions.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
  • Loading branch information
Adam Wojasinski authored and awojasinski committed Dec 4, 2023
1 parent f405ecf commit 9784731
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
13 changes: 11 additions & 2 deletions nrfx/drivers/include/nrfx_qspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ nrfx_err_t nrfx_qspi_init(nrfx_qspi_config_t const * p_config,
*/
nrfx_err_t nrfx_qspi_reconfigure(nrfx_qspi_config_t const * p_config);

/** @brief Function for uninitializing the QSPI driver instance. */
/**
* @brief Function for uninitializing the QSPI driver instance.
*
* @note If a custom instruction long transfer is ongoing when the function is called,
* the transfer will be interrupted.
*/
void nrfx_qspi_uninit(void);

/**
Expand All @@ -248,7 +253,11 @@ void nrfx_qspi_uninit(void);
*/
nrfx_err_t nrfx_qspi_activate(bool wait);

/** @brief Function for deactivating the QSPI driver instance.
/**
* @brief Function for deactivating the QSPI driver instance.
*
* @note If a custom instruction long transfer is ongoing when the function is called,
* the transfer will be interrupted.
*
* @retval NRFX_SUCCESS The driver instance has been activated.
* @retval NRFX_ERROR_BUSY The driver is during transaction.
Expand Down
21 changes: 8 additions & 13 deletions nrfx/drivers/src/nrfx_qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,6 @@ static void qspi_deactivate(void)
{
m_cb.activated = false;

if (nrf_qspi_cinstr_long_transfer_is_ongoing(NRF_QSPI))
{
nrf_qspi_cinstr_long_transfer_continue(NRF_QSPI, NRF_QSPI_CINSTR_LEN_1B, true);
}

nrf_qspi_int_disable(NRF_QSPI, NRF_QSPI_INT_READY_MASK);

nrf_qspi_task_trigger(NRF_QSPI, NRF_QSPI_TASK_DEACTIVATE);
Expand Down Expand Up @@ -491,14 +486,6 @@ nrfx_err_t nrfx_qspi_cinstr_xfer(nrf_qspi_cinstr_conf_t const * p_config,
return NRFX_ERROR_TIMEOUT;
}

/* In some cases, only opcode should be sent. To prevent execution, set function code is
* surrounded by an if.
*/
if (p_tx_buffer)
{
nrf_qspi_cinstrdata_set(NRF_QSPI, p_config->length, p_tx_buffer);
}

/* For custom instruction transfer driver has to switch to blocking mode.
* If driver was previously configured to non-blocking mode, interrupts
* will get reenabled before next standard transfer.
Expand All @@ -514,6 +501,14 @@ nrfx_err_t nrfx_qspi_cinstr_xfer(nrf_qspi_cinstr_conf_t const * p_config,
qspi_workaround_apply();
}

/* In some cases, only opcode should be sent. To prevent execution, set function code is
* surrounded by an if.
*/
if (p_tx_buffer)
{
nrf_qspi_cinstrdata_set(NRF_QSPI, p_config->length, p_tx_buffer);
}

m_cb.timeout_signal = false;

nrf_qspi_event_clear(NRF_QSPI, NRF_QSPI_EVENT_READY);
Expand Down

0 comments on commit 9784731

Please sign in to comment.