diff --git a/boards/01space/esp32c3_042_oled/Kconfig.defconfig b/boards/01space/esp32c3_042_oled/Kconfig.defconfig new file mode 100644 index 00000000000..4171bb04bc2 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright 2022 Google LLC +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 65535 if WIFI && BT + default 51200 if WIFI + default 40960 if BT + default 4096 diff --git a/boards/01space/esp32c3_042_oled/Kconfig.esp32c3_042_oled b/boards/01space/esp32c3_042_oled/Kconfig.esp32c3_042_oled new file mode 100644 index 00000000000..8b0fbf42eab --- /dev/null +++ b/boards/01space/esp32c3_042_oled/Kconfig.esp32c3_042_oled @@ -0,0 +1,5 @@ +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ESP32C3_042_OLED + select SOC_ESP32C3_FX4 diff --git a/boards/01space/esp32c3_042_oled/Kconfig.sysbuild b/boards/01space/esp32c3_042_oled/Kconfig.sysbuild new file mode 100644 index 00000000000..3a2d17ac5cf --- /dev/null +++ b/boards/01space/esp32c3_042_oled/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# Copyright (c) 2023 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/01space/esp32c3_042_oled/board.cmake b/boards/01space/esp32c3_042_oled/board.cmake new file mode 100644 index 00000000000..2f04d1fe886 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/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/01space/esp32c3_042_oled/board.yml b/boards/01space/esp32c3_042_oled/board.yml new file mode 100644 index 00000000000..40b7b0f5816 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/board.yml @@ -0,0 +1,5 @@ +board: + name: esp32c3_042_oled + vendor: 01space + socs: + - name: esp32c3 diff --git a/boards/01space/esp32c3_042_oled/doc/img/esp32c3_042_oled.webp b/boards/01space/esp32c3_042_oled/doc/img/esp32c3_042_oled.webp new file mode 100644 index 00000000000..74abd1fd467 Binary files /dev/null and b/boards/01space/esp32c3_042_oled/doc/img/esp32c3_042_oled.webp differ diff --git a/boards/01space/esp32c3_042_oled/doc/img/esp32c3_042_oled_pinout.webp b/boards/01space/esp32c3_042_oled/doc/img/esp32c3_042_oled_pinout.webp new file mode 100644 index 00000000000..161e4c0680e Binary files /dev/null and b/boards/01space/esp32c3_042_oled/doc/img/esp32c3_042_oled_pinout.webp differ diff --git a/boards/01space/esp32c3_042_oled/doc/index.rst b/boards/01space/esp32c3_042_oled/doc/index.rst new file mode 100644 index 00000000000..df7bf11286c --- /dev/null +++ b/boards/01space/esp32c3_042_oled/doc/index.rst @@ -0,0 +1,172 @@ +.. _01space_esp32c3_042_oled: + +ESP32C3 0.42 OLED +################# + +Overview +******** + +ESP32C3 0.42 OLED is a mini development board based on the `Espressif ESP32-C3`_ +RISC-V WiFi/Bluetooth dual-mode chip. + +For more details see the `01space ESP32C3 0.42 OLED`_ Github repo. + +.. figure:: img/esp32c3_042_oled.webp + :align: center + :alt: 01space ESP32C3 0.42 OLED + + 01space ESP32C3 0.42 OLED + +Hardware +******** + +This board is based on the ESP32-C3-FH4 with WiFi and BLE support. +It features: + +* RISC-V SoC @ 160MHz with 4MB flash and 400kB RAM +* WS2812B RGB serial LED +* 0.42-inch OLED over I2C +* Qwiic I2C connector +* One pushbutton +* Onboard ceramic chip antenna +* On-chip USB-UART converter + +.. note:: + + The RGB led is not supported on this Zephyr board yet. + +.. note:: + + The ESP32-C3 does not have native USB, it has an on-chip USB-serial converter + instead. + +Supported Features +================== + +The 01space ESP32C3 0.42 OLED board configuration supports the following hardware features: + ++-----------+------------+------------------+ +| Interface | Controller | Driver/Component | ++===========+============+==================+ +| PMP | on-chip | arch/riscv | ++-----------+------------+------------------+ +| INTMTRX | on-chip | intc_esp32c3 | ++-----------+------------+------------------+ +| PINMUX | on-chip | pinctrl_esp32 | ++-----------+------------+------------------+ +| USB UART | on-chip | serial_esp32_usb | ++-----------+------------+------------------+ +| GPIO | on-chip | gpio_esp32 | ++-----------+------------+------------------+ +| UART | on-chip | uart_esp32 | ++-----------+------------+------------------+ +| I2C | on-chip | i2c_esp32 | ++-----------+------------+------------------+ +| SPI | on-chip | spi_esp32_spim | ++-----------+------------+------------------+ +| RADIO | on-chip | Bluetooth | ++-----------+------------+------------------+ +| DISPLAY | off-chip | display | ++-----------+------------+------------------+ + +Connections and IOs +=================== + +See the following image: + +.. figure:: img/esp32c3_042_oled_pinout.webp + :align: center + :alt: 01space ESP32C3 0.42 OLED Pinout + + 01space ESP32C3 0.42 OLED Pinout + +It also features a 0.42 inch OLED display, driven by a SSD1306-compatible chip. +It is connected over I2C: SDA on GPIO5, SCL on GPIO6. + +Prerequisites +============= + +Espressif HAL requires WiFi and Bluetooth binary blobs. 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 +************************* + +Standalone application +====================== + +The board can be loaded using a single binary image, without 2nd stage bootloader. +It is the default option when building the application without additional configuration. + +.. note:: + + This mode does not provide any security features nor OTA updates. + +Use the following command to build a sample hello_world application: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: esp32c3_042_oled + :goals: build + +Sysbuild +======== + +:ref:`sysbuild` makes it possible to build and flash all necessary images needed to +bootstrap the board. + +By default, the ESP32 sysbuild configuration creates bootloader (MCUboot) and +application images. + +To build the sample application using sysbuild, use this command: + +.. zephyr-app-commands:: + :tool: west + :app: samples/hello_world + :board: esp32c3_042_oled + :goals: build + :west-args: --sysbuild + :compact: + +Flashing +======== + +For the :code:`Hello, world!` application, follow the instructions below. +Assuming the board is connected to ``/dev/ttyACM0`` on Linux. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: esp32c3_042_oled + :goals: flash + :flash-args: --esp-device /dev/ttyACM0 + +Since the Zephyr console is by default on the ``usb_serial`` device, we use +the espressif monitor utility to connect to the console. + +.. code-block:: console + + $ west espressif monitor -p /dev/ttyACM0 + +After the board has automatically reset and booted, you should see the following +message in the monitor: + +.. code-block:: console + + ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** + Hello World! esp32c3_042_oled + +References +********** + +.. target-notes:: + +.. _`Espressif ESP32-C3`: https://www.espressif.com/en/products/socs/esp32-c3 +.. _`01space ESP32C3 0.42 OLED`: https://github.com/01Space/ESP32-C3-0.42LCD diff --git a/boards/01space/esp32c3_042_oled/esp32c3_042_oled-pinctrl.dtsi b/boards/01space/esp32c3_042_oled/esp32c3_042_oled-pinctrl.dtsi new file mode 100644 index 00000000000..dec47fbcd44 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/esp32c3_042_oled-pinctrl.dtsi @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + uart1_default: uart1_default { + group1 { + pinmux = ; + output-high; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , + ; + }; + group2 { + pinmux = ; + output-low; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; +}; diff --git a/boards/01space/esp32c3_042_oled/esp32c3_042_oled.dts b/boards/01space/esp32c3_042_oled/esp32c3_042_oled.dts new file mode 100644 index 00000000000..c7680c0b152 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/esp32c3_042_oled.dts @@ -0,0 +1,140 @@ +/* + * Copyright 2022 Google LLC + * Copyright 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "esp32c3_042_oled-pinctrl.dtsi" + +/ { + model = "01space ESP32C3 0.42 OLED"; + + chosen { + zephyr,sram = &sram0; + zephyr,console = &usb_serial; + zephyr,shell-uart = &usb_serial; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,canbus = &twai; + zephyr,bt-hci = &esp32_bt_hci; + zephyr,display = &eastrising_72x40; + }; + + aliases { + i2c-0 = &i2c0; + watchdog0 = &wdt0; + }; + + /* WS2812B LED connected to GPIO2 */ +}; + +/* Have to use uart1 as some tests are hardcoded for that DTS node :/ */ +&uart1 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart1_default>; + pinctrl-names = "default"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; + + eastrising_72x40: ssd1306@3c { + compatible = "solomon,ssd1306fb"; + reg = <0x3c>; + + width = <72>; + height = <40>; + + segment-offset = <28>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <0x27>; + prechargep = <0x22>; + ready-time-ms = <10>; + segment-remap; + com-invdir; + use-internal-iref; + }; +}; + +&spi2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; +}; + +&usb_serial { + status = "okay"; +}; + +&trng0 { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&wifi { + status = "okay"; +}; + +&esp32_bt_hci { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000F000>; + read-only; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00100000>; + }; + + slot1_partition: partition@110000 { + label = "image-1"; + reg = <0x00110000 0x00100000>; + }; + + scratch_partition: partition@210000 { + label = "image-scratch"; + reg = <0x00210000 0x00040000>; + }; + + storage_partition: partition@250000 { + label = "storage"; + reg = <0x00250000 0x00006000>; + }; + }; +}; diff --git a/boards/01space/esp32c3_042_oled/esp32c3_042_oled.yaml b/boards/01space/esp32c3_042_oled/esp32c3_042_oled.yaml new file mode 100644 index 00000000000..4f9e9c93778 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/esp32c3_042_oled.yaml @@ -0,0 +1,18 @@ +identifier: esp32c3_042_oled +name: ESP32C3 0.42 OLED +type: mcu +arch: riscv +toolchain: + - zephyr +supported: + - display + - gpio + - i2c + - spi + - uart + - watchdog +testing: + ignore_tags: + - net + - bluetooth +vendor: 01space diff --git a/boards/01space/esp32c3_042_oled/esp32c3_042_oled_defconfig b/boards/01space/esp32c3_042_oled/esp32c3_042_oled_defconfig new file mode 100644 index 00000000000..ef633ce56a1 --- /dev/null +++ b/boards/01space/esp32c3_042_oled/esp32c3_042_oled_defconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y diff --git a/boards/01space/esp32c3_042_oled/support/openocd.cfg b/boards/01space/esp32c3_042_oled/support/openocd.cfg new file mode 100644 index 00000000000..7421637880c --- /dev/null +++ b/boards/01space/esp32c3_042_oled/support/openocd.cfg @@ -0,0 +1,6 @@ +set ESP_RTOS none + +source [find interface/esp_usb_jtag.cfg] + +source [find target/esp32c3.cfg] +adapter speed 5000 diff --git a/boards/01space/index.rst b/boards/01space/index.rst new file mode 100644 index 00000000000..322a0f31840 --- /dev/null +++ b/boards/01space/index.rst @@ -0,0 +1,10 @@ +.. _boards-01space: + +01space +####### + +.. toctree:: + :maxdepth: 1 + :glob: + + **/* diff --git a/dts/bindings/vendor-prefixes.txt b/dts/bindings/vendor-prefixes.txt index edf9c4ae825..27edef9862d 100644 --- a/dts/bindings/vendor-prefixes.txt +++ b/dts/bindings/vendor-prefixes.txt @@ -11,6 +11,7 @@ # # zephyr-keep-sorted-start +01space 01Space 96boards 96Boards aaeon AAEON Technology Inc. abb ABB