diff --git a/boards/rakwireless/rak3112/Kconfig b/boards/rakwireless/rak3112/Kconfig new file mode 100644 index 0000000000000..5cdd26ff3cfb5 --- /dev/null +++ b/boards/rakwireless/rak3112/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2025 Kenneth Lu +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_RAK3112_ESP32S3_PROCPU + default 256 if BOARD_RAK3112_ESP32S3_APPCPU diff --git a/boards/rakwireless/rak3112/Kconfig.rak3112 b/boards/rakwireless/rak3112/Kconfig.rak3112 new file mode 100644 index 0000000000000..e68624c2ef5f9 --- /dev/null +++ b/boards/rakwireless/rak3112/Kconfig.rak3112 @@ -0,0 +1,7 @@ +# Copyright (c) 2025 Kenneth Lu +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_RAK3112 + select SOC_ESP32S3_R2 + select SOC_ESP32S3_PROCPU if BOARD_RAK3112_ESP32S3_PROCPU + select SOC_ESP32S3_APPCPU if BOARD_RAK3112_ESP32S3_APPCPU diff --git a/boards/rakwireless/rak3112/Kconfig.sysbuild b/boards/rakwireless/rak3112/Kconfig.sysbuild new file mode 100644 index 0000000000000..8d3acb9e11d7c --- /dev/null +++ b/boards/rakwireless/rak3112/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_NONE +endchoice diff --git a/boards/rakwireless/rak3112/board.cmake b/boards/rakwireless/rak3112/board.cmake new file mode 100644 index 0000000000000..2f04d1fe8861e --- /dev/null +++ b/boards/rakwireless/rak3112/board.cmake @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*") + set(OPENOCD OPENOCD-NOTFOUND) +endif() +find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH) + +include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/rakwireless/rak3112/board.yml b/boards/rakwireless/rak3112/board.yml new file mode 100644 index 0000000000000..b207063c907ca --- /dev/null +++ b/boards/rakwireless/rak3112/board.yml @@ -0,0 +1,6 @@ +board: + name: rak3112 + full_name: RAK3112 + vendor: rakwireless + socs: + - name: esp32s3 diff --git a/boards/rakwireless/rak3112/doc/img/pinout.webp b/boards/rakwireless/rak3112/doc/img/pinout.webp new file mode 100644 index 0000000000000..66cc13c0314f5 Binary files /dev/null and b/boards/rakwireless/rak3112/doc/img/pinout.webp differ diff --git a/boards/rakwireless/rak3112/doc/img/rak3112.webp b/boards/rakwireless/rak3112/doc/img/rak3112.webp new file mode 100644 index 0000000000000..aec022b80ec86 Binary files /dev/null and b/boards/rakwireless/rak3112/doc/img/rak3112.webp differ diff --git a/boards/rakwireless/rak3112/doc/index.rst b/boards/rakwireless/rak3112/doc/index.rst new file mode 100644 index 0000000000000..c7c4c592fb74b --- /dev/null +++ b/boards/rakwireless/rak3112/doc/index.rst @@ -0,0 +1,81 @@ +.. zephyr:board:: rak3112 + +Overview +******** + +The RAK3112 is a low-power, long-range LoRaWAN module based on the +Espressif ESP32-S3 MCU with an integrated Semtech SX1262 LoRa +transceiver. Supporting LoRa, BLE, and Wi-Fi, this module is ideal for +various IoT applications such as home automation, sensor networks, +building automation, and other IoT network applications. + +Hardware +******** + +It is designed for easy access to the pins on the board and to simplify the evaluation of the RAK3112 +module. + +The main hardware features are: + +- RAK3112 based on Espressif ESP32-S3, dual-core Xtensa® LX7 CPU up to 240 MHz +- Semtech SX1262 for LoRa® modulations +- Integrated 2.4 GHz Wi-Fi (802.11 b/g/n) and Bluetooth® LE 5 +- 512 KB of SRAM and 384 KB of ROM on the chip +- IPEX connectors for the antennas +- I/O ports: + + - UART + - I2C + - SPI + - GPIO + - ADC + +.. image:: img/pinout.webp + :align: center + :alt: RAK3112-pinout + +For more information about the RAK3112 stamp module: + +- `WisDuo RAK3112 Website`_ +- `Espressif ESP32-S3 Website`_ + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +System requirements +******************* + +Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command +below to retrieve those files. + +.. code-block:: console + + west blobs fetch hal_espressif + +.. note:: + + It is recommended running the command above after :file:`west update`. + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +.. include:: ../../../espressif/common/building-flashing.rst + :start-after: espressif-building-flashing + +.. include:: ../../../espressif/common/board-variants.rst + :start-after: espressif-board-variants + +References +********** + +.. target-notes:: + +.. _WisDuo RAK3112 Website: + https://docs.rakwireless.com/Product-Categories/WisDuo/RAK3112-Module/Overview/ + +.. _Espressif ESP32-S3 Website: + https://www.espressif.com/en/products/socs/esp32-s3 diff --git a/boards/rakwireless/rak3112/rak3112-pinctrl.dtsi b/boards/rakwireless/rak3112/rak3112-pinctrl.dtsi new file mode 100644 index 0000000000000..6a42403fcae1d --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112-pinctrl.dtsi @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 Kenneth Lu + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + + i2c0_default: i2c0_default { + group1 { + pinmux = , ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + i2c1_default: i2c1_default { + group1 { + pinmux = , ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , + , + ; + }; + + group2 { + pinmux = ; + output-low; + }; + }; + + spim3_default: spim3_default { + group1 { + pinmux = , + , + ; + }; + + group2 { + pinmux = ; + output-low; + }; + }; + + uart0_default: uart0_default { + group1 { + pinmux = ; + output-high; + }; + + group2 { + pinmux = ; + bias-pull-up; + }; + }; +}; diff --git a/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu.dts b/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu.dts new file mode 100644 index 0000000000000..c66cd80eff587 --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu.dts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Kenneth Lu + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include + +/ { + model = "RAK3112 APPCPU"; + compatible = "rakwireless,rak3112"; + + chosen { + zephyr,sram = &sram1; + zephyr,ipc_shm = &shm0; + zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; + }; +}; + +&flash0 { + reg = <0x0 DT_SIZE_M(16)>; +}; + +&trng0 { + status = "okay"; +}; diff --git a/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu.yaml b/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu.yaml new file mode 100644 index 0000000000000..09d587a89b237 --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu.yaml @@ -0,0 +1,27 @@ +identifier: rak3112/esp32s3/appcpu +name: RAK3112 APPCPU +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - uart +testing: + ignore_tags: + - net + - bluetooth + - flash + - cpp + - posix + - watchdog + - logging + - kernel + - pm + - gpio + - crypto + - eeprom + - heap + - cmsis_rtos + - jwt + - zdsp +vendor: rakwireless diff --git a/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu_defconfig b/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu_defconfig new file mode 100644 index 0000000000000..48546641cadd6 --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112_esp32s3_appcpu_defconfig @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CLOCK_CONTROL=y diff --git a/boards/rakwireless/rak3112/rak3112_esp32s3_procpu.dts b/boards/rakwireless/rak3112/rak3112_esp32s3_procpu.dts new file mode 100644 index 0000000000000..1d17866da53e7 --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112_esp32s3_procpu.dts @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2025 Kenneth Lu + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "rak3112-pinctrl.dtsi" +#include +#include +#include + +/ { + model = "RAK3112 PROCPU"; + compatible = "espressif,esp32s3"; + + aliases { + i2c-1 = &i2c1; + uart-0 = &uart0; + watchdog0 = &wdt0; + lora0 = &lora; + }; + + chosen { + zephyr,sram = &sram1; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,bt-hci = &esp32_bt_hci; + }; +}; + +&flash0 { + reg = <0x0 DT_SIZE_M(16)>; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&spi2 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; + + lora: lora@0 { + compatible = "semtech,sx1262"; + reg = <0>; + reset-gpios = <&gpio 8 (GPIO_OPEN_DRAIN | GPIO_ACTIVE_LOW)>; + busy-gpios = <&gpio 48 GPIO_ACTIVE_HIGH>; + dio1-gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; + antenna-enable-gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + dio2-tx-enable; + dio3-tcxo-voltage = ; + tcxo-power-startup-delay-ms = <5>; + spi-max-frequency = <1000000>; + }; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&wdt0 { + status = "okay"; +}; + +&trng0 { + status = "okay"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&timer2 { + status = "okay"; +}; + +&timer3 { + status = "okay"; +}; + +&esp32_bt_hci { + status = "okay"; +}; + +&wifi { + status = "okay"; +}; diff --git a/boards/rakwireless/rak3112/rak3112_esp32s3_procpu.yaml b/boards/rakwireless/rak3112/rak3112_esp32s3_procpu.yaml new file mode 100644 index 0000000000000..d1c57a8f33fe0 --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112_esp32s3_procpu.yaml @@ -0,0 +1,18 @@ +identifier: rak3112/esp32s3/procpu +name: RAK3112 PROCPU +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - i2c + - spi + - watchdog + - regulator + - uart + - pwm + - pinmux + - nvs + - display +vendor: rakwireless diff --git a/boards/rakwireless/rak3112/rak3112_esp32s3_procpu_defconfig b/boards/rakwireless/rak3112/rak3112_esp32s3_procpu_defconfig new file mode 100644 index 0000000000000..f519fbab75a48 --- /dev/null +++ b/boards/rakwireless/rak3112/rak3112_esp32s3_procpu_defconfig @@ -0,0 +1,8 @@ +# Copyright (c) 2025 Kenneth Lu +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_GPIO=y +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_CLOCK_CONTROL=y diff --git a/boards/rakwireless/rak3112/support/openocd.cfg b/boards/rakwireless/rak3112/support/openocd.cfg new file mode 100644 index 0000000000000..2f740b4a36ab1 --- /dev/null +++ b/boards/rakwireless/rak3112/support/openocd.cfg @@ -0,0 +1,7 @@ +set ESP_RTOS none +set ESP32_ONLYCPU 1 + +# Source the JTAG interface configuration file +source [find interface/esp_usb_jtag.cfg] +# Source the ESP32-S3 configuration file +source [find target/esp32s3.cfg]