boards: nrf: Moved SDA and SCL pin configuration to DTS for nRF boards
SDA and SCL pins can now be configured through DTS. Pins on development kits have been assigned according to arduino headers. Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
This commit is contained in:
parent
1aa61d60c5
commit
dc1c2742b6
20 changed files with 52 additions and 71 deletions
|
@ -12,12 +12,16 @@
|
|||
#define CONFIG_I2C_0_BITRATE NORDIC_NRF5_I2C_40003000_CLOCK_FREQUENCY
|
||||
#define CONFIG_I2C_0_IRQ_PRI NORDIC_NRF5_I2C_40003000_IRQ_0_PRIORITY
|
||||
#define CONFIG_I2C_0_IRQ NORDIC_NRF5_I2C_40003000_IRQ_0
|
||||
#define CONFIG_I2C_0_SDA_PIN NORDIC_NRF5_I2C_40003000_SDA_PIN
|
||||
#define CONFIG_I2C_0_SCL_PIN NORDIC_NRF5_I2C_40003000_SCL_PIN
|
||||
|
||||
#define CONFIG_I2C_1_BASE_ADDR NORDIC_NRF5_I2C_40004000_BASE_ADDRESS
|
||||
#define CONFIG_I2C_1_NAME NORDIC_NRF5_I2C_40004000_LABEL
|
||||
#define CONFIG_I2C_1_BITRATE NORDIC_NRF5_I2C_40004000_CLOCK_FREQUENCY
|
||||
#define CONFIG_I2C_1_IRQ_PRI NORDIC_NRF5_I2C_40004000_IRQ_0_PRIORITY
|
||||
#define CONFIG_I2C_1_IRQ NORDIC_NRF5_I2C_40004000_IRQ_0
|
||||
#define CONFIG_I2C_1_SDA_PIN NORDIC_NRF5_I2C_40004000_SDA_PIN
|
||||
#define CONFIG_I2C_1_SCL_PIN NORDIC_NRF5_I2C_40004000_SCL_PIN
|
||||
|
||||
#define CONFIG_WDT_0_NAME NORDIC_NRF_WATCHDOG_40010000_LABEL
|
||||
#define CONFIG_WDT_NRF_IRQ NORDIC_NRF_WATCHDOG_40010000_IRQ_WDT
|
||||
|
|
|
@ -17,12 +17,16 @@
|
|||
#define CONFIG_I2C_0_BITRATE NORDIC_NRF5_I2C_40003000_CLOCK_FREQUENCY
|
||||
#define CONFIG_I2C_0_IRQ_PRI NORDIC_NRF5_I2C_40003000_IRQ_0_PRIORITY
|
||||
#define CONFIG_I2C_0_IRQ NORDIC_NRF5_I2C_40003000_IRQ_0
|
||||
#define CONFIG_I2C_0_SDA_PIN NORDIC_NRF5_I2C_40003000_SDA_PIN
|
||||
#define CONFIG_I2C_0_SCL_PIN NORDIC_NRF5_I2C_40003000_SCL_PIN
|
||||
|
||||
#define CONFIG_I2C_1_BASE_ADDR NORDIC_NRF5_I2C_40004000_BASE_ADDRESS
|
||||
#define CONFIG_I2C_1_NAME NORDIC_NRF5_I2C_40004000_LABEL
|
||||
#define CONFIG_I2C_1_BITRATE NORDIC_NRF5_I2C_40004000_CLOCK_FREQUENCY
|
||||
#define CONFIG_I2C_1_IRQ_PRI NORDIC_NRF5_I2C_40004000_IRQ_0_PRIORITY
|
||||
#define CONFIG_I2C_1_IRQ NORDIC_NRF5_I2C_40004000_IRQ_0
|
||||
#define CONFIG_I2C_1_SDA_PIN NORDIC_NRF5_I2C_40004000_SDA_PIN
|
||||
#define CONFIG_I2C_1_SCL_PIN NORDIC_NRF5_I2C_40004000_SCL_PIN
|
||||
|
||||
#define CONFIG_USBD_NRF5_IRQ NORDIC_NRF_USBD_40027000_IRQ_USBD
|
||||
#define CONFIG_USBD_NRF5_IRQ_PRI NORDIC_NRF_USBD_40027000_IRQ_USBD_PRIORITY
|
||||
|
|
|
@ -45,12 +45,6 @@ choice I2C_0_NRF_TYPE
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_0_NRF_SDA_PIN
|
||||
default 30
|
||||
|
||||
config I2C_0_NRF_SCL_PIN
|
||||
default 0
|
||||
|
||||
endif # I2C_0
|
||||
|
||||
endif # I2C
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
&uart0 {
|
||||
status = "ok";
|
||||
current-speed = <115200>;
|
||||
sda-pin = <30>;
|
||||
scl-pin = <0>;
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
|
|
|
@ -29,10 +29,14 @@
|
|||
|
||||
&i2c0 {
|
||||
status = "ok";
|
||||
sda-pin = <30>;
|
||||
scl-pin = <7>;
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
status = "ok";
|
||||
sda-pin = <5>;
|
||||
scl-pin = <6>;
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -51,12 +51,6 @@ choice I2C_0_NRF_TYPE
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_0_NRF_SDA_PIN
|
||||
default 29
|
||||
|
||||
config I2C_0_NRF_SCL_PIN
|
||||
default 30
|
||||
|
||||
endif # I2C_0
|
||||
|
||||
endif # I2C
|
||||
|
|
|
@ -27,4 +27,6 @@
|
|||
&i2c0 {
|
||||
status = "ok";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
sda-pin = <29>;
|
||||
scl-pin = <30>;
|
||||
};
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
config BOARD_NRF52840_PCA10056
|
||||
bool "NRF52840 PCA10056"
|
||||
select HAS_DTS_GPIO
|
||||
select HAS_DTS_I2C
|
||||
depends on SOC_NRF52840_QIAA
|
||||
|
|
|
@ -42,10 +42,14 @@
|
|||
|
||||
&i2c0 {
|
||||
status = "ok";
|
||||
sda-pin = <26>;
|
||||
scl-pin = <27>;
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
status = "ok";
|
||||
sda-pin = <30>;
|
||||
scl-pin = <31>;
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -51,12 +51,6 @@ choice I2C_0_NRF_TYPE
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_0_NRF_SDA_PIN
|
||||
default 28
|
||||
|
||||
config I2C_0_NRF_SCL_PIN
|
||||
default 2
|
||||
|
||||
endif # I2C_0
|
||||
|
||||
endif # I2C
|
||||
|
|
|
@ -33,6 +33,11 @@
|
|||
status = "ok";
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
sda-pin = <28>;
|
||||
scl-pin = <2>;
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
/*
|
||||
* For more information, see:
|
||||
|
|
|
@ -36,12 +36,17 @@
|
|||
compatible = "nordic,nrf-uart";
|
||||
current-speed = <115200>;
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "ok";
|
||||
sda-pin = <26>;
|
||||
scl-pin = <27>;
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
status = "ok";
|
||||
sda-pin = <30>;
|
||||
scl-pin = <31>;
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -51,12 +51,6 @@ choice I2C_0_NRF_TYPE
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_0_NRF_SDA_PIN
|
||||
default 7
|
||||
|
||||
config I2C_0_NRF_SCL_PIN
|
||||
default 8
|
||||
|
||||
endif # I2C_0
|
||||
|
||||
if I2C_1
|
||||
|
@ -66,15 +60,6 @@ choice I2C_1_NRF_TYPE
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_1_NRF_TWIM
|
||||
def_bool y
|
||||
|
||||
config I2C_1_NRF_SDA_PIN
|
||||
default 14
|
||||
|
||||
config I2C_1_NRF_SCL_PIN
|
||||
default 15
|
||||
|
||||
config GPIO_SX1509B
|
||||
def_bool y
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
&i2c0 {
|
||||
status = "ok";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
sda-pin = <7>;
|
||||
scl-pin = <8>;
|
||||
|
||||
sx1509b: sx1509b@3e {
|
||||
compatible = "semtech,sx1509b";
|
||||
|
@ -67,6 +69,8 @@
|
|||
&i2c1 {
|
||||
status = "ok";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
sda-pin = <14>;
|
||||
scl-pin = <15>;
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
|
|
@ -51,12 +51,6 @@ choice I2C_0_NRF_TYPE
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_0_NRF_SDA_PIN
|
||||
default 26
|
||||
|
||||
config I2C_0_NRF_SCL_PIN
|
||||
default 27
|
||||
|
||||
endif # I2C_0
|
||||
|
||||
endif # I2C
|
||||
|
|
|
@ -36,4 +36,6 @@
|
|||
&i2c0 {
|
||||
status = "ok";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
sda-pin = <26>;
|
||||
scl-pin = <27>;
|
||||
};
|
||||
|
|
|
@ -39,20 +39,6 @@ config I2C_0_NRF_TWIM
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_0_NRF_SDA_PIN
|
||||
int "SDA pin number"
|
||||
range 0 47 if SOC_NRF52840_QIAA
|
||||
range 0 31
|
||||
help
|
||||
GPIO pin number to use for SDA.
|
||||
|
||||
config I2C_0_NRF_SCL_PIN
|
||||
int "SCL pin number"
|
||||
range 0 47 if SOC_NRF52840_QIAA
|
||||
range 0 31
|
||||
help
|
||||
GPIO pin number to use for SCL.
|
||||
|
||||
endif # I2C_0 && !SPI_0
|
||||
|
||||
# Nordic TWIx1 and SPIx1 instances can not be used at the same time.
|
||||
|
@ -79,20 +65,6 @@ config I2C_1_NRF_TWIM
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_1_NRF_SDA_PIN
|
||||
int "SDA pin number"
|
||||
range 0 47 if SOC_NRF52840_QIAA
|
||||
range 0 31
|
||||
help
|
||||
GPIO pin number to use for SDA.
|
||||
|
||||
config I2C_1_NRF_SCL_PIN
|
||||
int "SCL pin number"
|
||||
range 0 47 if SOC_NRF52840_QIAA
|
||||
range 0 31
|
||||
help
|
||||
GPIO pin number to use for SCL.
|
||||
|
||||
endif # I2C_1 && !SPI_1
|
||||
|
||||
endif #I2C_NRFX
|
||||
|
|
|
@ -135,8 +135,8 @@ static int init_twi(struct device *dev, const nrfx_twi_config_t *config)
|
|||
CONFIG_I2C_##idx##_IRQ_PRI, \
|
||||
nrfx_isr, nrfx_twi_##idx##_irq_handler, 0); \
|
||||
const nrfx_twi_config_t config = { \
|
||||
.scl = CONFIG_I2C_##idx##_NRF_SCL_PIN, \
|
||||
.sda = CONFIG_I2C_##idx##_NRF_SDA_PIN, \
|
||||
.scl = CONFIG_I2C_##idx##_SCL_PIN, \
|
||||
.sda = CONFIG_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = NRF_TWI_FREQ_100K, \
|
||||
}; \
|
||||
return init_twi(dev, &config); \
|
||||
|
|
|
@ -135,8 +135,8 @@ static int init_twim(struct device *dev, const nrfx_twim_config_t *config)
|
|||
CONFIG_I2C_##idx##_IRQ_PRI, \
|
||||
nrfx_isr, nrfx_twim_##idx##_irq_handler, 0);\
|
||||
const nrfx_twim_config_t config = { \
|
||||
.scl = CONFIG_I2C_##idx##_NRF_SCL_PIN, \
|
||||
.sda = CONFIG_I2C_##idx##_NRF_SDA_PIN, \
|
||||
.scl = CONFIG_I2C_##idx##_SCL_PIN, \
|
||||
.sda = CONFIG_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = NRF_TWIM_FREQ_100K, \
|
||||
}; \
|
||||
return init_twim(dev, &config); \
|
||||
|
|
|
@ -33,4 +33,15 @@ properties:
|
|||
description: required interrupts
|
||||
generation: define
|
||||
|
||||
sda-pin:
|
||||
type: int
|
||||
description: SDA pin
|
||||
generation: define
|
||||
category: required
|
||||
|
||||
scl-pin:
|
||||
type: int
|
||||
description: SCL pin
|
||||
generation: define
|
||||
category: required
|
||||
...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue