I use Zephyr RTOS and segger Embedded studio to develep nrf5340 project. in a c file , i configurate spim2_ns below:
#define SPIM2_CS NRF_GPIO_PIN_MAP(0,15)
#define SPIM2_SDO NRF_GPIO_PIN_MAP(0,18)
#define SPIM2_CLK NRF_GPIO_PIN_MAP(0,12)
#define SPIM2_SDI NRF_GPIO_PIN_MAP(0,14)
static void ADS129x_GPIO_Init(void){
nrf_gpio_cfg_output(SPIM2_CS);
nrf_gpio_pin_set(SPIM2_CS);
}
static void ADS129x_SPIInit(void){
nrf_spim_pins_set(NRF_SPIM2_NS, SPIM2_CLK, SPIM2_SDO, SPIM2_SDI);
nrf_spim_frequency_set(NRF_SPIM2_NS, NRF_SPIM_FREQ_1M);
nrf_spim_configure(NRF_SPIM2_NS, NRF_SPIM_MODE_1, NRF_SPIM_BIT_ORDER_MSB_FIRST);
nrf_spim_enable(NRF_SPIM2_NS);
}
In project file prj.conf, configration has not code about SPI, below code is project's prj.conf
#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y
CONFIG_GPIO=y
# Make sure printk is not printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_ASSERT=y
//-------------
project can build with no error ,
if i select nrf5340dk_cpuappns to build this project , does module SPIM2_NS can work correctly to read/write a SD card?