I have not set nrf5340 i2c2,uart2 to work .
,in prj.conf ,add below configure:
CONFIG_SPI=y
CONFIG_NRFX_SPIM2=y
in prj.overlay ,add below configure:
&spi2 {
status = "okay";
label = "SPI_2";
compatible = "nordic,nrf-spim";
sck-pin = < 12 >;
miso-pin = < 14 >;
mosi-pin = < 18>;
};
in .c code ,binding device:
struct device *spi2;
struct spi_config spi2_cfg = {0};
spi2= device_get_binding("SPI_2");
if (!spi2) {
LOG_INF("SPIM_2 not found \n");
return;
}
spi2_cfg.operation = SPI_WORD_SET(8|SPI_MODE_CPHA);
spi2_cfg.frequency = 1000000U;
use SEGGER Embedded studio to build project. before build project ,i have deleted build folder .but after build project , produce the devicetree_unfixed.h
#define DT_N_NODELABEL_spi2 DT_N_S_soc_S_peripheral_50000000_S_spi_b000
/* Special property macros: */
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_REG_NUM 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_REG_IDX_0_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_REG_IDX_0_VAL_ADDRESS 1342222336 /* 0x5000b000 */
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_REG_IDX_0_VAL_SIZE 4096 /* 0x1000 */
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_NUM 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_IDX_0_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_IDX_0_VAL_irq 11
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_IDX_0_VAL_irq_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_IDX_0_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_IDX_0_VAL_priority 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_IRQ_IDX_0_VAL_priority_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_COMPAT_MATCHES_nordic_nrf_spim 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_STATUS_okay 1
/* Generic property macros: */
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_miso_pull_up 0
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_miso_pull_up_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_miso_pull_down 0
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_miso_pull_down_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_reg {45056 /* 0xb000 */, 4096 /* 0x1000 */}
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_reg_IDX_0 45056
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_reg_IDX_0_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_reg_IDX_1 4096
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_reg_IDX_1_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_reg_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_interrupts {11 /* 0xb */, 1 /* 0x1 */}
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_interrupts_IDX_0 11
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_interrupts_IDX_0_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_interrupts_IDX_1 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_interrupts_IDX_1_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_interrupts_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_sck_pin 47
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_sck_pin_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_mosi_pin 45
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_mosi_pin_EXISTS 1
#define DT_N_S_soc_S_peripheral_50000000_S_spi_b000_P_miso_pin 46
sck-pin is 47 p1.15
miso-pin is 46 p1.14
mosi-pin is 45 p1.13
i have set p1.15 to do other thing .setting spi2 like top change my p1.15 work. How can i to bind spim2 pin to my favorite pin?
