Skip to content

Commit d5c04f9

Browse files
anangltejlmand
authored andcommitted
[nrf fromlist] boards: nrf9160dk: Add support for newer revisions ...
... (0.14.0+) of the DK Upstream PR: zephyrproject-rtos/zephyr#31624 Use the multiple board revisions feature to provide support for the new hardware possibilities available in nRF9160 DK starting from v0.14.0. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 284f333 commit d5c04f9

20 files changed

+305
-23
lines changed

boards/arm/nrf9160dk_nrf52840/board.c

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <drivers/gpio.h>
1010
#include <devicetree.h>
1111
#include <logging/log.h>
12+
#include <hal/nrf_gpio.h>
1213

1314
LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_NRF9160DK_LOG_LEVEL);
1415

@@ -22,7 +23,16 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_NRF9160DK_LOG_LEVEL);
2223
DT_GPIO_FLAGS_BY_IDX(DT_NODELABEL(name), prop, idx)
2324
#define GET_DEV(name, prop, idx) DEVICE_DT_GET(GET_CTLR(name, prop, idx))
2425

25-
#define USE_RESET_GPIO DT_NODE_HAS_STATUS(DT_NODELABEL(reset_input), okay)
26+
/* If the GPIO pin selected to be the reset line is actually the pin that
27+
* exposes the nRESET function (P0.18 in nRF52840), there is no need to
28+
* provide any additional GPIO configuration for it.
29+
*/
30+
#define RESET_INPUT_IS_PINRESET (IS_ENABLED(CONFIG_GPIO_AS_PINRESET) && \
31+
GET_PORT(reset_input, gpios, 0) == 0 && \
32+
GET_PIN(reset_input, gpios, 0) == 18)
33+
#define USE_RESET_GPIO \
34+
(DT_NODE_HAS_STATUS(DT_NODELABEL(reset_input), okay) && \
35+
!RESET_INPUT_IS_PINRESET)
2636

2737
struct switch_cfg {
2838
const struct device *gpio;
@@ -77,6 +87,9 @@ static const struct switch_cfg routing_switches[] = {
7787
ROUTING_SWITCH(nrf_interface_pins_0_2_routing)
7888
ROUTING_SWITCH(nrf_interface_pins_3_5_routing)
7989
ROUTING_SWITCH(nrf_interface_pins_6_8_routing)
90+
ROUTING_SWITCH(nrf_interface_pin_9_routing)
91+
ROUTING_SWITCH(io_expander_pins_routing)
92+
ROUTING_SWITCH(external_flash_pins_routing)
8093
};
8194

8295
#if USE_RESET_GPIO
@@ -197,3 +210,32 @@ static int init(const struct device *dev)
197210
}
198211

199212
SYS_INIT(init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
213+
214+
#define EXT_MEM_CTRL DT_NODELABEL(external_flash_pins_routing)
215+
#if DT_NODE_EXISTS(EXT_MEM_CTRL)
216+
217+
static int early_init(const struct device *dev)
218+
{
219+
/* As soon as possible after the system starts up, enable the analog
220+
* switch that routes signals to the external flash. Otherwise, the
221+
* HOLD line in the flash chip may not be properly pulled up internally
222+
* and consequently the chip will not respond to any command.
223+
* Later on, during the normal initialization performed above, this
224+
* analog switch will get configured according to what is selected
225+
* in devicetree.
226+
*/
227+
uint32_t psel = NRF_DT_GPIOS_TO_PSEL(EXT_MEM_CTRL, control_gpios);
228+
gpio_dt_flags_t flags = DT_GPIO_FLAGS(EXT_MEM_CTRL, control_gpios);
229+
230+
if (flags & GPIO_ACTIVE_LOW) {
231+
nrf_gpio_pin_clear(psel);
232+
} else {
233+
nrf_gpio_pin_set(psel);
234+
}
235+
nrf_gpio_cfg_output(psel);
236+
237+
return 0;
238+
}
239+
240+
SYS_INIT(early_init, PRE_KERNEL_1, 0);
241+
#endif

boards/arm/nrf9160dk_nrf52840/doc/index.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ such as LEDs and buttons, UART interfaces (VCOMx) of the interface MCU, and
130130
specific nRF52840 SoC pins.
131131

132132
.. note::
133-
nRF9160 signals routed to other components on the DK are not simultaneously
134-
available on the DK connectors.
133+
In nRF9160 DK revisions earlier than v0.14.0, nRF9160 signals routed to
134+
other components on the DK are not simultaneously available on the DK
135+
connectors.
135136

136137
When compiling a project for nrf9160dk_nrf52840, the board controller firmware
137138
will be compiled and run automatically after the Kernel has been initialized.
@@ -208,6 +209,20 @@ on the nRF9160 DK:
208209
| ``nrf_interface_pins_6_8_routing`` | nRF_IF6-8_CTRL (nRF91_COEX) |
209210
+------------------------------------+------------------------------+
210211

212+
When building for the DK revision 0.14.0 or later, you can use the following
213+
additional nodes (see :ref:`application_board_version` for information how to
214+
build for specific revisions of the board):
215+
216+
+------------------------------------+------------------------------+
217+
| Devicetree node label | Analog switch name |
218+
+====================================+==============================+
219+
| ``nrf_interface_pin_9_routing`` | nRF_IF9_CTRL |
220+
+------------------------------------+------------------------------+
221+
| ``io_expander_pins_routing`` | IO_EXP_EN |
222+
+------------------------------------+------------------------------+
223+
| ``external_flash_pins_routing`` | EXT_MEM_CTRL |
224+
+------------------------------------+------------------------------+
225+
211226
For example, if you want to enable the optional routing for the nRF9160 pins
212227
P0.17, P0.18, and P0.19 so that they are routed to nRF52840 pins P0.17, P0.20,
213228
and P0.15, respectively, add the following in the devicetree overlay in your

boards/arm/nrf9160dk_nrf52840/dts/bindings/nordic,nrf9160dk-nrf52840-interface.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ description: |
1010
This interface can be used for inter-SoC communication on the DK.
1111
The connections are as follows:
1212
13-
| nRF9160 | | nRF52840 |
14-
| P0.17 | -- nRF interface line 0 -- | P0.17 |
15-
| P0.18 | -- nRF interface line 1 -- | P0.20 |
16-
| P0.19 | -- nRF interface line 2 -- | P0.15 |
17-
| P0.21 | -- nRF interface line 3 -- | P0.22 |
18-
| P0.22 | -- nRF interface line 4 -- | P1.04 |
19-
| P0.23 | -- nRF interface line 5 -- | P1.02 |
20-
| COEX0 | -- nRF interface line 6 -- | P1.13 |
21-
| COEX1 | -- nRF interface line 7 -- | P1.11 |
22-
| COEX2 | -- nRF interface line 8 -- | P1.15 |
13+
| nRF9160 | | nRF52840 |
14+
| P0.17 | -- nRF interface line 0 -- | P0.17 |
15+
| P0.18 | -- nRF interface line 1 -- | P0.20 |
16+
| P0.19 | -- nRF interface line 2 -- | P0.15 |
17+
| P0.21 | -- nRF interface line 3 -- | P0.22 |
18+
| P0.22 | -- nRF interface line 4 -- | P1.04 |
19+
| P0.23 | -- nRF interface line 5 -- | P1.02 |
20+
| COEX0 | -- nRF interface line 6 -- | P1.13 |
21+
| COEX1 | -- nRF interface line 7 -- | P1.11 |
22+
| COEX2 | -- nRF interface line 8 -- | P1.15 |
23+
| P0.24 | -- nRF interface line 9 -- | P0.18 (nRESET) | (in v0.14.0 or later)
2324
2425
Before particular lines of this interface can be used, the corresponding
2526
analog switches that control the routing of involved nRF9160 pins must be
@@ -29,6 +30,12 @@ description: |
2930
- `nrf_interface_pins_0_2_routing` to enable lines 0-2
3031
- `nrf_interface_pins_3_5_routing` to enable lines 3-5
3132
- `nrf_interface_pins_6_8_routing` to enable lines 6-8
33+
- `nrf_interface_pin_9_routing` to enable line 9 (this line is only
34+
available in nRF9160 DK v0.14.0 or later)
35+
36+
NOTE: In nRF9160 DK revisions earlier than v0.14.0, when the above signals
37+
from nRF9160 are routed to nRF52840, they are not available on the DK
38+
connectors.
3239
3340
compatible: "nordic,nrf9160dk-nrf52840-interface"
3441

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* NOTE: this feature is only available in nRF9160 DK v0.14.0 or later. */
8+
9+
&nrf_interface_pin_9_routing {
10+
status = "okay";
11+
};
12+
13+
&reset_input {
14+
status = "okay";
15+
gpios = <&interface_to_nrf9160 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
16+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is required by the multiple board revisions mechanism.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
board-control {
9+
nrf_interface_pin_9_routing: switch-nrf-if9-ctrl {
10+
compatible = "nordic,nrf9160dk-optional-routing";
11+
control-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
12+
status = "disabled";
13+
};
14+
15+
io_expander_pins_routing: switch-io-exp-en {
16+
compatible = "nordic,nrf9160dk-optional-routing";
17+
control-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
18+
status = "disabled";
19+
};
20+
21+
external_flash_pins_routing: switch-ext-mem-ctrl {
22+
compatible = "nordic,nrf9160dk-optional-routing";
23+
control-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
24+
status = "disabled";
25+
};
26+
};
27+
};
28+
29+
&interface_to_nrf9160 {
30+
gpio-map = <0 0 &gpio0 17 0>,
31+
<1 0 &gpio0 20 0>,
32+
<2 0 &gpio0 15 0>,
33+
<3 0 &gpio0 22 0>,
34+
<4 0 &gpio1 4 0>,
35+
<5 0 &gpio1 2 0>,
36+
<6 0 &gpio1 13 0>,
37+
<7 0 &gpio1 11 0>,
38+
<8 0 &gpio1 15 0>,
39+
/* New signal added in this revision (0.14.0). */
40+
<9 0 &gpio0 18 0>; /* nReset */
41+
};
42+
43+
&vcom2_pins_routing {
44+
/* No need to drive P0.12 together with P1.12 in this board revision. */
45+
control-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
46+
};
47+
48+
&reset_input {
49+
/* By default use the dedicated connection to the nRESET (P0.18) pin. */
50+
gpios = <&interface_to_nrf9160 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
51+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is required by the multiple board revisions mechanism.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board_check_revision(
5+
FORMAT MAJOR.MINOR.PATCH
6+
DEFAULT_REVISION 0.7.0
7+
)

boards/arm/nrf9160dk_nrf9160/doc/index.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,31 @@ hardware features:
8383
| WDT | on-chip | watchdog |
8484
+-----------+------------+----------------------+
8585

86+
.. _nrf9160dk_additional_hardware:
87+
88+
Additional hardware in v0.14.0+
89+
-------------------------------
90+
91+
Starting from v0.14.0, additional hardware is available on the DK:
92+
93+
* External flash memory (MX25R6435F, 64 Mb)
94+
* I/O expander (PCAL6408A) that can be used to interface LEDs, slide switches,
95+
and buttons
96+
97+
To use this additional hardware, specify the revision of the board that
98+
should be used when building your application (for more information, see
99+
:ref:`application_board_version`). For example, to build for nRF9160 DK v1.0.0:
100+
101+
.. zephyr-app-commands::
102+
:tool: all
103+
:cd-into:
104+
105+
:goals: build
106+
:compact:
107+
108+
Remember to also enable routing for this additional hardware in the firmware for
109+
:ref:`nrf9160dk_nrf52840` (see :ref:`nrf9160dk_board_controller_firmware`).
110+
86111
Other hardware features are not supported by the Zephyr kernel.
87112
See `nRF9160 DK website`_ and `Nordic Semiconductor Infocenter`_
88113
for a complete list of nRF9160 DK board hardware features.

boards/arm/nrf9160dk_nrf9160/dts/bindings/nordic,nrf9160dk-nrf52840-interface.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ description: |
1010
This interface can be used for inter-SoC communication on the DK.
1111
The connections are as follows:
1212
13-
| nRF9160 | | nRF52840 |
14-
| P0.17 | -- nRF interface line 0 -- | P0.17 |
15-
| P0.18 | -- nRF interface line 1 -- | P0.20 |
16-
| P0.19 | -- nRF interface line 2 -- | P0.15 |
17-
| P0.21 | -- nRF interface line 3 -- | P0.22 |
18-
| P0.22 | -- nRF interface line 4 -- | P1.04 |
19-
| P0.23 | -- nRF interface line 5 -- | P1.02 |
20-
| COEX0 | -- nRF interface line 6 -- | P1.13 |
21-
| COEX1 | -- nRF interface line 7 -- | P1.11 |
22-
| COEX2 | -- nRF interface line 8 -- | P1.15 |
13+
| nRF9160 | | nRF52840 |
14+
| P0.17 | -- nRF interface line 0 -- | P0.17 |
15+
| P0.18 | -- nRF interface line 1 -- | P0.20 |
16+
| P0.19 | -- nRF interface line 2 -- | P0.15 |
17+
| P0.21 | -- nRF interface line 3 -- | P0.22 |
18+
| P0.22 | -- nRF interface line 4 -- | P1.04 |
19+
| P0.23 | -- nRF interface line 5 -- | P1.02 |
20+
| COEX0 | -- nRF interface line 6 -- | P1.13 |
21+
| COEX1 | -- nRF interface line 7 -- | P1.11 |
22+
| COEX2 | -- nRF interface line 8 -- | P1.15 |
23+
| P0.24 | -- nRF interface line 9 -- | P0.18 (nRESET) | (in v0.14.0 or later)
2324
2425
Before particular lines of this interface can be used, the corresponding
2526
analog switches that control the routing of involved nRF9160 pins must be
@@ -29,6 +30,12 @@ description: |
2930
- `nrf_interface_pins_0_2_routing` to enable lines 0-2
3031
- `nrf_interface_pins_3_5_routing` to enable lines 3-5
3132
- `nrf_interface_pins_6_8_routing` to enable lines 6-8
33+
- `nrf_interface_pin_9_routing` to enable line 9 (this line is only
34+
available in nRF9160 DK v0.14.0 or later)
35+
36+
NOTE: In nRF9160 DK revisions earlier than v0.14.0, when the above signals
37+
from nRF9160 are routed to nRF52840, they are not available on the DK
38+
connectors.
3239
3340
compatible: "nordic,nrf9160dk-nrf52840-interface"
3441

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* NOTE: this feature is only available in nRF9160 DK v0.14.0 or later. */
8+
9+
&nrf52840_reset {
10+
status = "okay";
11+
gpios = <&interface_to_nrf52840 9 GPIO_ACTIVE_LOW>;
12+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is required by the multiple board revisions mechanism.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "nrf9160dk_nrf9160_common_0_14_0.dtsi"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is required by the multiple board revisions mechanism.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&interface_to_nrf52840 {
8+
gpio-map = <0 0 &gpio0 17 0>,
9+
<1 0 &gpio0 18 0>,
10+
<2 0 &gpio0 19 0>,
11+
<3 0 &gpio0 21 0>,
12+
<4 0 &gpio0 22 0>,
13+
<5 0 &gpio0 23 0>,
14+
/* 6: COEX0 */
15+
/* 7: COEX1 */
16+
/* 8: COEX2 */
17+
<9 0 &gpio0 24 0>;
18+
};
19+
20+
&nrf52840_reset {
21+
gpios = <&interface_to_nrf52840 9 GPIO_ACTIVE_LOW>;
22+
};
23+
24+
&spi3 {
25+
status = "okay";
26+
sck-pin = <13>;
27+
mosi-pin = <11>;
28+
miso-pin = <12>;
29+
cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
30+
mx25r64: mx25r6435f@0 {
31+
compatible = "jedec,spi-nor";
32+
reg = <0>;
33+
spi-max-frequency = <8000000>;
34+
label = "MX25R64";
35+
jedec-id = [c2 28 17];
36+
sfdp-bfp = [
37+
e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
38+
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
39+
10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
40+
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
41+
];
42+
size = <67108864>;
43+
has-dpd;
44+
t-enter-dpd = <10000>;
45+
t-exit-dpd = <35000>;
46+
};
47+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is required by the multiple board revisions mechanism.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "nrf9160dk_nrf9160_common_0_14_0.dtsi"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is required by the multiple board revisions mechanism.

0 commit comments

Comments
 (0)