Skip to content

Commit b6e075e

Browse files
committed
app: Take DTR/RI into use
DTR-uart is taken into use in the Serial Modem application. Following Kconfigs are removed and replaced with devicetree overlays: CONFIG_SM_POWER_PIN, CONFIG_SM_INDICATE_PIN and CONFIG_SM_INDICATE_TIME. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
1 parent 632a804 commit b6e075e

30 files changed

Lines changed: 286 additions & 632 deletions

app/Kconfig

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,7 @@ config SM_START_SLEEP
8686
bool "Enter sleep on startup"
8787
help
8888
If enabled, the SiP is put into deep sleep when powered on.
89-
It can then be started using SM_POWER_PIN.
90-
91-
config SM_POWER_PIN
92-
int "Power pin"
93-
default -1
94-
help
95-
Interface GPIO pin used to put the SiP into deep sleep and wake up from it or exit idle.
96-
The pin is configured with a pull up and must be pulled down shortly to perform one power off or wake up operation.
97-
98-
config SM_INDICATE_PIN
99-
int "Indicate pin"
100-
default -1
101-
help
102-
Interface GPIO pin used to indicate that data is available when Serial Modem is idle (after #XSLEEP=2 AT command).
103-
104-
config SM_INDICATE_TIME
105-
int "Indication period"
106-
default 100
107-
help
108-
GPIO active indication time in milliseconds. This setting specify the period length for the pin to be active
89+
TODO: DTR to wake up from sleep is not implemented yet.
10990

11091
#
11192
# Automatic network attach

app/boards/nrf9131ek_nrf9131_ns.conf

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/boards/nrf9131ek_nrf9131_ns.overlay

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@
66

77
/ {
88
chosen {
9-
ncs,sm-uart = &uart0;
9+
ncs,sm-uart = &dtr_uart0;
1010
};
1111
};
1212

1313
&uart0 {
1414
status = "okay";
1515
hw-flow-control;
16+
17+
dtr_uart0: dtr-uart {
18+
compatible = "nordic,dtr-uart";
19+
dtr-gpios = <&gpio0 28 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
20+
ri-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
21+
status = "okay";
22+
};
23+
};
24+
25+
&gpio0 {
26+
status = "okay";
27+
/* Use PORT event for DTR (28) pin to save power */
28+
sense-edge-mask = <0x10000000>;
1629
};

app/boards/nrf9151dk_nrf9151_ns.conf

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/boards/nrf9151dk_nrf9151_ns.overlay

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,35 @@
44
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
*/
66

7-
/ {
7+
/ {
88
chosen {
9-
ncs,sm-uart = &uart0;
9+
ncs,sm-uart = &dtr_uart0;
1010
};
1111
};
1212

13+
/* DTR with DK */
1314
&uart0 {
1415
status = "okay";
1516
hw-flow-control;
16-
};
1717

18-
&uart2 {
19-
compatible = "nordic,nrf-uarte";
20-
current-speed = <115200>;
21-
status = "disabled";
22-
hw-flow-control;
18+
dtr_uart0: dtr-uart {
19+
compatible = "nordic,dtr-uart";
20+
dtr-gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
21+
ri-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
22+
status = "okay";
23+
};
24+
};
2325

24-
pinctrl-0 = <&uart2_default_alt>;
25-
pinctrl-1 = <&uart2_sleep_alt>;
26-
pinctrl-names = "default", "sleep";
26+
&gpio0 {
27+
status = "okay";
28+
/* Use PORT event for DTR (8) pin to save power */
29+
sense-edge-mask = <0x00000100>;
2730
};
2831

2932
&i2c2 {
3033
status = "disabled";
3134
};
3235

33-
&pinctrl {
34-
uart2_default_alt: uart2_default_alt {
35-
group1 {
36-
psels = <NRF_PSEL(UART_RX, 0, 11)>;
37-
bias-pull-up;
38-
};
39-
group2 {
40-
psels = <NRF_PSEL(UART_TX, 0, 10)>,
41-
<NRF_PSEL(UART_RTS, 0, 12)>,
42-
<NRF_PSEL(UART_CTS, 0, 13)>;
43-
};
44-
};
45-
46-
uart2_sleep_alt: uart2_sleep_alt {
47-
group1 {
48-
psels = <NRF_PSEL(UART_TX, 0, 10)>,
49-
<NRF_PSEL(UART_RX, 0, 11)>,
50-
<NRF_PSEL(UART_RTS, 0, 12)>,
51-
<NRF_PSEL(UART_CTS, 0, 13)>;
52-
low-power-enable;
53-
};
54-
};
55-
};
56-
5736
/* Enable external flash */
5837
&gd25wb256 {
5938
status = "okay";

app/boards/nrf9160dk_nrf9160_ns.conf

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/boards/nrf9160dk_nrf9160_ns.overlay

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,29 @@
66

77
/ {
88
chosen {
9-
ncs,sm-uart = &uart0;
9+
ncs,sm-uart = &dtr_uart0;
1010
};
1111
};
1212

13+
/* DTR with DK */
1314
&uart0 {
1415
status = "okay";
1516
hw-flow-control;
16-
};
1717

18-
&uart2 {
19-
compatible = "nordic,nrf-uarte";
20-
current-speed = <115200>;
21-
status = "disabled";
22-
hw-flow-control;
18+
dtr_uart0: dtr-uart {
19+
compatible = "nordic,dtr-uart";
20+
dtr-gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>; /* button0 */
21+
ri-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; /* led0 */
22+
status = "okay";
23+
};
24+
};
2325

24-
pinctrl-0 = <&uart2_default_alt>;
25-
pinctrl-1 = <&uart2_sleep_alt>;
26-
pinctrl-names = "default", "sleep";
26+
&gpio0 {
27+
status = "okay";
28+
/* Use PORT event for DTR (6) pin to save power */
29+
sense-edge-mask = <0x00000040>;
2730
};
2831

2932
&i2c2 {
3033
status = "disabled";
3134
};
32-
33-
&pinctrl {
34-
uart2_default_alt: uart2_default_alt {
35-
group1 {
36-
psels = <NRF_PSEL(UART_RX, 0, 11)>;
37-
bias-pull-up;
38-
};
39-
group2 {
40-
psels = <NRF_PSEL(UART_TX, 0, 10)>,
41-
<NRF_PSEL(UART_RTS, 0, 12)>,
42-
<NRF_PSEL(UART_CTS, 0, 13)>;
43-
};
44-
};
45-
46-
uart2_sleep_alt: uart2_sleep_alt {
47-
group1 {
48-
psels = <NRF_PSEL(UART_TX, 0, 10)>,
49-
<NRF_PSEL(UART_RX, 0, 11)>,
50-
<NRF_PSEL(UART_RTS, 0, 12)>,
51-
<NRF_PSEL(UART_CTS, 0, 13)>;
52-
low-power-enable;
53-
};
54-
};
55-
};

app/boards/nrf9161dk_nrf9161_ns.conf

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/boards/nrf9161dk_nrf9161_ns.overlay

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,33 @@
66

77
/ {
88
chosen {
9-
ncs,sm-uart = &uart0;
9+
ncs,sm-uart = &dtr_uart0;
1010
};
1111
};
1212

13+
/* DTR with DK */
1314
&uart0 {
1415
status = "okay";
1516
hw-flow-control;
16-
};
1717

18-
&uart2 {
19-
compatible = "nordic,nrf-uarte";
20-
current-speed = <115200>;
21-
status = "disabled";
22-
hw-flow-control;
18+
dtr_uart0: dtr-uart {
19+
compatible = "nordic,dtr-uart";
20+
dtr-gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
21+
ri-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
22+
status = "okay";
23+
};
24+
};
2325

24-
pinctrl-0 = <&uart2_default_alt>;
25-
pinctrl-1 = <&uart2_sleep_alt>;
26-
pinctrl-names = "default", "sleep";
26+
&gpio0 {
27+
status = "okay";
28+
/* Use PORT event for DTR (8) pin to save power */
29+
sense-edge-mask = <0x00000100>;
2730
};
2831

2932
&i2c2 {
3033
status = "disabled";
3134
};
3235

33-
&pinctrl {
34-
uart2_default_alt: uart2_default_alt {
35-
group1 {
36-
psels = <NRF_PSEL(UART_RX, 0, 11)>;
37-
bias-pull-up;
38-
};
39-
group2 {
40-
psels = <NRF_PSEL(UART_TX, 0, 10)>,
41-
<NRF_PSEL(UART_RTS, 0, 12)>,
42-
<NRF_PSEL(UART_CTS, 0, 13)>;
43-
};
44-
};
45-
46-
uart2_sleep_alt: uart2_sleep_alt {
47-
group1 {
48-
psels = <NRF_PSEL(UART_TX, 0, 10)>,
49-
<NRF_PSEL(UART_RX, 0, 11)>,
50-
<NRF_PSEL(UART_RTS, 0, 12)>,
51-
<NRF_PSEL(UART_CTS, 0, 13)>;
52-
low-power-enable;
53-
};
54-
};
55-
};
56-
5736
/* Enable external flash */
5837
&gd25wb256 {
5938
status = "okay";

app/boards/thingy91_nrf9160_ns.conf

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)