Skip to content

Commit bdc6815

Browse files
kowalewskijanfabiobaltieri
authored andcommitted
boards: ct: ctcc: add nrf9161 soc variant
Add support for CTHINGS.CO Connectivity Card with nRF9161 SoC variant. Signed-off-by: Jan Kowalewski <[email protected]>
1 parent 57a7f76 commit bdc6815

12 files changed

+314
-5
lines changed

boards/ct/ctcc/Kconfig.ctcc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
config BOARD_CTCC
77
select SOC_NRF52840_QIAA if BOARD_CTCC_NRF52840
8+
select SOC_NRF9161_LACA if BOARD_CTCC_NRF9161 || BOARD_CTCC_NRF9161_NS

boards/ct/ctcc/Kconfig.defconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,24 @@ if BOARD_CTCC_NRF52840
88
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"
99

1010
endif # BOARD_CTCC_NRF52840
11+
12+
if BOARD_CTCC_NRF9161 || BOARD_CTCC_NRF9161_NS
13+
14+
# Workaround for not being able to have commas in macro arguments.
15+
# For explanation please see: boards/nordic/nrf9161dk/Kconfig.defconfig
16+
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
17+
18+
config FLASH_LOAD_SIZE
19+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
20+
depends on BOARD_CTCC_NRF9161 && TRUSTED_EXECUTION_SECURE
21+
22+
if BOARD_CTCC_NRF9161_NS
23+
24+
config FLASH_LOAD_OFFSET
25+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
26+
27+
config FLASH_LOAD_SIZE
28+
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
29+
30+
endif # BOARD_CTCC_NRF9161_NS
31+
endif # BOARD_CTCC_NRF9161 || BOARD_CTCC_NRF9161_NS

boards/ct/ctcc/board.cmake

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
board_runner_args(nrfjprog "--softreset")
4-
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
5-
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
6-
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
3+
if(CONFIG_BOARD_CTCC_NRF52840)
4+
board_runner_args(nrfjprog "--softreset")
5+
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
6+
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
7+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
8+
elseif(CONFIG_BOARD_CTCC_NRF9161 OR CONFIG_BOARD_CTCC_NRF9161_NS)
9+
if(CONFIG_BOARD_CTCC_NRF9161_NS)
10+
set(TFM_PUBLIC_KEY_FORMAT "full")
11+
endif()
12+
if(CONFIG_TFM_FLASH_MERGED_BINARY)
13+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex)
14+
endif()
15+
board_runner_args(nrfjprog "--softreset")
16+
board_runner_args(pyocd "--target=nrf9161" "--frequency=4000000")
17+
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
18+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
19+
endif()

boards/ct/ctcc/board.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
board:
22
name: ctcc
3-
full_name: Connectivity Card nRF52840
3+
full_name: CTHINGS.CO Connectivity Card
44
socs:
55
- name: nrf52840
6+
- name: nrf9161
7+
variants:
8+
- name: 'ns'
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2024 CTHINGS.CO
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
&pinctrl {
7+
uart0_default: uart0_default {
8+
group1 {
9+
psels = <NRF_PSEL(UART_TX, 0, 28)>,
10+
<NRF_PSEL(UART_RTS, 0, 14)>;
11+
};
12+
group2 {
13+
psels = <NRF_PSEL(UART_RX, 0, 29)>,
14+
<NRF_PSEL(UART_CTS, 0, 15)>;
15+
};
16+
};
17+
18+
uart0_sleep: uart0_sleep {
19+
group1 {
20+
psels = <NRF_PSEL(UART_TX, 0, 28)>,
21+
<NRF_PSEL(UART_RX, 0, 29)>,
22+
<NRF_PSEL(UART_RTS, 0, 14)>,
23+
<NRF_PSEL(UART_CTS, 0, 15)>;
24+
low-power-enable;
25+
};
26+
};
27+
28+
uart1_default: uart1_default {
29+
group1 {
30+
psels = <NRF_PSEL(UART_TX, 0, 27)>,
31+
<NRF_PSEL(UART_RTS, 0, 16)>;
32+
};
33+
group2 {
34+
psels = <NRF_PSEL(UART_RX, 0, 26)>,
35+
<NRF_PSEL(UART_CTS, 0, 17)>;
36+
bias-pull-up;
37+
};
38+
};
39+
40+
uart1_sleep: uart1_sleep {
41+
group1 {
42+
psels = <NRF_PSEL(UART_TX, 0, 27)>,
43+
<NRF_PSEL(UART_RX, 0, 26)>,
44+
<NRF_PSEL(UART_RTS, 0, 16)>,
45+
<NRF_PSEL(UART_CTS, 0, 17)>;
46+
low-power-enable;
47+
};
48+
};
49+
50+
spi3_default: spi3_default {
51+
group1 {
52+
psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
53+
<NRF_PSEL(SPIM_MISO, 0, 5)>,
54+
<NRF_PSEL(SPIM_MOSI, 0, 4)>;
55+
nordic,drive-mode = <NRF_DRIVE_H0H1>;
56+
};
57+
};
58+
59+
spi3_sleep: spi3_sleep {
60+
group1 {
61+
psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
62+
<NRF_PSEL(SPIM_MISO, 0, 5)>,
63+
<NRF_PSEL(SPIM_MOSI, 0, 4)>;
64+
low-power-enable;
65+
};
66+
};
67+
};

boards/ct/ctcc/ctcc_nrf9161.dts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2024 CTHINGS.CO
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <nordic/nrf9161_laca.dtsi>
9+
#include "ctcc_nrf9161_common.dtsi"
10+
11+
/ {
12+
chosen {
13+
zephyr,sram = &sram0_s;
14+
zephyr,flash = &flash0;
15+
zephyr,code-partition = &slot0_partition;
16+
zephyr,sram-secure-partition = &sram0_s;
17+
zephyr,sram-non-secure-partition = &sram0_ns;
18+
};
19+
};

boards/ct/ctcc/ctcc_nrf9161.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
identifier: ctcc/nrf9161
2+
name: CTHINGS.CO Connectivity Card nRF9161
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
ram: 88
10+
flash: 1024
11+
supported:
12+
- gpio
13+
- watchdog
14+
- counter
15+
vendor: ct
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) 2024 CTHINGS.CO
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "ctcc_nrf9161-pinctrl.dtsi"
8+
#include <zephyr/dt-bindings/input/input-event-codes.h>
9+
10+
/ {
11+
model = "CTHINGS.CO Connectivity Card nRF9161";
12+
compatible = "ct,ctcc-nrf9161";
13+
14+
chosen {
15+
zephyr,console = &uart0;
16+
zephyr,shell-uart = &uart0;
17+
zephyr,uart-mcumgr = &uart0;
18+
};
19+
20+
leds {
21+
compatible = "gpio-leds";
22+
led1: led_1 {
23+
gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
24+
label = "LED 1";
25+
};
26+
led2: led_2 {
27+
gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
28+
label = "LED 2";
29+
};
30+
};
31+
32+
aliases {
33+
led0 = &led1;
34+
led1 = &led2;
35+
mcuboot-led0 = &led1;
36+
bootloader-led0 = &led1;
37+
watchdog0 = &wdt0;
38+
spi-flash0 = &mx25r6435;
39+
};
40+
};
41+
42+
&adc {
43+
status = "okay";
44+
};
45+
46+
&gpiote {
47+
status = "okay";
48+
};
49+
50+
&gpio0 {
51+
status = "okay";
52+
};
53+
54+
&uart0 {
55+
status = "okay";
56+
current-speed = <115200>;
57+
pinctrl-0 = <&uart0_default>;
58+
pinctrl-1 = <&uart0_sleep>;
59+
pinctrl-names = "default", "sleep";
60+
};
61+
62+
&uart1 {
63+
status = "okay";
64+
current-speed = <115200>;
65+
pinctrl-0 = <&uart1_default>;
66+
pinctrl-1 = <&uart1_sleep>;
67+
pinctrl-names = "default", "sleep";
68+
};
69+
70+
&spi3 {
71+
compatible = "nordic,nrf-spim";
72+
status = "okay";
73+
cs-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
74+
pinctrl-0 = <&spi3_default>;
75+
pinctrl-1 = <&spi3_sleep>;
76+
pinctrl-names = "default", "sleep";
77+
78+
mx25r6435: mx25r6435fm2il0@0 {
79+
compatible = "jedec,spi-nor";
80+
status = "disabled";
81+
reg = <0>;
82+
spi-max-frequency = <10000000>;
83+
size = <DT_SIZE_M(64)>;
84+
has-dpd;
85+
dpd-wakeup-sequence = <30000>, <20>, <30000>;
86+
jedec-id = [c2 25 38];
87+
};
88+
};
89+
90+
/* Include default memory partition configuration file */
91+
#include <common/nordic/nrf91xx_partition.dtsi>

boards/ct/ctcc/ctcc_nrf9161_defconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# Enable MPU
4+
CONFIG_ARM_MPU=y
5+
6+
# Enable hardware stack protection
7+
CONFIG_HW_STACK_PROTECTION=y
8+
9+
# Enable TrustZone-M
10+
CONFIG_ARM_TRUSTZONE_M=y
11+
12+
# Enable GPIO
13+
CONFIG_GPIO=y
14+
15+
# Enable UART driver
16+
CONFIG_SERIAL=y
17+
18+
# Enable console
19+
CONFIG_CONSOLE=y
20+
CONFIG_UART_CONSOLE=y

boards/ct/ctcc/ctcc_nrf9161_ns.dts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2024 CTHINGS.CO
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <nordic/nrf9161ns_laca.dtsi>
9+
#include "ctcc_nrf9161_common.dtsi"
10+
11+
/ {
12+
chosen {
13+
zephyr,flash = &flash0;
14+
zephyr,sram = &sram0_ns;
15+
zephyr,code-partition = &slot0_ns_partition;
16+
};
17+
};
18+
19+
/* Disable UART1, because it is used by default in TF-M */
20+
&uart1 {
21+
status = "disabled";
22+
};

0 commit comments

Comments
 (0)