mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-09 08:35:21 +00:00
Enable by default the use of RAM buffers in the spi_nrfx_spim.c driver for copying TX data located in flash (as SPIM peripherals cannot transfer directly form flash). Without this patch, users can get confused, especially when SPI transaction is used by an upper level driver which does not check all error codes. For size of the buffer, use the value used so far in the reel_board default configuration and in the SPI loopback test, i.e. 8 bytes. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
207 lines
6.9 KiB
Plaintext
207 lines
6.9 KiB
Plaintext
# Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig SPI_NRFX
|
|
bool "nRF SPI nrfx drivers"
|
|
default y
|
|
depends on SOC_FAMILY_NRF
|
|
help
|
|
Enable support for nrfx SPI drivers for nRF MCU series.
|
|
|
|
if SPI_NRFX
|
|
|
|
config SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58
|
|
depends on SOC_NRF52832
|
|
bool "Allow enabling the SPIM driver despite PAN 58"
|
|
help
|
|
Allow enabling the nRF SPI Master with EasyDMA, despite
|
|
Product Anomaly Notice 58 (SPIM: An additional byte is
|
|
clocked out when RXD.MAXCNT == 1 and TXD.MAXCNT <= 1).
|
|
Without this override, the SPI Master is only available
|
|
without EasyDMA. Note that the 'SPIM' and 'SPIS' drivers
|
|
use EasyDMA, while the 'SPI' driver does not. Use this
|
|
option ONLY if you are certain that transactions with
|
|
RXD.MAXCNT == 1 and TXD.MAXCNT <= 1 will NOT be executed.
|
|
|
|
# Workaround for not being able to have commas in macro arguments
|
|
DT_COMPAT_NORDIC_NRF_SPI := nordic,nrf-spi
|
|
DT_COMPAT_NORDIC_NRF_SPIM := nordic,nrf-spim
|
|
DT_COMPAT_NORDIC_NRF_SPIS := nordic,nrf-spis
|
|
|
|
config SPI_0_NRF_SPI
|
|
def_bool $(dt_nodelabel_has_compat,spi0,$(DT_COMPAT_NORDIC_NRF_SPI))
|
|
select NRFX_SPI0
|
|
help
|
|
Enable nRF SPI Master without EasyDMA on port 0.
|
|
|
|
config SPI_0_NRF_SPIM
|
|
def_bool $(dt_nodelabel_has_compat,spi0,$(DT_COMPAT_NORDIC_NRF_SPIM))
|
|
# This driver is not available for nRF52832 because of Product Anomaly 58
|
|
# (SPIM: An additional byte is clocked out when RXD.MAXCNT == 1 and TXD.MAXCNT <= 1)
|
|
# Allow the 'EasyDMA' driver only if this automatic safety-disable is overridden
|
|
depends on (!SOC_NRF52832 || SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58)
|
|
select NRFX_SPIM0
|
|
help
|
|
Enable nRF SPI Master with EasyDMA on port 0.
|
|
|
|
config SPI_0_NRF_SPIS
|
|
def_bool $(dt_nodelabel_has_compat,spi0,$(DT_COMPAT_NORDIC_NRF_SPIS))
|
|
depends on SPI_SLAVE
|
|
select NRFX_SPIS0
|
|
help
|
|
Enable nRF SPI Slave with EasyDMA on port 0.
|
|
Due to hardware limitations the implementation supports only simple
|
|
buffers (consisting of one part) located in RAM.
|
|
|
|
config SPI_0_NRF_ORC
|
|
hex "SPI Port 0 over-read character"
|
|
depends on SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS
|
|
range 0x00 0xff
|
|
default 0xff
|
|
help
|
|
Over-read character. Character clocked out after an over-read
|
|
of the transmit buffer.
|
|
|
|
config SPI_1_NRF_SPI
|
|
def_bool $(dt_nodelabel_has_compat,spi1,$(DT_COMPAT_NORDIC_NRF_SPI))
|
|
select NRFX_SPI1
|
|
help
|
|
Enable nRF SPI Master without EasyDMA on port 1.
|
|
|
|
config SPI_1_NRF_SPIM
|
|
def_bool $(dt_nodelabel_has_compat,spi1,$(DT_COMPAT_NORDIC_NRF_SPIM))
|
|
# This driver is not available for nRF52832 because of Product Anomaly 58
|
|
# (SPIM: An additional byte is clocked out when RXD.MAXCNT == 1 and TXD.MAXCNT <= 1)
|
|
# Allow the 'EasyDMA' driver only if this automatic safety-disable is overridden
|
|
depends on (!SOC_NRF52832 || SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58)
|
|
select NRFX_SPIM1
|
|
help
|
|
Enable nRF SPI Master with EasyDMA on port 1.
|
|
|
|
config SPI_1_NRF_SPIS
|
|
def_bool $(dt_nodelabel_has_compat,spi1,$(DT_COMPAT_NORDIC_NRF_SPIS))
|
|
depends on SPI_SLAVE
|
|
select NRFX_SPIS1
|
|
help
|
|
Enable nRF SPI Slave with EasyDMA on port 1.
|
|
Due to hardware limitations the implementation supports only simple
|
|
buffers (consisting of one part) located in RAM.
|
|
|
|
config SPI_1_NRF_ORC
|
|
hex "SPI Port 1 over-read character"
|
|
depends on SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS
|
|
range 0x00 0xff
|
|
default 0xff
|
|
help
|
|
Over-read character. Character clocked out after an over-read
|
|
of the transmit buffer.
|
|
|
|
config SPI_2_NRF_SPI
|
|
def_bool $(dt_nodelabel_has_compat,spi2,$(DT_COMPAT_NORDIC_NRF_SPI))
|
|
select NRFX_SPI2
|
|
help
|
|
Enable nRF SPI Master without EasyDMA on port 2.
|
|
|
|
config SPI_2_NRF_SPIM
|
|
def_bool $(dt_nodelabel_has_compat,spi2,$(DT_COMPAT_NORDIC_NRF_SPIM))
|
|
# This driver is not available for nRF52832 because of Product Anomaly 58
|
|
# (SPIM: An additional byte is clocked out when RXD.MAXCNT == 1 and TXD.MAXCNT <= 1)
|
|
# Allow the 'EasyDMA' driver only if this automatic safety-disable is overridden
|
|
depends on (!SOC_NRF52832 || SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58)
|
|
select NRFX_SPIM2
|
|
help
|
|
Enable nRF SPI Master with EasyDMA on port 2.
|
|
|
|
config SPI_2_NRF_SPIS
|
|
def_bool $(dt_nodelabel_has_compat,spi2,$(DT_COMPAT_NORDIC_NRF_SPIS))
|
|
depends on SPI_SLAVE
|
|
select NRFX_SPIS2
|
|
help
|
|
Enable nRF SPI Slave with EasyDMA on port 2.
|
|
Due to hardware limitations the implementation supports only simple
|
|
buffers (consisting of one part) located in RAM.
|
|
|
|
config SPI_2_NRF_ORC
|
|
hex "SPI Port 2 over-read character"
|
|
depends on SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS
|
|
range 0x00 0xff
|
|
default 0xff
|
|
help
|
|
Over-read character. Character clocked out after an over-read
|
|
of the transmit buffer.
|
|
|
|
config SPI_3_NRF_SPIM
|
|
def_bool $(dt_nodelabel_has_compat,spi3,$(DT_COMPAT_NORDIC_NRF_SPIM))
|
|
select NRFX_SPIM3
|
|
help
|
|
Enable nRF SPI Master with EasyDMA on port 3.
|
|
|
|
config SPI_3_NRF_SPIS
|
|
def_bool $(dt_nodelabel_has_compat,spi3,$(DT_COMPAT_NORDIC_NRF_SPIS))
|
|
depends on SPI_SLAVE
|
|
select NRFX_SPIS3
|
|
help
|
|
Enable nRF SPI Slave with EasyDMA on port 3.
|
|
Due to hardware limitations the implementation supports only simple
|
|
buffers (consisting of one part) located in RAM.
|
|
|
|
config SPI_3_NRF_ORC
|
|
hex "SPI Port 3 over-read character"
|
|
depends on SPI_3_NRF_SPIM || SPI_3_NRF_SPIS
|
|
range 0x00 0xff
|
|
default 0xff
|
|
help
|
|
Over-read character. Character clocked out after an over-read
|
|
of the transmit buffer.
|
|
|
|
config SPI_3_NRF_RX_DELAY
|
|
int "SPIM3 MISO sampling delay"
|
|
depends on SPI_3_NRF_SPIM && (SOC_NRF52833 || SOC_NRF52840)
|
|
range 0 7
|
|
default 2
|
|
help
|
|
Number of 64 MHz clock cycles (15.625 ns) delay from the sampling
|
|
edge of SCK (leading or trailing, depending on the CPHA setting used)
|
|
until the input serial data on MISO is actually sampled.
|
|
|
|
config SPI_4_NRF_SPIM
|
|
def_bool $(dt_nodelabel_has_compat,spi4,$(DT_COMPAT_NORDIC_NRF_SPIM))
|
|
select NRFX_SPIM4
|
|
help
|
|
Enable nRF SPI Master with EasyDMA on port 4.
|
|
|
|
config SPI_4_NRF_ORC
|
|
hex "SPI Port 4 over-read character"
|
|
depends on SPI_4_NRF_SPIM
|
|
range 0x00 0xff
|
|
default 0xff
|
|
help
|
|
Over-read character. Character clocked out after an over-read
|
|
of the transmit buffer.
|
|
|
|
config SPI_4_NRF_RX_DELAY
|
|
int "SPIM4 MISO sampling delay"
|
|
depends on SPI_4_NRF_SPIM && SOC_NRF5340_CPUAPP
|
|
range 0 7
|
|
default 2
|
|
help
|
|
Number of 64 MHz clock cycles (15.625 ns) delay from the sampling
|
|
edge of SCK (leading or trailing, depending on the CPHA setting used)
|
|
until the input serial data on MISO is actually sampled.
|
|
|
|
config SPI_NRFX_RAM_BUFFER_SIZE
|
|
int "Size of RAM buffers for SPIM peripherals"
|
|
default 8
|
|
depends on NRFX_SPIM
|
|
help
|
|
SPIM peripherals cannot transmit data directly from flash. Therefore,
|
|
a buffer in RAM needs to be provided for each instance of SPI driver
|
|
using SPIM peripheral, so that the driver can copy there a chunk of
|
|
data from flash and transmit it.
|
|
The size is specified in bytes. A size of 0 means that this feature
|
|
should be disabled, and the application must then take care of not
|
|
supplying buffers located in flash to the driver, otherwise such
|
|
transfers will fail.
|
|
|
|
endif # SPI_NRFX
|