boards: xtensa: add Kincony KC868-A32 module suppport

Add support for the KC868-A32 ESP32 home automation relay module.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
This commit is contained in:
Bartosz Bilas 2023-12-11 20:44:17 +01:00 committed by Carles Cufí
parent b64915e616
commit fcb9f41259
13 changed files with 445 additions and 0 deletions

View file

@ -133,6 +133,7 @@
/boards/shields/inventek_eswifi/ @nandojve
/boards/xtensa/odroid_go/ @ydamigos
/boards/xtensa/nxp_adsp_imx8/ @iuliana-prodan @dbaluta
/boards/xtensa/kincony_kc868_a32/ @bbilas
/boards/arm64/qemu_cortex_a53/ @carlocaione
/boards/arm64/bcm958402m2_a72/ @abhishek-brcm
/boards/arm64/mimx8mm_evk/ @MrVan @JiafeiPan

View file

@ -0,0 +1,10 @@
# Copyright (c) 2023 Bartosz Bilas
# SPDX-License-Identifier: Apache-2.0
config BOARD_KINCONY_KC868_A32
bool "KINCONY KC868-A32 Board"
depends on SOC_SERIES_ESP32
choice SOC_PART_NUMBER
default SOC_ESP32_WROOM_32UE_N4
endchoice

View file

@ -0,0 +1,14 @@
# Copyright (c) 2023 Bartosz Bilas
# SPDX-License-Identifier: Apache-2.0
config BOARD
default "kincony_kc868_a32"
depends on BOARD_KINCONY_KC868_A32
config ENTROPY_GENERATOR
default y
config HEAP_MEM_POOL_SIZE
default 98304 if WIFI
default 40960 if BT
default 4096

View file

@ -0,0 +1,10 @@
# Copyright (c) Bartosz Bilas
# SPDX-License-Identifier: Apache-2.0
choice BOOTLOADER
default BOOTLOADER_MCUBOOT
endchoice
choice BOOT_SIGNATURE_TYPE
default BOOT_SIGNATURE_TYPE_NONE
endchoice

View file

@ -0,0 +1,11 @@
# Copyright (c) Bartosz Bilas
# 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View file

@ -0,0 +1,97 @@
.. _kincony_kc868_a32:
KINCONY KC868-A32
#################
Overview
********
Kincony KC868-A32 is a home automation relay module based on the
Espressif ESP-WROOM-32 module with all its inherent capabilities
(Wi-Fi, Bluetooth, etc.)
The features include the following:
- 32 digital optoisolated inputs “dry contact”
- 4 analog inputs 0-5 V
- 32 relays 220 V, 10 A (COM, NO, NC)
- RS485 interface
- I2C connector
- Connector GSM/HMI
- Ethernet LAN8270A
- USB Type-B connector for programming and filling firmware
- RESET and DOWNLOAD buttons
- Powered by 12V DC
.. figure:: img/kincony_kc868_a32.jpg
:align: center
:alt: KINCONCY-KC868-A32
KINCONCY-KC868-A32
System requirements
===================
Prerequisites
-------------
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`.
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: kincony_kc868_a32
:goals: build
The usual ``flash`` target will work with the ``kincony_kc868_a32`` board
configuration. Here is an example for the :ref:`hello_world`
application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: kincony_kc868_a32
:goals: flash
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! kincony_kc868_a32
Enabling Ethernet
*****************
Enable Ethernet in KConfig:
.. code-block:: cfg
CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_MDIO=y
References
**********
.. _KINCONY KC868-A32 User Guide: https://www.kincony.com/arduino-esp32-32-channel-relay-module-kc868-a32.html

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) Bartosz Bilas
*
* 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_GPIO15>,
<I2C0_SCL_GPIO13>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
i2c1_default: i2c1_default {
group1 {
pinmux = <I2C1_SDA_GPIO4>,
<I2C1_SCL_GPIO5>;
bias-pull-up;
drive-open-drain;
output-high;
};
};
mdio_default: mdio_default {
group1 {
pinmux = <SMI_MDC_GPIO23>,
<SMI_MDIO_GPIO18>;
};
};
};

View file

@ -0,0 +1,214 @@
/*
* Copyright (c) 2023 Bartosz Bilas
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32/esp32_wroom_32ue_n4.dtsi>
#include "kincony_kc868_a32-pinctrl.dtsi"
/ {
model = "Kincony KC868-A32";
compatible = "espressif,esp32";
aliases {
uart-0 = &uart0;
watchdog0 = &wdt0;
};
chosen {
zephyr,sram = &sram0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};
};
&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
cpu-power-states = <&light_sleep &deep_sleep>;
};
&cpu1 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
sda-gpios = <&gpio0 15 GPIO_OPEN_DRAIN>;
scl-gpios = <&gpio0 13 GPIO_OPEN_DRAIN>;
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
i2c0_pcf8574@21 {
compatible = "nxp,pcf8574";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
i2c0_pcf8574@22 {
compatible = "nxp,pcf8574";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
i2c0_pcf8574@24 {
compatible = "nxp,pcf8574";
reg = <0x24>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
i2c0_pcf8574@25 {
compatible = "nxp,pcf8574";
reg = <0x25>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
};
&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
sda-gpios = <&gpio0 4 GPIO_OPEN_DRAIN>;
scl-gpios = <&gpio0 5 GPIO_OPEN_DRAIN>;
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
i2c1_pcf8574@21 {
compatible = "nxp,pcf8574";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
i2c1_pcf8574@22 {
compatible = "nxp,pcf8574";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
i2c1_pcf8574@24 {
compatible = "nxp,pcf8574";
reg = <0x24>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
i2c1_pcf8574@25 {
compatible = "nxp,pcf8574";
reg = <0x25>;
gpio-controller;
#gpio-cells = <2>;
ngpios = <8>;
};
};
&mdio {
pinctrl-0 = <&mdio_default>;
pinctrl-names = "default";
status = "okay";
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "okay";
reg = <0>;
};
};
&eth {
status = "okay";
phy-handle = <&phy>;
ref-clk-output-gpios = <&gpio0 17 0>;
};
&psram0 {
status = "disabled";
};
&timer0 {
status = "okay";
};
&timer1 {
status = "okay";
};
&timer2 {
status = "okay";
};
&timer3 {
status = "okay";
};
&trng0 {
status = "okay";
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&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: kincony_kc868_a32
name: KINCONY-KC868-A32
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- gpio
- i2c
- watchdog
- uart
- nvs
- counter
- entropy
testing:
ignore_tags:
- net
- bluetooth
vendor: kincony

View file

@ -0,0 +1,14 @@
# Copyright (c) Bartosz Bilas
# SPDX-License-Identifier: Apache-2.0
CONFIG_BOARD_KINCONY_KC868_A32=y
CONFIG_SOC_SERIES_ESP32=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_GPIO=y
CONFIG_I2C=y

View file

@ -0,0 +1,5 @@
set ESP_RTOS none
set ESP32_ONLYCPU 1
source [find interface/ftdi/esp32_devkitj_v1.cfg]
source [find target/esp32.cfg]

View file

@ -18,3 +18,4 @@ tests:
- mimxrt595_evk_cm33
- nrf9131ek_nrf9131
- nrf9131ek_nrf9131_ns
- kincony_kc868_a32