Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
# 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.
	  Peripherals with the same instance ID cannot be used together,
	  e.g. SPI_0 and I2C_0. You may need to disable I2C_0 or I2C_1.

if SPI_NRFX

# In most Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
# In nRF52810 though, there are only single instances of these peripherals
# and they are arranged in a different way, so this limitation does not apply.
if SPI_0 && (SOC_NRF52810 || \
             (!I2C_0 && !(SOC_SERIES_NRF91X && UART_0_NRF_UARTE)))

choice
	prompt "SPI Port 0 Driver type"

config SPI_0_NRF_SPI
	bool "nRF SPI 0"
	depends on HAS_HW_NRF_SPI0
	select NRFX_SPI
	help
	  Enable nRF SPI Master without EasyDMA on port 0.

config SPI_0_NRF_SPIM
	bool "nRF SPIM 0"
	# This driver is not available for nRF52832 because of the anomaly 58
	# (SPIM: An additional byte is clocked out when RXD.MAXCNT = 1).
	depends on HAS_HW_NRF_SPIM0 && !SOC_NRF52832
	select NRFX_SPIM
	help
	  Enable nRF SPI Master with EasyDMA on port 0.

config SPI_0_NRF_SPIS
	bool "nRF SPIS 0"
	depends on HAS_HW_NRF_SPIS0
	depends on SPI_SLAVE
	select NRFX_SPIS
	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.

endchoice

if SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS

config SPI_0_NRF_ORC
	hex "SPI Port 0 over-read character"
	range 0x00 0xff
	default 0xff
	help
	  Over-read character. Character clocked out after an over-read
	  of the transmit buffer.

endif # SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS

endif # SPI_0 && (SOC_NRF52810 || ...

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
if SPI_1 && !I2C_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)

choice
	prompt "SPI Port 1 Driver type"

config SPI_1_NRF_SPI
	bool "nRF SPI 1"
	depends on HAS_HW_NRF_SPI1
	select NRFX_SPI
	help
	  Enable nRF SPI Master without EasyDMA on port 1.

config SPI_1_NRF_SPIM
	bool "nRF SPIM 1"
	# This driver is not available for nRF52832 because of the anomaly 58
	# (SPIM: An additional byte is clocked out when RXD.MAXCNT = 1).
	depends on HAS_HW_NRF_SPIM1 && !SOC_NRF52832
	select NRFX_SPIM
	help
	  Enable nRF SPI Master with EasyDMA on port 1.

config SPI_1_NRF_SPIS
	bool "nRF SPIS 1"
	depends on HAS_HW_NRF_SPIS1
	depends on SPI_SLAVE
	select NRFX_SPIS
	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.

endchoice

if SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS

config SPI_1_NRF_ORC
	hex "SPI Port 1 over-read character"
	range 0x00 0xff
	default 0xff
	help
	  Over-read character. Character clocked out after an over-read
	  of the transmit buffer.

endif # SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS

endif # SPI_1 && !I2C_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
if SPI_2 && !I2C_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)

choice
	prompt "SPI Port 2 Driver type"

config SPI_2_NRF_SPI
	bool "nRF SPI 2"
	depends on HAS_HW_NRF_SPI2
	select NRFX_SPI
	help
	  Enable nRF SPI Master without EasyDMA on port 2.

config SPI_2_NRF_SPIM
	bool "nRF SPIM 2"
	# This driver is not available for nRF52832 because of the anomaly 58
	# (SPIM: An additional byte is clocked out when RXD.MAXCNT = 1).
	depends on HAS_HW_NRF_SPIM2 && !SOC_NRF52832
	select NRFX_SPIM
	help
	  Enable nRF SPI Master with EasyDMA on port 2.

config SPI_2_NRF_SPIS
	bool "nRF SPIS 2"
	depends on HAS_HW_NRF_SPIS2
	depends on SPI_SLAVE
	select NRFX_SPIS
	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.

endchoice

if SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS

config SPI_2_NRF_ORC
	hex "SPI Port 2 over-read character"
	range 0x00 0xff
	default 0xff
	help
	  Over-read character. Character clocked out after an over-read
	  of the transmit buffer.

endif # SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS

endif # SPI_2 && !I2C_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
if SPI_3 && !I2C_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)

choice
	prompt "SPI Port 3 Driver type"

config SPI_3_NRF_SPIM
	bool "nRF SPIM 3"
	depends on HAS_HW_NRF_SPIM3
	select NRFX_SPIM
	help
	  Enable nRF SPI Master with EasyDMA on port 3.

config SPI_3_NRF_SPIS
	bool "nRF SPIS 3"
	depends on HAS_HW_NRF_SPIS3
	depends on SPI_SLAVE
	select NRFX_SPIS
	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.

endchoice

if SPI_3_NRF_SPIM || SPI_3_NRF_SPIS

config SPI_3_NRF_ORC
	hex "SPI Port 3 over-read character"
	range 0x00 0xff
	default 0xff
	help
	  Over-read character. Character clocked out after an over-read
	  of the transmit buffer.

endif # SPI_3_NRF_SPIM || SPI_3_NRF_SPIS

config SPI_3_NRF_RX_DELAY
	int "SPIM3 MISO sampling delay"
	depends on SPI_3_NRF_SPIM && 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.

endif # SPI_3 && !I2C_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)

if NRFX_SPIM

config SPI_NRFX_RAM_BUFFER_SIZE
	int "Size of RAM buffers for SPIM peripherals"
	default 0
	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.

choice
	prompt "nRF SPIM MISO pin pull configuration"
	default SPI_NRFX_SPIM_MISO_PULL_DOWN

config SPI_NRFX_SPIM_MISO_NO_PULL
	bool "no pull"
	help
	  Disable MISO pin pull.

config SPI_NRFX_SPIM_MISO_PULL_DOWN
	bool "pull down"
	help
	  Enable MISO pin pull down.

config SPI_NRFX_SPIM_MISO_PULL_UP
	bool "pull up"
	help
	  Enable MISO pin pull up.

endchoice

endif # NRFX_SPIM

if NRFX_SPI

choice
	prompt "nRF SPI MISO pin pull configuration"
	default SPI_NRFX_SPI_MISO_PULL_DOWN

config SPI_NRFX_SPI_MISO_NO_PULL
	bool "no pull"
	help
	  Disable MISO pin pull.

config SPI_NRFX_SPI_MISO_PULL_DOWN
	bool "pull down"
	help
	  Enable MISO pin pull down.

config SPI_NRFX_SPI_MISO_PULL_UP
	bool "pull up"
	help
	  Enable MISO pin pull up.

endchoice

endif # NRFX_SPI

endif # SPI_NRFX