Apply corrections that make it possible to disable APPROTECT mechanism
(which is enabled by default in hardware) on the nRF91 Series SiPs.
These are temporary changes supposed to be overwritten by the next
update of MDK.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit disables the array bounds warning (`-Warray-bounds`) for
the `nrf_clock_is_running` function because GCC 12 and above may report
a false positive due to the size of the write access to the memory
address pointed by the `p_clk_src` argument being variable depending on
the value of the `domain` argument.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Keep the line high during the custom instruction transfer. Otherwise,
its low level can be interpreted by the memory chip as an active
HOLD#/RESET# signal and in consequence the memory status can be read
incorrectly.
Add also related notes to descriptions of nrfx_qspi_cinstr_xfer() and
nrfx_qspi_lfm_start() to warn users that the default configuration
provided by NRFX_QSPI_DEFAULT_CINSTR() may not always be suitable.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Some NFC protocols require some of the RFU bits to be set. Cascade bit
is still not settable.
Signed-off-by: Andreas Pettersson <andreaspettersson95@gmail.com>
Out of the box, nrfx_nfct only had the functionality to transmit whole
bytes. Things in many forms of NFC communication depend on specific bit
counts (like ACK/NAKs for particular protocols.) This adds a function
with a signature similar to nrfx_nfct_tx, aptly named nrfx_nfct_bits_tx.
It uses the data_size member of the nrfx_nfct_data_desc_t struct as
the number of bits to send rather than bytes. As such, it also
calculates the byte length of the buffer to provide to the MAXLEN
EasyDMA register based on the number of bits, taking into account bits
that don't fit evenly into the last whole byte.
Signed-off-by: Andreas Pettersson <andreaspettersson95@gmail.com>
The whole pin configuration function in the driver should be skipped
when both GPIO and PSEL skip flags are set, but the code that checks
this condition, despite the comment correctly explaining its purpose,
contains an unwanted negation. This commit fixes this embarrassing
copy-paste mistake.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Add a workaround function for accessing UICR safely without being
affected by nRF9160 errata 7.
This workaround and bug is described in the errata with ID "[7] KMU:
Subsequent accesses between info_mem and main_mem of the flash may not
work properly".
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Depending on the implementation of NRFX_CRITICAL_SECTION_ENTER
the 'channel' variable could be undefined in logging function.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
This is necessary so that next occurence of nrfx_{twi, twim}_enable()
followed by {twi, twim}_xfer() will not raised a NRFX_ERROR_BUSY error.
This could happen when a previous transfer is started but is aborted
using nrfx_{twi, twim}_disable() before the end of the transaction which
calls {twi, twim}_irq_handler().
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
For secure code, the access mode needs to be set for both secure and
non-secure regions. Otherwise, attempts from secure code to write or
erase a region configured as non-secure end up with BusFault.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
In SoCs with TrustZone support, only secure code can access UICR.
When a non-secure target is built, the NRF_UICR symbol is not even
defined.
This commit prevents the NVMC driver from referencing the NRF_UICR
symbol when the driver is compiled for a non-secure target.
Assertions that normally use this symbol for checking if a given
address is valid for an operation on flash will fail in non-secure
code when the supplied address belongs to the UICR region, what is
the expected behavior.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
In the OTP region in nRF91/53, halfwords must be changed with a single
operation (writes are blocked by HW if the current value != 0xFFFF).
Add function for halfwords so that users don't have to do the bitshifts
themselves.
Also, add read support, since UICR doesn't support unaligned accesses.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
With the current assert, writes to UICR, including OTP in nRF91/53
triggers an assert.
Add static functions for checking whether an address is in app flash.
Add function in nrfx_common.h for checking whether an address is in UICR.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
To avoid warnings about providing an argument of type `uint32_t` (which
is `unsigned int`) where a `long unsigned int` one is expected.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This patch declares the member tx_buffer_length of uart_control_block_t
to be a volatile variable. This variable might be set/read by main thread
and also cleared by IRQ context, which might lead to unexpected behaviour
when compiling with high optimization level (LTO + O3).
In certain cases nrfx_uarte_tx_in_progress() needs to always return true. Such
behavior was observed when nrfx was compiled with strong optimizations (-O3).
Marking tx_buffer_length as volatile solved the problem.
Tested on Linux with arm-none-eabi-gcc v8.2.0