boards: xtensa: m5stack_atom_lite: initial support

Source code of board/m5stack/m5stickc_plus and
board/m5stack/m5stack_atoms3_lite were adapted for an inital
support of the M5Stack ATOM Lite board.

Signed-off-by: Nikola Trifunovic <nikola@trifunovic.at>
This commit is contained in:
Nikola Trifunovic 2024-01-27 22:18:38 +01:00 committed by Fabio Baltieri
parent 2302e5f766
commit f7f5c4470a
14 changed files with 593 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# M5Stack ATOM Lite board configuration
# Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
# SPDX-License-Identifier: Apache-2.0
if BOARD_M5STACK_ATOM_LITE_ESP32_PROCPU
config HEAP_MEM_POOL_ADD_SIZE_BOARD
int
default 65535 if WIFI && BT
default 51200 if WIFI
default 40960 if BT
default 4096
choice BT_HCI_BUS_TYPE
default BT_ESP32 if BT
endchoice
endif # BOARD_M5STACK_ATOM_LITE_ESP32_PROCPU
if BOARD_M5STACK_ATOM_LITE_ESP32_APPCPU
config HEAP_MEM_POOL_ADD_SIZE_BOARD
default 256
endif # BOARD_M5STACK_ATOM_LITE_ESP32_APPCPU

View file

@ -0,0 +1,10 @@
# M5Stack Atom Lite board configuration
# Copyright (c) 2024 Nikola Trifunovic <nikola@trifunovic.at>
# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
# SPDX-License-Identifier: Apache-2.0
config BOARD_M5STACK_ATOM_LITE
select SOC_ESP32_PICO_D4
select SOC_ESP32_PROCPU if BOARD_M5STACK_ATOM_LITE_ESP32_PROCPU
select SOC_ESP32_APPCPU if BOARD_M5STACK_ATOM_LITE_ESP32_APPCPU

View file

@ -0,0 +1,12 @@
# 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)
# the default ESP32 baud rate is not supported
board_runner_args(esp32 "--esp-baud-rate=1500000")

View file

@ -0,0 +1,5 @@
board:
name: m5stack_atom_lite
vendor: m5stack
socs:
- name: esp32

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

@ -0,0 +1,134 @@
.. _m5stack_atom_lite:
M5Stack ATOM Lite
#################
Overview
********
M5Stack ATOM Lite is an ESP32-based development board from M5Stack.
It features the following integrated components:
- ESP32-PICO-D4 chip (240MHz dual core, Wi-Fi/BLE 5.0)
- 520KB SRAM
- SK6812 RGB LED
- Infrared LED
- 1x Grove extension port
.. figure:: img/m5stack_atom_lite.webp
:align: center
:alt: M5Stack ATOM Lite
M5Stack ATOM Lite
Supported Features
==================
The Zephyr m5stack_atom_lite board configuration supports the following hardware features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SPI | on-chip | spi |
+-----------+------------+-------------------------------------+
| CLOCK | on-chip | reset and clock control |
+-----------+------------+-------------------------------------+
| COUNTER | on-chip | rtc |
+-----------+------------+-------------------------------------+
| WATCHDOG | on-chip | independent watchdog |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| ADC | on-chip | adc |
+-----------+------------+-------------------------------------+
| DAC | on-chip | dac |
+-----------+------------+-------------------------------------+
| die-temp | on-chip | die temperature sensor |
+-----------+------------+-------------------------------------+
Start Application Development
*****************************
Before powering up your M5Stack ATOM Lite, please make sure that the board is in good
condition with no obvious signs of damage.
System requirements
===================
Prerequisites
-------------
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
below to retrieve those files.
.. code-block:: shell
west blobs fetch hal_espressif
.. note::
It is recommended running the command above after :file:`west update`.
Building & Flashing
-------------------
Build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: m5stack_atom_lite/esp32/procpu
:goals: build
The usual ``flash`` target will work with the ``m5stack_atom_lite`` board
configuration. Here is an example for the :ref:`hello_world`
application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: m5stack_atom_lite/esp32/procpu
:goals: flash
The baud rate of 921600bps is set by default. If experiencing issues when flashing,
try using different values by using ``--esp-baud-rate <BAUD>`` option during
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
You can also open the serial monitor using the following command:
.. code-block:: shell
west espressif monitor
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! m5stack_atom_lite
Debugging
---------
M5Stack ATOM Lite debugging is not supported due to pinout limitations.
Related Documents
*****************
- `M5Stack ATOM Lite docs <https://docs.m5stack.com/en/core/ATOM%20Lite>`_
- `M5Stack ATOM Lite schematic <https://static-cdn.m5stack.com/resource/docs/products/core/atom_lite/atom_lite_map_01.webp>`_
- `ESP32-PICO-D4 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-pico-d4_datasheet_en.pdf>`_ (PDF)

View file

@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 Nikola Trifunovic <nikola@trifunovic.at>
* Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
* SPDX-License-Identifier: Apache-2.0
*/
/ {
grove_header: grove_header {
compatible = "grove-header";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &gpio0 26 0>,
<1 0 &gpio1 0 0>;
};
};
grove_i2c1: &i2c1 {};

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2024 Nikola Trifunovic <nikola@trifunovic.at>
* Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
* Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
#include <dt-bindings/pinctrl/esp32-pinctrl.h>
#include <zephyr/dt-bindings/pinctrl/esp32-gpio-sigmap.h>
&pinctrl {
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_GPIO1>;
output-high;
};
group2 {
pinmux = <UART0_RX_GPIO3>;
bias-pull-up;
};
};
i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_GPIO25>,
<I2C0_SCL_GPIO21>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
i2c1_default: i2c1_default {
group1 {
pinmux = <I2C0_SDA_GPIO26>,
<I2C0_SCL_GPIO32>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
spim2_default: spim2_default {
group1 {
pinmux = <SPIM2_MISO_GPIO33>,
<SPIM2_SCLK_GPIO23>,
<SPIM2_CSEL_GPIO22>;
};
group2 {
pinmux = <SPIM2_MOSI_GPIO19>;
output-low;
};
};
/* used for SK6812 */
spim3_ws2812_led: spim3_ws2812_led {
group1 {
pinmux = <SPIM3_MOSI_GPIO27>;
output-low;
};
};
};

View file

@ -0,0 +1,74 @@
/*
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32/esp32_appcpu.dtsi>
/ {
model = "M5Stack Atom Lite APPCPU";
compatible = "espressif,esp32";
chosen {
zephyr,sram = &sram0;
zephyr,ipc_shm = &shm0;
zephyr,ipc = &ipm0;
};
};
&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&cpu1 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&ipm0 {
status = "okay";
};
&trng0 {
status = "okay";
};
&flash0 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserve 60kB for the bootloader */
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x00001000 0x0000F000>;
read-only;
};
/* Reserve 1024kB for the application in slot 0 */
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
/* Reserve 1024kB for the application in slot 1 */
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
/* Reserve 256kB for the scratch partition */
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};

View file

@ -0,0 +1,27 @@
identifier: m5stack_atom_lite/esp32/appcpu
name: M5Stack ATOM Lite
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: m5stack

View file

@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CLOCK_CONTROL=y

View file

@ -0,0 +1,190 @@
/*
* Copyright (c) 2024 Nikola Trifunovic <nikola@trifunovic.at>
* Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
* Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32/esp32_pico_d4.dtsi>
#include "m5stack_atom_lite-pinctrl.dtsi"
#include "grove_connectors.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/led/led.h>
#include <zephyr/dt-bindings/led/worldsemi_ws2812c.h>
/ {
model = "M5Stack ATOM Lite PROCPU";
compatible = "m5stack,m5stack-atom-lite";
chosen {
zephyr,sram = &sram0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};
aliases {
sw0 = &user_button_0;
watchdog0 = &wdt0;
i2c-0 = &i2c0;
led-strip = &status_rgb_led;
};
leds {
compatible = "gpio-leds";
ir_led: led_0 {
gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
label = "Infrared LED";
};
};
gpio_keys {
compatible = "gpio-keys";
user_button_0: button_0 {
label = "User button 0";
gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; // G39
zephyr,code = <INPUT_KEY_0>;
};
};
};
&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&cpu1 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
sda-gpios = <&gpio0 25 GPIO_OPEN_DRAIN>;
scl-gpios = <&gpio0 21 GPIO_OPEN_DRAIN>;
};
&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
sda-gpios = <&gpio0 26 GPIO_OPEN_DRAIN>;
scl-gpios = <&gpio1 0 GPIO_OPEN_DRAIN>;
};
&timer0 {
status = "okay";
};
&timer1 {
status = "okay";
};
&timer2 {
status = "okay";
};
&timer3 {
status = "okay";
};
&trng0 {
status = "okay";
};
&spi2 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&spim2_default>;
pinctrl-names = "default";
};
/* used for SK6812 */
&spi3 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
line-idle-low;
pinctrl-0 = <&spim3_ws2812_led>;
pinctrl-names = "default";
status_rgb_led: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
reg = <0>;
spi-max-frequency = <WS2812C_SPI_FREQ>;
chain-length = <1>;
color-mapping = <LED_COLOR_ID_GREEN>,
<LED_COLOR_ID_RED>,
<LED_COLOR_ID_BLUE>;
spi-one-frame = <WS2812C_ONE_FRAME>;
spi-zero-frame = <WS2812C_ZERO_FRAME>;
};
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&wdt0 {
status = "okay";
};
&flash0 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserve 60kB for the bootloader */
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x00001000 0x0000F000>;
read-only;
};
/* Reserve 1024kB for the application in slot 0 */
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
/* Reserve 1024kB for the application in slot 1 */
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
/* Reserve 256kB for the scratch partition */
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};

View file

@ -0,0 +1,19 @@
identifier: m5stack_atom_lite/esp32/procpu
name: M5Stack ATOM Lite
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- gpio
- i2c
- spi
- watchdog
- uart
- pinmux
- nvs
testing:
ignore_tags:
- net
- bluetooth
vendor: m5stack

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_GPIO=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y