diff --git a/boards/norik/octopus_io_board/CMakeLists.txt b/boards/norik/octopus_io_board/CMakeLists.txt new file mode 100644 index 00000000000..2e35c87b81d --- /dev/null +++ b/boards/norik/octopus_io_board/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_io_board/Kconfig b/boards/norik/octopus_io_board/Kconfig new file mode 100644 index 00000000000..74f296b0e3e --- /dev/null +++ b/boards/norik/octopus_io_board/Kconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_OCTOPUS_IO_BOARD + select BOARD_LATE_INIT_HOOK + select GPIO + +module = OCTOPUS_IO_BOARD_CONTROL +module-str = Board Control +source "subsys/logging/Kconfig.template.log_config" diff --git a/boards/norik/octopus_io_board/Kconfig.defconfig b/boards/norik/octopus_io_board/Kconfig.defconfig new file mode 100644 index 00000000000..4c00ab52ab5 --- /dev/null +++ b/boards/norik/octopus_io_board/Kconfig.defconfig @@ -0,0 +1,33 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_OCTOPUS_IO_BOARD + +# 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_IO_BOARD && TRUSTED_EXECUTION_SECURE + +if BOARD_OCTOPUS_IO_BOARD_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_IO_BOARD_NRF9160_NS + +endif # BOARD_OCTOPUS_IO_BOARD diff --git a/boards/norik/octopus_io_board/Kconfig.octopus_io_board b/boards/norik/octopus_io_board/Kconfig.octopus_io_board new file mode 100644 index 00000000000..1b24864afda --- /dev/null +++ b/boards/norik/octopus_io_board/Kconfig.octopus_io_board @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Norik Systems +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_OCTOPUS_IO_BOARD + select SOC_NRF9160_SICA diff --git a/boards/norik/octopus_io_board/board.c b/boards/norik/octopus_io_board/board.c new file mode 100644 index 00000000000..901bdae01d8 --- /dev/null +++ b/boards/norik/octopus_io_board/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_IO_BOARD_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_io_board/board.cmake b/boards/norik/octopus_io_board/board.cmake new file mode 100644 index 00000000000..e1ae7b4e9b2 --- /dev/null +++ b/boards/norik/octopus_io_board/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_io_board/board.yml b/boards/norik/octopus_io_board/board.yml new file mode 100644 index 00000000000..fe114911b3a --- /dev/null +++ b/boards/norik/octopus_io_board/board.yml @@ -0,0 +1,8 @@ +board: + name: octopus_io_board + full_name: Octopus IO-Board + vendor: norik + socs: + - name: nrf9160 + variants: + - name: 'ns' diff --git a/boards/norik/octopus_io_board/doc/img/octopus_io_board.webp b/boards/norik/octopus_io_board/doc/img/octopus_io_board.webp new file mode 100644 index 00000000000..ea170c7e3c0 Binary files /dev/null and b/boards/norik/octopus_io_board/doc/img/octopus_io_board.webp differ diff --git a/boards/norik/octopus_io_board/doc/index.rst b/boards/norik/octopus_io_board/doc/index.rst new file mode 100644 index 00000000000..bf520d05d8a --- /dev/null +++ b/boards/norik/octopus_io_board/doc/index.rst @@ -0,0 +1,146 @@ +.. zephyr:board:: octopus_io_board + +Overview +******** + +Octopus IO-Board is an expansion to the Octopus SoM, which is built around the nRF9160 SiP +offering NB-IoT and LTE-M connectivity, GPS and accelerometer. Octopus IO-Board expands +the capabilities of the Octopus SoM by providing additional peripherals and interfaces for +development and prototyping of low-power 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)` + +Octopus IO-Board offers the following features: + +* Battery charger +* USB-C for power +* Solar charger +* Alkaline battery input +* LDO regulator to power Octopus SoM and peripherals +* Battery monitoring using ADC +* 64 Mbit SPI NOR flash +* Dedicated ADC, GPIO, I2C, SPI and UARTE pins for expansion +* Exposed headers for current measurements +* Nano SIM connector +* Tag-Connect TC2030-IDC 6-pin connector for SWD programming and debugging +* 2x3 pinheader for SWD programming and debugging + +More information about the board can be found at the `Octopus IO-Board Product Page`_ +and in the `Octopus IO-Board Documentation`_. + +Hardware +******** + +Connections and IOs +=================== + +The Octopus IO-Board features multiple dedicated pin headers for peripherals: + +* 3x I2C0 bus +* 2x SPI0 bus +* 3x I2C1/SPI1 bus (selectable) +* 1x UARTE0 bus +* 1x Analog input (5 input pins) +* 1x GPIO (7 I/O pins) + +The I2C1/SPI1 bus is selectable by the user by cutting/soldering SB8 and SB9 solder bridges and configuring the bus in the device tree. + +The GPIO pin header provides 7 I/O pins, which can be used as digital input/output. Some of them also serve as chip selects for SPI peripherals. + +Power supply +============ + +The Octopus IO-Board can be powered from the following sources: + +* USB-C connector +* Solar cell +* Alkaline battery +* Li-Po battery + +When powered from USB-C or solar cell, the board can charge the Li-Po battery. The battery voltage can be monitored using ADC which can +provide information about the battery State of charge (SOC). + +When powered from alkaline battery, the user needs to set switch SW1 to ALK position. This ensures that the Li-Ion battery is not charged from the alkaline battery. + +The board has a built-in LDO regulator that is used to power the Octopus SoM and peripherals. The EN2 pin can be used to enable/disable output 2 of the LDO regulator. +This can be used to power off peripherals to save power when they are not needed. + +The board also has multiple built-in test points for measuring current consumption of the board, which enables the user to measure and optimize the power consumption of the board. + +Programming and Debugging +************************* + +Norik Octopus IO-Board can be programmed and debugged using the Tag-Connect TC2030-IDC 6-pin connector or 6-pin SWD pinheader. + +Building an application +======================= + +In most case you'll need to use ``octopus_io_board/nrf9160/ns`` board target for building examples. +Some examples don't require non secure mode and can be built with ``octopus_io_board/nrf9160`` board target. + +Flashing +======== +Refer to the instruction in the :ref:`nordic_segger` page to install and +configure all the necessary software. + +Here is an example for the Hello World application. + +First, run your favorite terminal program to listen for output. + +.. code-block:: console + + $ minicom /dev/ 115200 + +Replace with the port where the Octopus IO-Board can be found. For example, under Linux, /dev/ttyACM0. + +Then build and flash the application in the usual way. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: octopus_io_board/nrf9160 + :goals: build flash + +To build and flash the application in non-secure mode, use the following command: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: octopus_io_board/nrf9160/ns + :goals: build flash + +Debugging +========= +Refer to the instruction in the :ref:`nordic_segger` page for information on +debugging. + +Testing the on-board LED +======================== +Use the :zephyr:code-sample:`blinky` to test the on-board LED. Build and flash the example to make sure Zephyr is running correctly on your board. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: octopus_io_board/nrf9160 + :goals: build flash + +References +********** + +.. target-notes:: + +.. _Octopus IO-Board Product Page: https://www.norik.com/2024/09/16/octopus-io-board/ +.. _Octopus IO-Board Documentation: https://www.norik.com/wp-content/uploads/2024/09/Octopus_IO-Board_Datasheet.pdf diff --git a/boards/norik/octopus_io_board/dts/bindings/norik,sim_select.yaml b/boards/norik/octopus_io_board/dts/bindings/norik,sim_select.yaml new file mode 100644 index 00000000000..2745afaac94 --- /dev/null +++ b/boards/norik/octopus_io_board/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_io_board/octopus_io_board_common-pinctrl.dtsi b/boards/norik/octopus_io_board/octopus_io_board_common-pinctrl.dtsi new file mode 100644 index 00000000000..8f46475d246 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_common-pinctrl.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + i2c0_default: i2c0_default { + group1 { + psels = , + ; + }; + }; + + i2c0_sleep: i2c0_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + i2c1_default: i2c1_default { + group1 { + psels = , + ; + }; + }; + + i2c1_sleep: i2c1_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/norik/octopus_io_board/octopus_io_board_common.dtsi b/boards/norik/octopus_io_board/octopus_io_board_common.dtsi new file mode 100644 index 00000000000..f73a0e20b03 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_common.dtsi @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ +#include "octopus_io_board_common-pinctrl.dtsi" +#include "../octopus_som/octopus_som_common.dtsi" + +/ { + model = "Norik Octopus IO-Board"; + compatible = "norik,octopus-io-board"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + watchdog0 = &wdt0; + }; +}; + +&i2c1 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c0_default>; + pinctrl-1 = <&i2c0_sleep>; + pinctrl-names = "default", "sleep"; + + bq25180: bq25180@6a { + compatible = "ti,bq25180"; + status = "okay"; + reg = <0x6a>; + constant-charge-current-max-microamp = <10000>; + }; +}; + +&spi3 { + status = "okay"; + cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>,<&gpio0 5 GPIO_ACTIVE_LOW>; + + adxl362: adxl362@0 { + compatible = "adi,adxl362"; + spi-max-frequency = <8000000>; + reg = <0>; + int1-gpios = <&gpio0 12 0>; + }; + + w25q64: w25q64@1 { + compatible = "jedec,spi-nor"; + status = "okay"; + reg = <1>; + spi-max-frequency = <8000000>; + jedec-id = [ef 40 17]; + size = <0x4000000>; + has-dpd; + t-enter-dpd = <3500>; + t-exit-dpd = <3500>; + }; +}; diff --git a/boards/norik/octopus_io_board/octopus_io_board_defconfig b/boards/norik/octopus_io_board/octopus_io_board_defconfig new file mode 100644 index 00000000000..c486d832382 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_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_io_board/octopus_io_board_nrf9160.dts b/boards/norik/octopus_io_board/octopus_io_board_nrf9160.dts new file mode 100644 index 00000000000..aae7cb1f345 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_nrf9160.dts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "octopus_io_board_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_io_board/octopus_io_board_nrf9160.yaml b/boards/norik/octopus_io_board/octopus_io_board_nrf9160.yaml new file mode 100644 index 00000000000..e91c1da14b5 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_nrf9160.yaml @@ -0,0 +1,17 @@ +identifier: octopus_io_board/nrf9160 +name: Norik Octopus IO-Board +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_io_board/octopus_io_board_nrf9160_ns.dts b/boards/norik/octopus_io_board/octopus_io_board_nrf9160_ns.dts new file mode 100644 index 00000000000..fa24ffbf565 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_nrf9160_ns.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Norik Systems + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "octopus_io_board_common.dtsi" + +/ { + chosen { + zephyr,flash = &flash0; + zephyr,sram = &sram0_ns; + zephyr,code-partition = &slot0_ns_partition; + }; +}; + +/* Disable UART1, because it is used by default in TF-M */ + +&uart1 { + status = "disabled"; +}; diff --git a/boards/norik/octopus_io_board/octopus_io_board_nrf9160_ns.yaml b/boards/norik/octopus_io_board/octopus_io_board_nrf9160_ns.yaml new file mode 100644 index 00000000000..675c316f6c2 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_nrf9160_ns.yaml @@ -0,0 +1,17 @@ +identifier: octopus_io_board/nrf9160/ns +name: Norik Octopus IO-Board 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_io_board/octopus_io_board_nrf9160_ns_defconfig b/boards/norik/octopus_io_board/octopus_io_board_nrf9160_ns_defconfig new file mode 100644 index 00000000000..0f0b3336db6 --- /dev/null +++ b/boards/norik/octopus_io_board/octopus_io_board_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 diff --git a/dts/bindings/vendor-prefixes.txt b/dts/bindings/vendor-prefixes.txt index 8065cfa64b0..0c344963fe6 100644 --- a/dts/bindings/vendor-prefixes.txt +++ b/dts/bindings/vendor-prefixes.txt @@ -464,6 +464,7 @@ nintendo Nintendo nlt NLT Technologies, Ltd. nokia Nokia nordic Nordic Semiconductor +norik Norik Systems noritake Noritake Co., Inc. Electronics Division novtech NovTech, Inc. nuclei Nuclei System Technology