diff --git a/boards/norik/index.rst b/boards/norik/index.rst new file mode 100644 index 00000000000..11d8f1353f5 --- /dev/null +++ b/boards/norik/index.rst @@ -0,0 +1,10 @@ +.. _boards-norik: + +Norik Systems +############# + +.. toctree:: + :maxdepth: 1 + :glob: + + **/* diff --git a/boards/norik/octopus_som/CMakeLists.txt b/boards/norik/octopus_som/CMakeLists.txt new file mode 100644 index 00000000000..2e35c87b81d --- /dev/null +++ b/boards/norik/octopus_som/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_sources(board.c) diff --git a/boards/norik/octopus_som/Kconfig b/boards/norik/octopus_som/Kconfig new file mode 100644 index 00000000000..090a8e9af85 --- /dev/null +++ b/boards/norik/octopus_som/Kconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_OCTOPUS_SOM + select BOARD_LATE_INIT_HOOK + select GPIO + +module = OCTOPUS_SOM_CONTROL +module-str = Board Control +source "subsys/logging/Kconfig.template.log_config" diff --git a/boards/norik/octopus_som/Kconfig.defconfig b/boards/norik/octopus_som/Kconfig.defconfig new file mode 100644 index 00000000000..6fe9d1618a5 --- /dev/null +++ b/boards/norik/octopus_som/Kconfig.defconfig @@ -0,0 +1,33 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_OCTOPUS_SOM + +# For the secure version of the board the firmware is linked at the beginning +# of the flash, or into the code-partition defined in DT if it is intended to +# be loaded by MCUboot. If the secure firmware is to be combined with a non- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + depends on BOARD_OCTOPUS_SOM && TRUSTED_EXECUTION_SECURE + +if BOARD_OCTOPUS_SOM_NRF9160_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_OCTOPUS_SOM_NRF9160_NS + +endif # BOARD_OCTOPUS_SOM diff --git a/boards/norik/octopus_som/Kconfig.octopus_som b/boards/norik/octopus_som/Kconfig.octopus_som new file mode 100644 index 00000000000..c249d541948 --- /dev/null +++ b/boards/norik/octopus_som/Kconfig.octopus_som @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_OCTOPUS_SOM + select SOC_NRF9160_SICA diff --git a/boards/norik/octopus_som/board.c b/boards/norik/octopus_som/board.c new file mode 100644 index 00000000000..c741ca686aa --- /dev/null +++ b/boards/norik/octopus_som/board.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(board_control, CONFIG_OCTOPUS_SOM_CONTROL_LOG_LEVEL); + +#define SIM_SELECT_NODE DT_PATH(sim_select) + +void board_late_init_hook(void) +{ + const struct gpio_dt_spec simctrl = GPIO_DT_SPEC_GET(DT_PATH(sim_select), sim_gpios); + + if (!gpio_is_ready_dt(&simctrl)) { + LOG_ERR("SIM select GPIO not available"); + return; + } + + if (DT_ENUM_IDX(SIM_SELECT_NODE, sim) == 0) { + (void)gpio_pin_configure_dt(&simctrl, GPIO_OUTPUT_LOW); + LOG_INF("On-board SIM selected"); + } else { + (void)gpio_pin_configure_dt(&simctrl, GPIO_OUTPUT_HIGH); + LOG_INF("External SIM selected"); + } +} diff --git a/boards/norik/octopus_som/board.cmake b/boards/norik/octopus_som/board.cmake new file mode 100644 index 00000000000..e1ae7b4e9b2 --- /dev/null +++ b/boards/norik/octopus_som/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=nRF9160_xxAA" "--speed=4000") +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/norik/octopus_som/board.yml b/boards/norik/octopus_som/board.yml new file mode 100644 index 00000000000..efd094baea7 --- /dev/null +++ b/boards/norik/octopus_som/board.yml @@ -0,0 +1,8 @@ +board: + name: octopus_som + full_name: Octopus SoM + vendor: norik + socs: + - name: nrf9160 + variants: + - name: 'ns' diff --git a/boards/norik/octopus_som/doc/img/octopus_som.webp b/boards/norik/octopus_som/doc/img/octopus_som.webp new file mode 100644 index 00000000000..9bd8e8ed2dd Binary files /dev/null and b/boards/norik/octopus_som/doc/img/octopus_som.webp differ diff --git a/boards/norik/octopus_som/doc/index.rst b/boards/norik/octopus_som/doc/index.rst new file mode 100644 index 00000000000..9949344233c --- /dev/null +++ b/boards/norik/octopus_som/doc/index.rst @@ -0,0 +1,125 @@ +.. zephyr:board:: octopus_som + +Overview +******** + +Octopus SoM is a System on Module (SoM) built around the nRF9160 SiP +offering NB-IoT and LTE-M connectivity, GPS and accelerometer. +It supports on board eSIM and external nano SIM connector. It's purpose +is to provide flexible hardware platform for IoT applications. + +nRF9160 SiP contains ARM Cortex-M33 application processor and the +following devices: + +* :abbr:`ADC (Analog to Digital Converter)` +* CLOCK +* FLASH +* :abbr:`GPIO (General Purpose Input Output)` +* :abbr:`I2C (Inter-Integrated Circuit)` +* :abbr:`MPU (Memory Protection Unit)` +* :abbr:`NVIC (Nested Vectored Interrupt Controller)` +* :abbr:`PWM (Pulse Width Modulation)` +* :abbr:`RTC (nRF RTC System Clock)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UARTE (Universal asynchronous receiver-transmitter with EasyDMA)` +* :abbr:`WDT (Watchdog Timer)` +* :abbr:`IDAU (Implementation Defined Attribution Unit)` + +More information about the board can be found at the `Octopus SoM Product Page`_ and +in the `Octopus SoM Documentation`_. + +Hardware +******** + +The ``octopus_som/nrf9160`` and ``octopus_som/nrf9160/ns`` board targets support the +following hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| ADC | on-chip | adc | ++-----------+------------+----------------------+ +| CLOCK | on-chip | clock_control | ++-----------+------------+----------------------+ +| FLASH | on-chip | flash | ++-----------+------------+----------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| I2C(M) | on-chip | i2c | ++-----------+------------+----------------------+ +| MPU | on-chip | arch/arm | ++-----------+------------+----------------------+ +| NVIC | on-chip | arch/arm | ++-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ +| RTC | on-chip | system clock | ++-----------+------------+----------------------+ +| RTT | Segger | console | ++-----------+------------+----------------------+ +| SPI(M/S) | on-chip | spi | ++-----------+------------+----------------------+ +| SPU | on-chip | system protection | ++-----------+------------+----------------------+ +| UARTE | on-chip | serial | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ +| ACCEL | Analog | adxl362 | ++-----------+------------+----------------------+ + +Connections and IOs +=================== + +Accelerometer +------------- +* MISO = P0.05 +* MOSI = P0.09 +* SCK = P0.10 +* CS = P0.05 +* INT1 = P0.12 + +LED +--- +* LED1 (green) = P0.07 + +SIM select switch +----------------- +* Select = P0.25 + +Programming and Debugging +************************* + +Norik Octopus SoM can be programmed and debugged using the exposed SWD pins. + +Building an application +======================= + +In most case you'll need to use ``octopus_som/nrf9160/ns`` board target for building examples. +Some examples don't require non secure mode and can be built with ``octopus_som/nrf9160`` board target. + +Flashing +======== +Refer to the instruction in the :ref:`nordic_segger` page to install and +configure all the necessary software. + +Use the :zephyr:code-sample:`blinky` sample to test if Zephyr is running correctly on your board. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: octopus_som/nrf9160 + :goals: build flash + +Debugging +========= +Refer to the instruction in the :ref:`nordic_segger` page for information on +debugging. + +References +********** + +.. target-notes:: + +.. _Octopus SoM Product Page: https://www.norik.com/2024/09/16/octopus-som/ +.. _Octopus SoM Documentation: https://www.norik.com/wp-content/uploads/2024/09/Octopus_SoM_Datasheet.pdf diff --git a/boards/norik/octopus_som/dts/bindings/norik,sim_select.yaml b/boards/norik/octopus_som/dts/bindings/norik,sim_select.yaml new file mode 100644 index 00000000000..2745afaac94 --- /dev/null +++ b/boards/norik/octopus_som/dts/bindings/norik,sim_select.yaml @@ -0,0 +1,26 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +description: | + The Octopus SoM provides the user 2 options for connecting + a SIM card to the nRF9160. Option one is to use on-board eSIM or + external nano SIM. Which SIM is used can be selected using the 'sim' + property of the 'sim_select' dt node. + +compatible: "norik,sim_select" + +include: base.yaml + +properties: + sim-gpios: + type: phandle-array + required: true + description: Pin used to select which SIM is used + + sim: + type: string + required: true + enum: + - "on-board" + - "external" + description: SIM choice (on-board eSIM or external nano SIM) diff --git a/boards/norik/octopus_som/octopus_som_common-pinctrl.dtsi b/boards/norik/octopus_som/octopus_som_common-pinctrl.dtsi new file mode 100644 index 00000000000..52e65b6302c --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_common-pinctrl.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart0_default: uart0_default { + group1 { + psels = , + ; + }; + }; + + uart0_sleep: uart0_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + pwm0_default: pwm0_default { + group1 { + psels = ; + }; + }; + + pwm0_sleep: pwm0_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; + + spi3_default: spi3_default { + group1 { + psels = , + , + ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/norik/octopus_som/octopus_som_common.dtsi b/boards/norik/octopus_som/octopus_som_common.dtsi new file mode 100644 index 00000000000..538dfa3c0ec --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_common.dtsi @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ +#include "octopus_som_common-pinctrl.dtsi" + +/ { + model = "Norik Octopus SoM"; + compatible = "norik,octopus-som"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio0 7 0>; + label = "Green LED 1"; + }; + + }; + + pwmleds { + compatible = "pwm-leds"; + + pwm_led0: pwm_led_0 { + pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; + + sim_select: sim_select { + compatible = "norik,sim_select"; + sim-gpios= <&gpio0 25 GPIO_ACTIVE_HIGH>; + sim = "external"; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + pwm-led0 = &pwm_led0; + watchdog0 = &wdt0; + accel0 = &adxl362; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_default>; + pinctrl-1 = <&pwm0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&spi3 { + compatible = "nordic,nrf-spim"; + status = "okay"; + cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi3_default>; + pinctrl-1 = <&spi3_sleep>; + pinctrl-names = "default", "sleep"; + + adxl362: adxl362@0 { + compatible = "adi,adxl362"; + spi-max-frequency = <8000000>; + reg = <0>; + int1-gpios = <&gpio0 12 0>; + }; +}; + +/* Include default memory partition configuration file */ +#include diff --git a/boards/norik/octopus_som/octopus_som_defconfig b/boards/norik/octopus_som/octopus_som_defconfig new file mode 100644 index 00000000000..c486d832382 --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_defconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/norik/octopus_som/octopus_som_nrf9160.dts b/boards/norik/octopus_som/octopus_som_nrf9160.dts new file mode 100644 index 00000000000..b0e9f77fe0d --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_nrf9160.dts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "octopus_som_common.dtsi" + +/ { + chosen { + zephyr,sram = &sram0_s; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,sram-secure-partition = &sram0_s; + zephyr,sram-non-secure-partition = &sram0_ns; + }; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; +}; diff --git a/boards/norik/octopus_som/octopus_som_nrf9160.yaml b/boards/norik/octopus_som/octopus_som_nrf9160.yaml new file mode 100644 index 00000000000..44a13234b8a --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_nrf9160.yaml @@ -0,0 +1,17 @@ +identifier: octopus_som/nrf9160 +name: Norik Octopus SoM +type: mcu +arch: arm +ram: 88 +flash: 1024 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - gpio + - i2c + - spi + - pwm + - watchdog +vendor: norik diff --git a/boards/norik/octopus_som/octopus_som_nrf9160_ns.dts b/boards/norik/octopus_som/octopus_som_nrf9160_ns.dts new file mode 100644 index 00000000000..3cd80c2ca33 --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_nrf9160_ns.dts @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "octopus_som_common.dtsi" + +/ { + chosen { + zephyr,flash = &flash0; + zephyr,sram = &sram0_ns_app; + zephyr,code-partition = &slot0_ns_partition; + }; +}; diff --git a/boards/norik/octopus_som/octopus_som_nrf9160_ns.yaml b/boards/norik/octopus_som/octopus_som_nrf9160_ns.yaml new file mode 100644 index 00000000000..85bb40d75ab --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_nrf9160_ns.yaml @@ -0,0 +1,17 @@ +identifier: octopus_som/nrf9160/ns +name: Norik Octopus SoM Non-Secure +type: mcu +arch: arm +ram: 128 +flash: 192 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - gpio + - i2c + - spi + - pwm + - watchdog +vendor: norik diff --git a/boards/norik/octopus_som/octopus_som_nrf9160_ns_defconfig b/boards/norik/octopus_som/octopus_som_nrf9160_ns_defconfig new file mode 100644 index 00000000000..0f0b3336db6 --- /dev/null +++ b/boards/norik/octopus_som/octopus_som_nrf9160_ns_defconfig @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable TrustZone-M +CONFIG_ARM_TRUSTZONE_M=y + +# This Board implies building Non-Secure firmware +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y