boards/xtensa/esp32s3: New board WaveShare ESP32-S3-Touch-LCD-1.28 (WIP).

* Initial experimental / work in progress implementation.
* New board name is esp32s3-ws-lcd128.
* Supports Kconfig delectable w/wo touch variants (lcd gpios difference).
* IMU QMI8658 bringups is put into esp32s3/common/src to share with other
  boards. Pin defines are located at <board>include/board.h and referenced
  with `#include <arch/board/board.h>`.
* Supported configurations: nsh, ostest, coremark, touch-lvgl, notouch-lvgl,
  imu-qmi8658, watchdog.
* Does not have touch panel driver yet.
* Created board documentation. Added sphinx inline cross-references.
* TODO: Fix SPI GC9A01A LCD pixel format colors.
* TODO: Create I2C CST816S touch panel driver.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
This commit is contained in:
Tomasz 'CeDeROM' CEDRO 2026-03-15 21:04:29 +01:00 committed by Xiang Xiao
parent 04c4269ef0
commit 3efaf80d3d
42 changed files with 3436 additions and 0 deletions

View file

@ -1,3 +1,5 @@
.. _coremark:
===============================
``coremark`` CoreMark Benchmark
===============================

View file

@ -1,3 +1,5 @@
.. _lvgldemo:
======================
``lvgldemo`` LVGL Demo
======================

View file

@ -1,3 +1,5 @@
.. _watchdog:
``watchdog`` Watchdog Timer
===========================

View file

@ -1,3 +1,5 @@
.. _lvgl:
=============
``lvgl`` LVGL
=============

View file

@ -1,3 +1,5 @@
.. _uorb:
==========================================
``uorb`` uorb(micro object request broker)
==========================================
@ -532,6 +534,8 @@ and management in an embedded system environment.
**Tools**
^^^^^^^^^
.. _uorb_listener:
**uorb_listener**
-----------------

View file

@ -1,3 +1,5 @@
.. _ostest:
==================
``ostest`` OS test
==================

View file

@ -62,6 +62,12 @@ Reusable LCD drivers reside in the drivers/lcd directory:
LCDs
----
.. _gc9a01:
- ``gc9a01.c``
GalaxyCore GC9A01 TFT LCD controller.
- ``mio283qt2.c``
This is a driver for the MI0283QT-2 LCD from Multi-Inno

View file

@ -1,3 +1,5 @@
.. _qmi8658:
=======
QMI8658
=======

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -0,0 +1,407 @@
=================
ESP32S3-WS-LCD128
=================
.. tags:: chip:esp32s3
.. figure:: ESP32-S3-Touch-LCD-1.28.jpg
:align: center
This board definition is a starting point for development with
`ESP32-S3-LCD-1.28 <https://www.waveshare.com/esp32-s3-lcd-1.28.htm>`__ and
`ESP32-S3-Touch-LCD-1.28 <https://www.waveshare.com/esp32-s3-touch-lcd-1.28.htm>`__
which are low-cost ($16/$22) open-source hardware designed by
`WaveShare <https://www.waveshare.com/>`_. High-performance Xtensa based
ESP32-S3 MCU, small size, onboard round 1.28" LCD display, capacitive touch
screen (Touch version only), Li-ion accumulator charge manager, 6-axis sensor
(3-axis accelerometer and 3-axis gyroscope), and quick module attachmend
1.27mm connectors (non-Touch version only), makes it a perfect candidate
for integration into your projects and products quickly.
.. list-table::
:width: 100%
:class: borderless
* - .. figure:: ESP32-S3-LCD-1.28-details-intro.jpg
:target: https://www.waveshare.com/wiki/ESP32-S3-LCD-1.28
:align: center
ESP32-S3-LCD-1.28.
- .. figure:: ESP32-S3-Touch-LCD-1.28-details-intro.jpg
:target: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28
:align: center
ESP32-S3-Touch-LCD-1.28.
These boards are almost identical. Touch version has touch screen,
while non-Touch version has two connectors exposing more GPIOs at the bottom,
thus slightly different signal routes. See Pinouts and GPIO sections below
for details.
Because of that similarity, a single board definition is provided by NuttX,
while features and configuration details are build time Kconfig selectable:
* ``CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH`` selects Touch variant.
* ``CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH`` selects Non-Touch variant.
Both boards are based on existing :ref:`esp32s3` chip implementation.
WaveShare WIKI contains board details, generic examples, documentation, and
schematics for the
`ESP32-S3-LCD-1.28 <https://www.waveshare.com/wiki/ESP32-S3-LCD-1.28>`__ and
`ESP32-S3-Touch-LCD-1.28 <https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28>`__.
.. note:: Implementation is experimental and still early stage of development!
Features
========
- ESP32-S3R2 Xtensa® 32-bit LX7 dual-core processor, up to 240MHz frequency.
- 2.4GHz Wi-Fi (802.11 b/g/n) and Bluetooth® 5 (BLE) with onboard antenna.
- Built in 512KB of SRAM and 384KB ROM, on-chip 2MB PSRAM, external 16MB
W25Q128JVSIQ NOR Flash memory.
- USB-C connector and CH343P USB-to-UART converter (flashing, console).
- Onboard GC9A01A controlled round 1.28" 240×240 resolution 65K color LCD.
- Onboard QMI8658 6-axis IMU (3-axis accelerometer and 3-axis gyroscope).
- Onboard 3.7V MX1.25 lithium battery re/discharge header, ETA6096 charger.
- Touch version:
- CST816S capacitive touch display controller.
- 6 × GPIO exposed over SH1.0 connector.
- Non-Touch version:
- 32 x GPIO exposed over 2 x 2x10 1.27mm female connectors.
Dimensions
==========
- ESP32-S3-LCD-1.28:
.. figure:: ESP32-S3-LCD-1.28-details-size.jpg
:align: center
- ESP32-S3-Touch-LCD-1.28:
.. figure:: ESP32-S3-Touch-LCD-1.28-details-size-1.jpg
:align: center
.. figure:: ESP32-S3-Touch-LCD-1.28-details-size-2.jpg
:align: center
Pinouts
=======
- ESP32-S3-LCD-1.28:
.. figure:: ESP32-S3-LCD-1.28-details-inter.jpg
:align: center
- ESP32-S3-Touch-LCD-1.28:
.. figure:: ESP32-S3-Touch-LCD-1.28-details-inter.jpg
:align: center
GPIO
====
.. warning:: ESP32-S3-LCD-1.28 pinout on the picture above is different from
the schematics (picture has H2 rotated numbering but the signal
names are valid)! Schematics and table below shows correct data.
Issue is reported to vendor, we are waiting for the fix / update.
+------------+----------------------+-------------------------+
| ESP32-S3R2 | ESP32-S3-LCD-1.28 | ESP32-S3-Touch-LCD-1.28 |
+============+======================+=========================+
| GND | H1.20, H2.1, H2.2 | P2.1, P2.5 |
+------------+----------------------+-------------------------+
| VSYS(USB5V)| H1.18, H2.3 | P2.2 |
+------------+----------------------+-------------------------+
| 3V3 | BAT_ADC / H2.4 | P2.6 |
+------------+----------------------+-------------------------+
| CHIP_PU | RUN/RESET / H2.8 | RUN/RESET / P2.3 |
+------------+----------------------+-------------------------+
| GPIO0 | BOOT / H2.6, H2.10 | BOOT / P2.4 |
+------------+----------------------+-------------------------+
| GPIO1 | BAT_ADC / H2.12 | BAT_ADC / P2.6 |
+------------+----------------------+-------------------------+
| GPIO2 | GPIO2 / H2.14 | LCD_BL |
+------------+----------------------+-------------------------+
| GPIO3 | GPIO3 / H2.16 | IMU_INT2 |
+------------+----------------------+-------------------------+
| GPIO4 | GPIO4 / H2.18 | IMU_INT1 |
+------------+----------------------+-------------------------+
| GPIO5 | GPIO5 / H2.20 | TP_INT |
+------------+----------------------+-------------------------+
| GPIO6 | IMU_SDA / H2.5 | IMU_SDA,TP_SDA |
+------------+----------------------+-------------------------+
| GPIO7 | IMU_SCL / H2.7 | IMU_SCL,TP_SCL |
+------------+----------------------+-------------------------+
| GPIO8 | LCD_DC / H2.9 | LCD_DC |
+------------+----------------------+-------------------------+
| GPIO9 | LCD_CS / H2.11 | LCD_CS |
+------------+----------------------+-------------------------+
| GPIO10 | LCD_CLK / H2.13 | CLD_CLK |
+------------+----------------------+-------------------------+
| GPIO11 | LCD_DIN / H2.15 | LCD_MOSI |
+------------+----------------------+-------------------------+
| GPIO12 | LCD_RST / H2.17 | LCD_MISO |
+------------+----------------------+-------------------------+
| GPIO13 | GPIO13 / H2.19 | TP_RST |
+------------+----------------------+-------------------------+
| GPIO14 | GPIO14 / H1.19 | LCD_RST |
+------------+----------------------+-------------------------+
| GPIO15 | GPIO15 / H1.17 | GPIO15 / P2.7 |
+------------+----------------------+-------------------------+
| GPIO16 | GPIO16 / H1.15 | GPIO16 / P2.8 |
+------------+----------------------+-------------------------+
| GPIO17 | GPIO17 / H1.13 | GPIO17 / P2.9 |
+------------+----------------------+-------------------------+
| GPIO18 | GPIO18 / H1.11 | GPIO18 / P2.10 |
+------------+----------------------+-------------------------+
| GPIO21 | GPIO21 / H1.9 | GPIO21 / P2.11 |
+------------+----------------------+-------------------------+
| GPIO33 | GPIO33 / H1.7 | GPIO33 / P2.12 |
+------------+----------------------+-------------------------+
| GPIO34 | GPIO34 / H1.5 | |
+------------+----------------------+-------------------------+
| GPIO35 | GPIO35 / H1.3 | |
+------------+----------------------+-------------------------+
| GPIO36 | GPIO36 / H1.1 | |
+------------+----------------------+-------------------------+
| GPIO37 | GPIO37 / H1.16 | |
+------------+----------------------+-------------------------+
| GPIO38 | GPIO38 / H1.14 | |
+------------+----------------------+-------------------------+
| GPIO39 | GPIO39 / H1.12 | |
+------------+----------------------+-------------------------+
| GPIO40 | LCD_BL / H1.10 | |
+------------+----------------------+-------------------------+
| GPIO41 | GPIO41 / H1.8 | |
+------------+----------------------+-------------------------+
| GPIO42 | GPIO42 / H1.6 | |
+------------+----------------------+-------------------------+
| GPIO45 | GPIO45 / H1.4 | |
+------------+----------------------+-------------------------+
| GPIO46 | GPIO46 / H1.2 | |
+------------+----------------------+-------------------------+
| GPIO47 | IMU_INT1 | |
+------------+----------------------+-------------------------+
| GPIO48 | IMU_INT2 | |
+------------+----------------------+-------------------------+
Board Buttons
-------------
There are two buttons labeled BOOT and RESET (both are exposed on board
connectors):
* RESET (active low) button is not available to the software and can be used
as manual hardware reset trigger.
* BOOT button is connected to GPIO0. On reset/power-on it can be used to
trigger BootROM serial bootloader when pressed (active low) in order to
flash new firmware. After reset BOOT button can be used as software input.
Serial Console
==============
UART0 is by default used for the serial console. It connects to the on-board
CH343P converter and is available on the USB-C connector that can be also used
for firmware flashing.
Configurations
==============
All of the available configurations provide basic testing utilities or serve
as an example starting point for your own projects.
Use them by running the following commands::
$ ./tools/configure.sh esp32s3-ws-lcd128:<config_name>
$ make flash -j ESPTOOL_PORT=<serial_port_device>
Notes:
- ``<config_name>`` is the name of board configuration you want to use
(i.e. nsh, lvgl). Then use a serial console terminal like ``cu`` or
``minicom`` configured to 115200 8N1.
- ``<serial_port_device>`` is usually ``/dev/ttyUSB0`` or ``/dev/cuaU0``
depending on the OS you are using.
- On BSD systems use GNU Make (``gmake``) in place of ``make``.
coremark
--------
Provides :ref:`coremark <CoreMark>` benchmarking utility on boot::
Running CoreMark...
2K performance run parameters for coremark.
CoreMark Size : 666
Total ticks : 2313
Total time (secs): 23.130000
Iterations/Sec : 951.145698
Iterations : 22000
Compiler version : GCC14.2.0
Compiler flags : -O3 -fno-strict-aliasing -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-strength-reduce
Parallel PThreads : 2
Memory location : HEAP
seedcrc : 0xe9f5
[0]crclist : 0xe714
[1]crclist : 0xe714
[0]crcmatrix : 0x1fd7
[1]crcmatrix : 0x1fd7
[0]crcstate : 0x8e3a
[1]crcstate : 0x8e3a
[0]crcfinal : 0x33ff
[1]crcfinal : 0x33ff
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 951.145698 / GCC14.2.0 -O3 -fno-strict-aliasing -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-strength-reduce / HEAP / 2:PThreads
notouch-lvgl
------------
This is a demonstration of the :ref:`lvgl <lvgl>` graphics library running on the
NuttX's :ref:`GC9A01A <gc9a01>` LCD driver. Demo will launch itself on boot
and you should see it on the screen right away.
This configuration uses the :ref:`lvgldemo <lvgldemo>` application.
.. note::
1. This configuration has ``CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH``
set. It selects LCD pins valid for the Non-Touch board variant.
2. Colors are invalid. Pixel format to be fixed. Work in progress.
nsh
---
Provides :ref:`nsh <nsh>` NuttShell as default application.
Console runs on UART0 at 115200bps and is exposed via USB over CH343P chip.
qmi8658
-------
Provides onboard :ref:`QMI8658` IMU and internal ESP32S3 temperature
:ref:`uorb <uorb>` sensors example. Sensors are registered under
``/dev/urob/`` and its data can be obtained with :ref:`uorb_listener`
application::
nsh> ls /dev/uorb
/dev/uorb:
sensor_accel0
sensor_gyro0
sensor_temp0
nsh> uorb_listener -n 10
Monitor objects num:3
object_name:sensor_temp, object_instance:0
object_name:sensor_gyro, object_instance:0
object_name:sensor_accel, object_instance:0
sensor_temp(now:144950000):timestamp:144950000,temperature:36.000000
sensor_temp(now:145960000):timestamp:145960000,temperature:37.000000
sensor_gyro(now:145960000):timestamp:145960000,x:-4.750000,y:-0.437500,z:0.156250,temperature:32.261719
sensor_accel(now:145960000):timestamp:145960000,x:0.031250,y:-0.088867,z:-1.051392,temperature:32.261719
sensor_temp(now:146970000):timestamp:146970000,temperature:37.000000
sensor_gyro(now:146970000):timestamp:146970000,x:-4.937500,y:-0.562500,z:0.218750,temperature:32.281250
sensor_accel(now:146970000):timestamp:146970000,x:0.031738,y:-0.088623,z:-1.046265,temperature:32.281250
sensor_temp(now:147980000):timestamp:147980000,temperature:37.000000
sensor_gyro(now:147980000):timestamp:147980000,x:-4.750000,y:0.031250,z:0.437500,temperature:32.273438
sensor_accel(now:147980000):timestamp:147980000,x:0.031005,y:-0.088745,z:-1.049683,temperature:32.273438
Object name:sensor_temp0, received:4
Object name:sensor_gyro0, received:3
Object name:sensor_accel0, received:3
Total number of received Message:10/10
ostest
------
Provides :ref:`ostest <ostest>` NuttX self-test utility::
nsh> ostest
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
stdio_test: Standard I/O Check: fprintf to stderr
ostest_main: putenv(Variable1=BadValue3)
ostest_main: setenv(Variable1, GoodValue1, TRUE)
ostest_main: setenv(Variable2, BadValue1, FALSE)
ostest_main: setenv(Variable2, GoodValue2, TRUE)
ostest_main: setenv(Variable3, GoodValue3, FALSE)
ostest_main: setenv(Variable3, BadValue2, FALSE)
show_variable: Variable=Variable1 has value=GoodValue1
show_variable: Variable=Variable2 has value=GoodValue2
show_variable: Variable=Variable3 has value=GoodValue3
ostest_main: Started user_main at PID=3
(..)
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 5d378 5d378
ordblks 5 5
mxordblk 542d0 542d0
uordblks 47e8 47e8
fordblks 58b90 58b90
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 5d378 5d378
ordblks 1 5
mxordblk 58c28 542d0
uordblks 4750 47e8
fordblks 58c28 58b90
user_main: Exiting
ostest_main: Exiting with status 0
touch-lvgl
----------
This is a demonstration of the :ref:`lvgl <lvgl>` graphics library running on the
NuttX's :ref:`GC9A01A <gc9a01>` LCD driver. Demo will launch itself on boot and you
should see it on the screen right away.
This configuration uses the :ref:`lvgldemo <lvgldemo>` application.
.. note::
1. This configuration has ``CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH``
set. It selects LCD pins valid for the Touch board variant.
2. Colors are invalid. Pixel format to be fixed. Work in progress.
3. Touch screen driver (I2C/CST816S) is not yet implemented!
Work in progress.
watchdog
--------
Provides :ref:`watchdog <watchdog>` testing utility::
nsh> wdog
ping elapsed=0
ping elapsed=500
ping elapsed=1000
ping elapsed=1500
ping elapsed=2000
ping elapsed=2500
ping elapsed=3000
ping elapsed=3500
ping elapsed=4000
ping elapsed=4500
NO ping elapsed=5000
NO ping elapsed=5500
NO ping elapsed=6000
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x18 (SPI_FAST_FLASH_BOOT)

View file

@ -1,3 +1,5 @@
.. _esp32s3:
==================
Espressif ESP32-S3
==================

View file

@ -597,6 +597,35 @@ config ARCH_BOARD_ESP32S3_LCKFB_SZPI
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS if ESPRESSIF_GPIO_IRQ
config ARCH_BOARD_ESP32S3_WS_LCD128
bool "WaveShare ESP32-S3-(Touch)-LCD-1.28"
depends on ARCH_CHIP_ESP32S3CUSTOM
select ESP32S3_UART0
select ESP32S3_SPI2
select SPI_CMDDATA
select LCD
select LCD_DEV
select LCD_GC9A01
---help---
This board comes in two variants:
1. Touch screen marked ESP32-S3-Touch-LCD-1.28 [1].
2. No-Touch marked ESP32-S3-LCD-1.28 [2].
WaveShare ESP32-S3-(Touch)-LCD-1.28 board uses up to 240MHz dual core LX7
32-bit ESP32-S3R2 SoC with WiFi (802.11b/g/n) and Bluetooth 5 (LE) using
onboard antenna, 512KB SRAM, 384KB ROM, onboard 2MB PSRAM, external 16MB
NOR Flash (W25Q128JVSIQ). Flashing and console over CH434P UART-to-USB-C.
Board is equipped with round 240x240 GCA01 65K color SPI LCD, CST819 I2C
touch screen (touch variant), QMI8658 6-axis IMU, ETA6096 3.7V lithium
charger (MX1.25 connector), reset and boot buttons.
Touch variant provides 6 GPIO over SH-1.0 12 pin connector (goldpin ended
cable attached). Non-touch variant provides two 2x10 1.27mm female board
connectors.
[1] www.waveshare.com/esp32-s3-lcd-1.28.htm
[2] www.waveshare.com/esp32-s3-touch-lcd-1.28.htm
config ARCH_BOARD_ESP32C6_DEVKITC
bool "Espressif ESP32-C6-DevKitC-1"
depends on ARCH_CHIP_ESP32C6WROOM1
@ -3628,6 +3657,7 @@ config ARCH_BOARD
default "esp32s3-box" if ARCH_BOARD_ESP32S3_BOX
default "esp32s3-korvo-2" if ARCH_BOARD_ESP32S3_KORVO_2
default "lckfb-szpi-esp32s3" if ARCH_BOARD_ESP32S3_LCKFB_SZPI
default "esp32s3-ws-lcd128" if ARCH_BOARD_ESP32S3_WS_LCD128
default "esp32c6-devkitc" if ARCH_BOARD_ESP32C6_DEVKITC
default "esp32c6-devkitm" if ARCH_BOARD_ESP32C6_DEVKITM
default "esp32c6-xiao" if ARCH_BOARD_ESP32C6_XIAO
@ -4917,6 +4947,9 @@ endif
if ARCH_BOARD_ESP32S3_LHCBIT
source "boards/xtensa/esp32s3/esp32s3-lhcbit/Kconfig"
endif
if ARCH_BOARD_ESP32S3_WS_LCD128
source "boards/xtensa/esp32s3/esp32s3-ws-lcd128/Kconfig"
endif
if ARCH_BOARD_ESP32S3_XIAO
source "boards/xtensa/esp32s3/esp32s3-xiao/Kconfig"
endif

View file

@ -74,6 +74,10 @@ ifeq ($(CONFIG_ESPRESSIF_ADC),y)
CSRCS += esp32s3_board_adc.c
endif
ifeq ($(CONFIG_SENSORS_QMI8658),y)
CSRCS += esp32s3_qmi8658.c
endif
ifeq ($(CONFIG_NET_LAN9250),y)
CSRCS += esp32s3_lan9250.c
endif

View file

@ -0,0 +1,89 @@
/****************************************************************************
* boards/xtensa/esp32s3/common/src/esp32s3_qmi8658.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <unistd.h>
#include <stdlib.h>
#include <debug.h>
#include <assert.h>
#include <arch/board/board.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/sensors/qmi8658.h>
#include "esp32s3_i2c.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_qmi8658_initialize
*
* Description:
* Initialize and register the QMI8658 6-axis IMU sensor driver.
*
* This function registers the uORB interface which creates:
* - "/dev/uorb/sensor_accel0" for accelerometer data
* - "/dev/uorb/sensor_gyro0" for gyroscope data
*
* This driver initialization expects defines at <board>/include/board.h:
* 1. QMI8658_I2C_PORT: I2C port used (remember to configure pins).
* 2. QMI8658_I2C_ADDR: chip address (0x6B for SA0=0 or 0x6A for SA0=1).
*
* Input Parameters:
* None
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int esp32s3_qmi8658_initialize(void)
{
struct i2c_master_s *i2c;
int ret;
/* Initialize I2C bus */
i2c = esp32s3_i2cbus_initialize(QMI8658_I2C_PORT);
if (!i2c)
{
i2cerr("Initialize I2C bus failed!\n");
return -EINVAL;
}
/* Register QMI8658 uORB sensor device */
ret = qmi8658_uorb_register(0, i2c, QMI8658_I2C_ADDR);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to register QMI8658 uORB driver: %d\n", ret);
}
return ret;
}

View file

@ -0,0 +1,38 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_ESP32S3_WS_LCD128
choice
prompt "BOARD VARIANT"
default ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH
---help---
There are two variants of the board with [1] and without [2] touch screen.
These boards also have slightly different signals and capabilities.
Non-touch variant has two connectors with many more GPIO available.
[1] https://www.waveshare.com/esp32-s3-touch-lcd-1.28.htm
[2] https://www.waveshare.com/esp32-s3-lcd-1.28.htm
NOTE: Touch screen driver is not yet implemented!
config ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH
bool "NO-TOUCH ESP32-S3-LCD-1.28"
select LCD
---help---
Mark this choice if your board has no touch screen module installed.
www.waveshare.com/esp32-s3-lcd-1.28.htm
config ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH
bool "TOUCH ESP32-S3-Touch-LCD-1.28"
---help---
Mark this choice if your board has touch screen module installed.
www.waveshare.com/esp32-s3-touch-lcd-1.28.htm
NOTE: Touch screen driver is not yet implemented!
endchoice
endif # ARCH_BOARD_ESP32S3_WS_LCD128

View file

@ -0,0 +1,42 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NDEBUG is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BENCHMARK_COREMARK=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_DEBUG_CUSTOMOPT=y
CONFIG_DEBUG_OPTLEVEL="-O3"
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="coremark_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SMP=y
CONFIG_SMP_NCPUS=2
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_UART0_SERIAL_CONSOLE=y

View file

@ -0,0 +1,65 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_UORB=y
CONFIG_ESP32S3_I2C0=y
CONFIG_ESP32S3_I2C0_SCLPIN=7
CONFIG_ESP32S3_I2C0_SDAPIN=6
CONFIG_ESPRESSIF_TEMP=y
CONFIG_ESPRESSIF_TEMP_UORB=y
CONFIG_ESPRESSIF_TEMP_UORB_POLL=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SENSORS=y
CONFIG_SENSORS_QMI8658=y
CONFIG_SENSORS_QMI8658_POLL=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UORB=y
CONFIG_UORB_LISTENER=y
CONFIG_UORB_STACKSIZE=4096
CONFIG_USENSOR=y

View file

@ -0,0 +1,74 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_INITTHREAD_STACKSIZE=8192
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_DMA=y
CONFIG_ESP32S3_PSRAM_2M=y
CONFIG_ESP32S3_SPEED_UP_ISR=y
CONFIG_ESP32S3_SPI2_CLKPIN=10
CONFIG_ESP32S3_SPI2_CSPIN=9
CONFIG_ESP32S3_SPI2_MISOPIN=12
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=8192
CONFIG_INIT_ENTRYPOINT="lvgldemo_main"
CONFIG_INIT_STACKSIZE=16384
CONFIG_INTELHEX_BINARY=y
CONFIG_LCD_FRAMEBUFFER=y
CONFIG_LCD_GC9A01_BGR=y
CONFIG_LCD_GC9A01_FREQUENCY=50000000
CONFIG_LCD_PORTRAIT=y
CONFIG_LINE_MAX=64
CONFIG_LV_FONT_MONTSERRAT_20=y
CONFIG_LV_USE_CLIB_MALLOC=y
CONFIG_LV_USE_CLIB_SPRINTF=y
CONFIG_LV_USE_CLIB_STRING=y
CONFIG_LV_USE_DEMO_WIDGETS=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_NUTTX=y
CONFIG_LV_USE_NUTTX_LCD=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI_DRIVER=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y

View file

@ -0,0 +1,47 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ESP32S3_RTC is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=23
CONFIG_START_YEAR=2026
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y

View file

@ -0,0 +1,50 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_SETJMP_H=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_THREAD_LOCAL=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y

View file

@ -0,0 +1,75 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_INITTHREAD_STACKSIZE=8192
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_DMA=y
CONFIG_ESP32S3_PSRAM_2M=y
CONFIG_ESP32S3_SPEED_UP_ISR=y
CONFIG_ESP32S3_SPI2_CLKPIN=10
CONFIG_ESP32S3_SPI2_CSPIN=9
CONFIG_ESP32S3_SPI2_MISOPIN=12
CONFIG_EXAMPLES_LVGLDEMO=y
CONFIG_FS_PROCFS=y
CONFIG_GRAPHICS_LVGL=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=8192
CONFIG_INIT_ENTRYPOINT="lvgldemo_main"
CONFIG_INIT_STACKSIZE=16384
CONFIG_INTELHEX_BINARY=y
CONFIG_LCD_FRAMEBUFFER=y
CONFIG_LCD_GC9A01_BGR=y
CONFIG_LCD_GC9A01_FREQUENCY=50000000
CONFIG_LCD_PORTRAIT=y
CONFIG_LINE_MAX=64
CONFIG_LV_FONT_MONTSERRAT_20=y
CONFIG_LV_USE_CLIB_MALLOC=y
CONFIG_LV_USE_CLIB_SPRINTF=y
CONFIG_LV_USE_CLIB_STRING=y
CONFIG_LV_USE_DEMO_WIDGETS=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_NUTTX=y
CONFIG_LV_USE_NUTTX_LCD=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI_DRIVER=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y

View file

@ -0,0 +1,54 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="esp32s3-ws-lcd128"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3CUSTOM=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQ_TO_NDX=y
CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
CONFIG_ARCH_NUSER_INTERRUPTS=2
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_MWDT0=y
CONFIG_ESP32S3_MWDT1=y
CONFIG_ESP32S3_RWDT=y
CONFIG_EXAMPLES_WATCHDOG=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_WATCHDOG=y

View file

@ -0,0 +1,59 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/include/board.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_H
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* The ESP32-S3 DevKit board is fitted with a 40MHz crystal */
#define BOARD_XTAL_FREQUENCY 40000000
#ifdef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ
# define BOARD_CLOCK_FREQUENCY (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000)
#else
# define BOARD_CLOCK_FREQUENCY 80000000
#endif
/* LED definitions **********************************************************/
/* Define how many LEDs this board has (needed by userleds) */
#define BOARD_NLEDS 0
/* GPIO pins used by the GPIO Subsystem */
#define BOARD_NGPIOOUT 0 /* Amount of GPIO Output pins */
#define BOARD_NGPIOIN 0 /* Amount of GPIO Input without Interruption */
#define BOARD_NGPIOINT 0 /* Amount of GPIO Input w/ Interruption pins */
/* IMU definitions **********************************************************/
#define QMI8658_I2C_PORT (0)
#define QMI8658_I2C_ADDR (0x6B)
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_H */

View file

@ -0,0 +1,118 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/include/board_memorymap.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_MEMORYMAP_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_MEMORYMAP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Kernel ROM */
#define KIROM_START (uintptr_t)__kirom_start
#define KIROM_SIZE (uintptr_t)__kirom_size
#define KDROM_START (uintptr_t)__kdrom_start
#define KDROM_SIZE (uintptr_t)__kdrom_size
/* Kernel RAM */
#define KIRAM_START (uintptr_t)__kiram_start
#define KIRAM_SIZE (uintptr_t)__kiram_size
#define KIRAM_END (uintptr_t)__kiram_end
#define KDRAM_START (uintptr_t)__kdram_start
#define KDRAM_SIZE (uintptr_t)__kdram_size
#define KDRAM_END (uintptr_t)__kdram_end
/* Exception vectors */
#define VECTORS_START (uintptr_t)__vectors_start
#define VECTORS_END (uintptr_t)__vectors_end
/* User ROM */
#define UIROM_START (uintptr_t)__uirom_start
#define UIROM_SIZE (uintptr_t)__uirom_size
#define UIROM_END (uintptr_t)__uirom_end
#define UDROM_START (uintptr_t)__udrom_start
#define UDROM_SIZE (uintptr_t)__udrom_size
#define UDROM_END (uintptr_t)__udrom_end
/* User RAM */
#define UIRAM_START (uintptr_t)__uiram_start
#define UIRAM_SIZE (uintptr_t)__uiram_size
#define UIRAM_END (uintptr_t)__uiram_end
#define UDRAM_START (uintptr_t)__udram_start
#define UDRAM_SIZE (uintptr_t)__udram_size
#define UDRAM_END (uintptr_t)__udram_end
/****************************************************************************
* Public Data
****************************************************************************/
/* Kernel ROM (RX) */
extern uint8_t __kirom_start[];
extern uint8_t __kirom_size[];
extern uint8_t __kdrom_start[];
extern uint8_t __kdrom_size[];
/* Kernel RAM (RW) */
extern uint8_t __kiram_start[];
extern uint8_t __kiram_size[];
extern uint8_t __kiram_end[];
extern uint8_t __kdram_start[];
extern uint8_t __kdram_size[];
extern uint8_t __kdram_end[];
/* Exception vectors */
extern uint8_t __vectors_start[];
extern uint8_t __vectors_end[];
/* User ROM (RX) */
extern uint8_t __uirom_start[];
extern uint8_t __uirom_size[];
extern uint8_t __uirom_end[];
extern uint8_t __udrom_start[];
extern uint8_t __udrom_size[];
extern uint8_t __udrom_end[];
/* User RAM (RW) */
extern uint8_t __uiram_start[];
extern uint8_t __uiram_size[];
extern uint8_t __uiram_end[];
extern uint8_t __udram_start[];
extern uint8_t __udram_size[];
extern uint8_t __udram_end[];
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_INCLUDE_BOARD_MEMORYMAP_H */

View file

@ -0,0 +1,57 @@
############################################################################
# boards/xtensa/esp32s3/esp32s3-ws-lcd128/scripts/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/tools/esp32s3/Config.mk
include $(TOPDIR)/arch/xtensa/src/lx7/Toolchain.defs
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_peripherals.ld
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_rom_aliases.ld
# Pick the linker scripts from the board level if they exist, if not
# pick the common linker scripts.
ifeq ($(CONFIG_BUILD_PROTECTED),y)
ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld)
ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld)
ifneq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
ARCHSCRIPT += $(call FINDSCRIPT,esp32s3_sections.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
endif
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -fno-strength-reduce
endif
ARCHPICFLAGS = -fpic
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__

View file

@ -0,0 +1,50 @@
############################################################################
# boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
CSRCS = esp32s3_boot.c esp32s3_bringup.c
ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += esp32s3_appinit.c
ifeq ($(CONFIG_BOARDCTL_RESET),y)
CSRCS += esp32s3_reset.c
endif
endif
ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += esp32s3_buttons.c
endif
ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += esp32s3_gpio.c
endif
ifeq ($(CONFIG_LCD_GC9A01),y)
CSRCS += esp32s3_board_lcd_gc9a01.c
endif
ifeq ($(CONFIG_SPI),y)
CSRCS += esp32s3_board_spi.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board

View file

@ -0,0 +1,207 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3-ws-lcd128.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_SRC_ESP32S3_WS_LCD128_H
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_SRC_ESP32S3_WS_LCD128_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* RMT gpio */
#define RMT_RXCHANNEL (4)
#define RMT_TXCHANNEL (0)
#ifdef CONFIG_RMT_LOOP_TEST_MODE
# define RMT_INPUT_PIN (0)
# define RMT_OUTPUT_PIN (0)
#else
# define RMT_INPUT_PIN (16)
#endif
#define RMT_OUTPUT_PIN (15)
/* LCD gpio */
#if defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH) && \
defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH)
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH is defined."
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH is defined."
# error "These options are exclusive!"
#elif !defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH) && \
!defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH)
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH is not defined."
# error "CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH is not defined."
# error "One of them must be defined!"
#elif defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_TOUCH)
# ifdef CONFIG_LCD
# define DISPLAY_SPI (2)
# define DISPLAY_RST (14)
# define DISPLAY_DC (8)
# define DISPLAY_BCKL (2)
# endif
#elif defined(CONFIG_ARCH_BOARD_ESP32S3_WS_LCD128_NOTOUCH)
# ifdef CONFIG_LCD
# define DISPLAY_SPI (2)
# define DISPLAY_RST (12)
# define DISPLAY_DC (8)
# define DISPLAY_BCKL (40)
# endif
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp32s3_bringup
*
* Description:
* Perform architecture-specific initialization
*
* CONFIG_BOARD_LATE_INITIALIZE=y :
* Called from board_late_initialize().
*
* CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
* Called from the NSH library via board_app_initialize()
*
****************************************************************************/
int esp32s3_bringup(void);
/****************************************************************************
* Name: esp32s3_gpio_init
*
* Description:
* Configure the GPIO driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_DEV_GPIO
int esp32s3_gpio_init(void);
#endif
/****************************************************************************
* Name: board_spiflash_init
*
* Description:
* Initialize the SPIFLASH and register the MTD device.
*
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPIFLASH
int board_spiflash_init(void);
#endif
/****************************************************************************
* Name: board_i2c_init
*
* Description:
* Configure the I2C driver.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_I2C_DRIVER
int board_i2c_init(void);
#endif
/****************************************************************************
* Name: board_i2sdev_initialize
*
* Description:
* This function is called by platform-specific, setup logic to configure
* and register the generic I2S audio driver. This function will register
* the driver as /dev/audio/pcm[x] where x is determined by the I2S port
* number.
*
* Input Parameters:
* port - The I2S port used for the device
* enable_tx - Register device as TX if true
* enable_rx - Register device as RX if true
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_ESPRESSIF_I2S
int board_i2sdev_initialize(int port, bool enable_tx, bool enable_rx);
#endif
#ifdef CONFIG_ESP32S3_TWAI
int esp32s3_twai_setup(void);
#endif
/****************************************************************************
* Name: board_lcd_initialize
*
* Description:
* Initialize the onboard GC9A01 LCD device.
*
****************************************************************************/
#if defined(CONFIG_LCD)
int board_lcd_initialize(void);
#endif
/****************************************************************************
* Name: esp32s3_qmi8658_initialize
*
* Description:
* Initialize the onboard QMI8658 IMU device uorb driver.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_QMI8658)
int esp32s3_qmi8658_initialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_WS_LCD128_SRC_ESP32S3_WS_LCD128_H */

View file

@ -0,0 +1,82 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_appinit.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/board.h>
#include "esp32s3-ws-lcd128.h"
#ifdef CONFIG_BOARDCTL
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
*
* Input Parameters:
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
* between the board-specific initialization logic and the
* matching application logic. The value could be such things as a
* mode enumeration value, a set of DIP switch settings, a
* pointer to configuration data read from a file or serial FLASH,
* or whatever you would like to do with it. Every implementation
* should accept zero/NULL as a default configuration.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/
int board_app_initialize(uintptr_t arg)
{
#ifdef CONFIG_BOARD_LATE_INITIALIZE
/* Board initialization already performed by board_late_initialize() */
return OK;
#else
/* Perform board-specific initialization */
return esp32s3_bringup();
#endif
}
#endif /* CONFIG_BOARDCTL */

View file

@ -0,0 +1,147 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_lcd_gc9a01.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/board/board.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/config.h>
#include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/gc9a01.h>
#include <stdbool.h>
#include <stdio.h>
#include <syslog.h>
#include "espressif/esp_gpio.h"
#include "esp32s3_spi.h"
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Private Data
****************************************************************************/
static struct spi_dev_s *g_spidev;
static struct lcd_dev_s *g_lcd = NULL;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
*
* Description:
* Initialize the LCD video hardware. The initial state of the LCD is
* fully initialized, display memory cleared, and the LCD ready to use, but
* with the power setting at 0 (full off).
*
****************************************************************************/
int board_lcd_initialize(void)
{
syslog(LOG_DEBUG, "Initializing LCD GPIO pins.");
/* SPI RX is not used. Same pin is used as LCD Data/Command control */
esp_configgpio(DISPLAY_DC, OUTPUT);
esp_gpiowrite(DISPLAY_DC, true);
/* Pull LCD_RESET high */
esp_configgpio(DISPLAY_RST, OUTPUT);
esp_gpiowrite(DISPLAY_RST, false);
up_mdelay(50);
esp_gpiowrite(DISPLAY_RST, true);
up_mdelay(50);
/* Set full brightness */
esp_configgpio(DISPLAY_BCKL, OUTPUT);
esp_gpiowrite(DISPLAY_BCKL, true);
syslog(LOG_DEBUG, "Initializing LCD SPI %d port.\n", DISPLAY_SPI);
g_spidev = esp32s3_spibus_initialize(DISPLAY_SPI);
if (!g_spidev)
{
syslog(LOG_ERR, "Failed to initialize LCD SPI port %d.\n",
DISPLAY_SPI);
return -ENODEV;
}
syslog(LOG_DEBUG, "Initializing GC9A01 LCD.\n");
g_lcd = gc9a01_lcdinitialize(g_spidev);
if (!g_lcd)
{
syslog(LOG_ERR, "Failed to initialize LCD %d.\n", 0);
return -ENODEV;
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
*
* Description:
* Return a reference to the LCD object for the specified LCD. This
* allows support for multiple LCD devices.
*
****************************************************************************/
struct lcd_dev_s *board_lcd_getdev(int devno)
{
if (!g_lcd)
{
syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to LCD %d\n",
DISPLAY_SPI, devno);
return NULL;
}
else
{
syslog(LOG_INFO, "SPI port %d bound to LCD %d.\n", DISPLAY_SPI, devno);
return g_lcd;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
*
* Description:
* Uninitialize the LCD support
*
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* Turn the display off */
g_lcd->setpower(g_lcd, 0);
}

View file

@ -0,0 +1,161 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_board_spi.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "espressif/esp_gpio.h"
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: spi_status
****************************************************************************/
static inline uint8_t spi_status(struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
#ifdef CONFIG_MMCSD_SPI
if (devid == SPIDEV_MMCSD(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
#if defined(CONFIG_LCD_ILI9341) || defined(CONFIG_LCD_SSD1680) || defined(CONFIG_LCD_ST7789) || defined(CONFIG_LCD_GC9A01)
if (devid == SPIDEV_DISPLAY(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
return status;
}
/****************************************************************************
* Name: spi_cmddata
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
static inline int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
#if defined(CONFIG_LCD_ILI9341) || defined(CONFIG_LCD_SSD1680) || defined(CONFIG_LCD_ST7789) || defined(CONFIG_LCD_GC9A01)
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
esp_gpiowrite(DISPLAY_DC, !cmd);
return OK;
}
#endif
return -ENODEV;
}
#endif
#if defined(CONFIG_ESP32S3_SPI2) && defined(CONFIG_ESP32S3_SPI_UDCS)
void esp32s3_spi2_select(struct spi_dev_s *dev, uint32_t devid, bool select)
{
esp_gpiowrite(CONFIG_ESP32S3_SPI2_CSPIN, !select);
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_spi2_status
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPI2
uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid)
{
return spi_status(dev, devid);
}
#endif
/****************************************************************************
* Name: esp32s3_spi2_cmddata
****************************************************************************/
#if defined(CONFIG_ESP32S3_SPI2) && defined(CONFIG_SPI_CMDDATA)
int esp32s3_spi2_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
"data");
return spi_cmddata(dev, devid, cmd);
}
#endif
/****************************************************************************
* Name: esp32s3_spi3_status
****************************************************************************/
#ifdef CONFIG_ESP32S3_SPI3
uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid)
{
return spi_status(dev, devid);
}
#endif
/****************************************************************************
* Name: esp32s3_spi3_cmddata
****************************************************************************/
#if defined(CONFIG_ESP32S3_SPI3) && defined(CONFIG_SPI_CMDDATA)
int esp32s3_spi3_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
"data");
return spi_cmddata(dev, devid, cmd);
}
#endif

View file

@ -0,0 +1,85 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_boot.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/mm/mm.h>
#include <arch/board/board.h>
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_board_initialize
*
* Description:
* All ESP32-S3 boards must provide the following entry point.
* This entry point is called early in the initialization -- after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
****************************************************************************/
void esp32s3_board_initialize(void)
{
}
/****************************************************************************
* Name: board_late_initialize
*
* Description:
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_late_initialize(). board_late_initialize() will
* be called immediately after up_initialize() is called and just before
* the initial application is started. This additional initialization
* phase may be used, for example, to initialize board-specific device
* drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
/* Perform board-specific initialization */
esp32s3_bringup();
}
#endif

View file

@ -0,0 +1,678 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_bringup.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <fcntl.h>
#include <unistd.h>
#include <syslog.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <debug.h>
#include <stdio.h>
#include <errno.h>
#include <nuttx/fs/fs.h>
#include <nuttx/himem/himem.h>
#include <nuttx/lcd/lcd_dev.h>
#include <arch/board/board.h>
#ifdef CONFIG_ESP32S3_TIMER
# include "esp32s3_board_tim.h"
#endif
#ifdef CONFIG_ESPRESSIF_WIFI
# include "esp32s3_board_wlan.h"
#endif
#ifdef CONFIG_ESPRESSIF_BLE
# include "esp32s3_ble.h"
#endif
#ifdef CONFIG_ESPRESSIF_WIFI_BT_COEXIST
# include "esp32s3_wifi_adapter.h"
#endif
#ifdef CONFIG_ESP32S3_RT_TIMER
# include "esp32s3_rt_timer.h"
#endif
#ifdef CONFIG_ESP32S3_I2C
# include "esp32s3_i2c.h"
#endif
#ifdef CONFIG_ESPRESSIF_I2S
# include "espressif/esp_i2s.h"
#endif
#ifdef CONFIG_WATCHDOG
# include "esp32s3_board_wdt.h"
#endif
#ifdef CONFIG_INPUT_BUTTONS
# include <nuttx/input/buttons.h>
#endif
#ifdef CONFIG_RTC_DRIVER
# include "esp32s3_rtc_lowerhalf.h"
#endif
#ifdef CONFIG_VIDEO_FB
#include <nuttx/video/fb.h>
#endif
#ifdef CONFIG_ESPRESSIF_EFUSE
# include "espressif/esp_efuse.h"
#endif
#ifdef CONFIG_ESPRESSIF_LEDC
# include "esp32s3_board_ledc.h"
#endif
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
# include "esp32s3_partition.h"
#endif
#ifdef CONFIG_ESP_RMT
# include "esp32s3_board_rmt.h"
#endif
#ifdef CONFIG_ESP_MCPWM
# include "esp32s3_board_mcpwm.h"
#endif
#ifdef CONFIG_ESP32S3_SPI
#include "esp32s3_spi.h"
#include "esp32s3_board_spidev.h"
# ifdef CONFIG_ESPRESSIF_SPI_BITBANG
# include "espressif/esp_spi_bitbang.h"
# endif
#endif
#ifdef CONFIG_SPI_SLAVE_DRIVER
#include "esp32s3_board_spislavedev.h"
#endif
#if defined(CONFIG_ESP32S3_SDMMC) || defined(CONFIG_MMCSD_SPI)
#include "esp32s3_board_sdmmc.h"
#endif
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR
# include "esp32s3_aes.h"
#endif
#ifdef CONFIG_ESPRESSIF_ADC
#include "esp32s3_board_adc.h"
#endif
#ifdef CONFIG_ESPRESSIF_TEMP
# include "espressif/esp_temperature_sensor.h"
#endif
#ifdef CONFIG_ESP_PCNT
# include "espressif/esp_pcnt.h"
# include "esp32s3_board_pcnt.h"
#endif
#ifdef CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL
# include "espressif/esp_nxdiag.h"
#endif
#ifdef CONFIG_ESP_SDM
# include "espressif/esp_sdm.h"
#endif
#ifdef CONFIG_ESPRESSIF_SHA_ACCELERATOR
# include "espressif/esp_sha.h"
#endif
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
# include "espressif/esp_ulp.h"
# ifdef CONFIG_ESPRESSIF_ULP_USE_TEST_BIN
# include "ulp/ulp_code.h"
# endif
#endif
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_bringup
*
* Description:
* Perform architecture-specific initialization
*
* CONFIG_BOARD_LATE_INITIALIZE=y :
* Called from board_late_initialize().
*
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
* Called from the NSH library
*
****************************************************************************/
int esp32s3_bringup(void)
{
int ret;
syslog(LOG_INFO, "esp32s3_bringup(): start.");
#if (defined(CONFIG_ESPRESSIF_I2S0) && !defined(CONFIG_AUDIO_CS4344)) || \
defined(CONFIG_ESPRESSIF_I2S1)
bool i2s_enable_tx;
bool i2s_enable_rx;
#endif
#if defined(CONFIG_ESP32S3_SPIRAM) && \
defined(CONFIG_ESP32S3_SPIRAM_BANKSWITCH_ENABLE)
ret = esp_himem_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init HIMEM: %d\n", ret);
}
#endif
#if defined(CONFIG_ESP32S3_SPI) && defined(CONFIG_SPI_DRIVER)
#if defined(CONFIG_SPI_SLAVE_DRIVER) && defined(CONFIG_ESP32S3_SPI2)
ret = board_spislavedev_initialize(ESP32S3_SPI2);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize SPI%d Slave driver: %d\n",
ESP32S3_SPI2, ret);
}
#endif
#if defined(CONFIG_SPI_SLAVE_DRIVER) && defined(CONFIG_ESP32S3_SPI3)
ret = board_spislavedev_initialize(ESP32S3_SPI3);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize SPI%d Slave driver: %d\n",
ESP32S3_SPI2, ret);
}
#endif
#if defined(CONFIG_ESP32S3_SPI2) && !defined(CONFIG_SPI_SLAVE_DRIVER)
ret = board_spidev_initialize(ESP32S3_SPI2);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
}
#endif
#if defined(CONFIG_ESP32S3_SPI3) && !defined(CONFIG_SPI_SLAVE_DRIVER)
ret = board_spidev_initialize(ESP32S3_SPI3);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_SPI_BITBANG
ret = board_spidev_initialize(ESPRESSIF_SPI_BITBANG);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
}
#endif /* CONFIG_ESPRESSIF_SPI_BITBANG */
#endif /* CONFIG_ESP32S3_SPI && CONFIG_SPI_DRIVER*/
#if defined(CONFIG_ESPRESSIF_EFUSE)
ret = esp_efuse_initialize("/dev/efuse");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %d\n", ret);
}
#endif
#if defined(CONFIG_ESPRESSIF_SHA_ACCELERATOR) && \
!defined(CONFIG_CRYPTO_CRYPTODEV_HARDWARE)
ret = esp_sha_init();
if (ret < 0)
{
syslog(LOG_ERR,
"ERROR: Failed to initialize SHA: %d\n", ret);
}
#endif
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
}
#endif
#ifdef CONFIG_FS_TMPFS
/* Mount the tmpfs file system */
ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n",
CONFIG_LIBC_TMPDIR, ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_LEDC
ret = esp32s3_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp32s3_pwm_setup() failed: %d\n", ret);
}
#endif /* CONFIG_ESPRESSIF_LEDC */
#ifdef CONFIG_ESP32S3_TIMER
/* Configure general purpose timers */
ret = board_tim_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize timers: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP32S3_SPIFLASH
ret = board_spiflash_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SPI Flash\n");
}
#endif
#ifdef CONFIG_ESP32S3_PARTITION_TABLE
ret = esp32s3_partition_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize partition error=%d\n",
ret);
}
#endif
#ifdef CONFIG_ESP32S3_RT_TIMER
ret = esp32s3_rt_timer_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize RT timer: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP_RMT
ret = board_rmt_txinitialize(RMT_TXCHANNEL, RMT_OUTPUT_PIN);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_rmt_txinitialize() failed: %d\n", ret);
}
ret = board_rmt_rxinitialize(RMT_RXCHANNEL, RMT_INPUT_PIN);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_rmt_txinitialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_TEMP
struct esp_temp_sensor_config_t cfg = TEMPERATURE_SENSOR_CONFIG(10, 50);
ret = esp_temperature_sensor_initialize(cfg);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize temperature sensor driver: %d\n",
ret);
}
#endif
#ifdef CONFIG_RTC_DRIVER
/* Instantiate the ESP32-S3 RTC driver */
ret = esp32s3_rtc_driverinit();
if (ret < 0)
{
syslog(LOG_ERR,
"ERROR: Failed to Instantiate the RTC driver: %d\n", ret);
}
#endif
#ifdef CONFIG_WATCHDOG
/* Configure watchdog timer */
ret = board_wdt_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize watchdog timer: %d\n", ret);
}
#endif
#ifdef CONFIG_I2C_DRIVER
/* Configure I2C peripheral interfaces */
ret = board_i2c_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP32S3_TWAI
/* Initialize TWAI and register the TWAI driver. */
ret = esp32s3_twai_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp32s3_twai_setup failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_BMP180
/* Try to register BMP180 device in I2C0 */
ret = board_bmp180_initialize(0, ESP32S3_I2C0);
if (ret < 0)
{
syslog(LOG_ERR,
"Failed to initialize BMP180 driver for I2C0: %d\n", ret);
}
#endif
#if defined(CONFIG_ESPRESSIF_I2S)
#ifdef CONFIG_AUDIO_CS4344
/* Configure CS4344 audio on I2S0 */
ret = esp32s3_cs4344_initialize(ESP32S3_I2S0);
if (ret != OK)
{
syslog(LOG_ERR, "Failed to initialize CS4344 audio: %d\n", ret);
}
#else
#if defined(CONFIG_ESPRESSIF_I2S0_TX)
i2s_enable_tx = true;
#else
i2s_enable_tx = false;
#endif /* CONFIG_ESPRESSIF_I2S0_TX */
#if defined(CONFIG_ESPRESSIF_I2S0_RX)
i2s_enable_rx = true;
#else
i2s_enable_rx = false;
#endif /* CONFIG_ESPRESSIF_I2S0_RX */
/* Configure I2S generic audio on I2S0 */
ret = board_i2sdev_initialize(ESP32S3_I2S0, i2s_enable_tx, i2s_enable_rx);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2S0 driver: %d\n", ret);
}
#endif /* CONFIG_AUDIO_CS4344 */
#if defined(CONFIG_ESPRESSIF_I2S1)
#if defined(CONFIG_ESPRESSIF_I2S1_TX)
i2s_enable_tx = true;
#else
i2s_enable_tx = false;
#endif /* CONFIG_ESPRESSIF_I2S1_TX */
#if defined(CONFIG_ESPRESSIF_I2S1_RX)
i2s_enable_rx = true;
#else
i2s_enable_rx = false;
#endif /* CONFIG_ESPRESSIF_I2S1_RX */
/* Configure I2S generic audio on I2S1 */
ret = board_i2sdev_initialize(ESP32S3_I2S1, i2s_enable_tx, i2s_enable_rx);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize I2S%d driver: %d\n",
ESP32S3_I2S1, ret);
}
#endif /* CONFIG_ESPRESSIF_I2S1 */
#endif /* CONFIG_ESPRESSIF_I2S */
#ifdef CONFIG_INPUT_BUTTONS
/* Register the BUTTON driver */
ret = btn_lower_initialize("/dev/buttons");
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize button driver: %d\n", ret);
}
#endif
#ifdef CONFIG_INPUT_DJOYSTICK
ret = esp32s3_djoy_initialize();
if (ret != OK)
{
syslog(LOG_ERR, "Failed to register djoystick driver: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_WIRELESS
#ifdef CONFIG_ESPRESSIF_WIFI_BT_COEXIST
ret = esp_wifi_bt_coexist_init();
if (ret)
{
syslog(LOG_ERR, "ERROR: Failed to initialize Wi-Fi and BT coexist\n");
}
#endif
#ifdef CONFIG_ESPRESSIF_BLE
ret = esp32s3_ble_initialize();
if (ret)
{
syslog(LOG_ERR, "ERROR: Failed to initialize BLE\n");
}
#endif
#ifdef CONFIG_ESPRESSIF_WIFI
ret = board_wlan_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize wlan subsystem=%d\n",
ret);
}
#endif
#endif
#ifdef CONFIG_ESP32S3_OPENETH
ret = esp_openeth_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize Open ETH ethernet.\n");
}
#endif
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
ret = esp32s3_gpio_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
}
#endif
#if defined(CONFIG_VIDEO_FB)
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize Frame Buffer Driver.\n");
}
#elif defined(CONFIG_LCD)
ret = board_lcd_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize LCD.\n");
}
#endif
#ifdef CONFIG_LCD_DEV
ret = lcddev_register(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: lcddev_register() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_NET_LAN9250
ret = esp32s3_lan9250_initialize(LAN9250_SPI);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SPI ethernet LAN9250.\n");
}
#endif
#ifdef CONFIG_ESP32S3_SDMMC
ret = board_sdmmc_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SDMMC: %d\n", ret);
}
#endif
#ifdef CONFIG_MMCSD_SPI
ret = board_sdmmc_spi_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SDMMC: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR
ret = esp32s3_aes_init();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize AES: %d\n", ret);
}
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR_TEST
else
{
esp32s3_aes_test();
}
#endif
#endif
#ifdef CONFIG_ESPRESSIF_ADC
/* Configure ADC */
ret = board_adc_init();
if (ret)
{
syslog(LOG_ERR, "ERROR: board_adc_init() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP_SDM
struct esp_sdm_chan_config_s config =
{
.gpio_num = 5,
.sample_rate_hz = 1000 * 1000,
.flags = 0,
};
struct dac_dev_s *dev = esp_sdminitialize(config);
ret = dac_register("/dev/dac0", dev);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize DAC driver: %d\n",
ret);
}
#endif
#ifdef CONFIG_ESP_MCPWM_CAPTURE
ret = board_capture_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_capture_initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP_MCPWM_MOTOR_BDC
ret = board_motor_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_motor_initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESP_PCNT
ret = board_pcnt_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_pcnt_initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL
ret = esp_nxdiag_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp_nxdiag_initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
/* ULP initialization should be the handled later than
* peripherals to use supported peripherals properly on ULP core
*/
esp_ulp_init();
# ifdef CONFIG_ESPRESSIF_ULP_USE_TEST_BIN
esp_ulp_load_bin((char *)esp_ulp_bin, esp_ulp_bin_len);
# endif
#endif
#ifdef CONFIG_SENSORS_QMI8658
ret = esp32s3_qmi8658_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp32s3_qmi8658_initialize failed: %d\n", ret);
}
#endif
/* If we got here then perhaps not all initialization was successful, but
* at least enough succeeded to bring-up NSH with perhaps reduced
* capabilities.
*/
syslog(LOG_INFO, "esp32s3_bringup(): end.");
UNUSED(ret);
return OK;
}

View file

@ -0,0 +1,166 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_buttons.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <assert.h>
#include <debug.h>
#include <stdbool.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/irq.h>
#include "esp32s3_gpio.h"
#include "hardware/esp32s3_gpio_sigmap.h"
#include "esp32s3-ws-lcd128.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/
uint32_t board_button_initialize(void)
{
esp32s3_configgpio(BUTTON_BOOT, INPUT_FUNCTION_2 | PULLUP);
return 1;
}
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns an
* 8-bit bit set with each bit associated with a button. See the
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
*
****************************************************************************/
uint32_t board_buttons(void)
{
uint8_t ret = 0;
int i = 0;
int n = 0;
bool b0 = esp32s3_gpioread(BUTTON_BOOT);
for (i = 0; i < 10; i++)
{
up_mdelay(1);
bool b1 = esp32s3_gpioread(BUTTON_BOOT);
if (b0 == b1)
{
n++;
}
else
{
n = 0;
}
if (3 == n)
{
break;
}
b0 = b1;
}
iinfo("b=%d n=%d\n", b0, n);
/* Low value means that the button is pressed */
if (!b0)
{
ret = 0x1;
}
return ret;
}
/****************************************************************************
* Name: board_button_irq
*
* Description:
* board_button_irq() may be called to register an interrupt handler that
* will be called when a button is depressed or released. The ID value is
* a button enumeration value that uniquely identifies a button resource.
* See the BUTTON_* definitions in board.h for the meaning of enumeration
* value.
*
****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS
int board_button_irq(int id, xcpt_t irqhandler, void *arg)
{
int ret;
DEBUGASSERT(id == 0);
int irq = ESP32S3_PIN2IRQ(BUTTON_BOOT);
if (irqhandler != NULL)
{
/* Make sure the interrupt is disabled */
esp32s3_gpioirqdisable(irq);
ret = irq_attach(irq, irqhandler, arg);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: irq_attach() failed: %d\n", ret);
return ret;
}
gpioinfo("Attach %p\n", irqhandler);
gpioinfo("Enabling the interrupt\n");
/* Configure the interrupt for rising and falling edges */
esp32s3_gpioirqenable(irq, CHANGE);
}
else
{
gpioinfo("Disable the interrupt\n");
esp32s3_gpioirqdisable(irq);
}
return OK;
}
#endif

View file

@ -0,0 +1,537 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_gpio.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/ioexpander/gpio.h>
#include <arch/board/board.h>
#include "esp32s3-ws-lcd128.h"
#include "esp32s3_gpio.h"
#include "hardware/esp32s3_gpio_sigmap.h"
#ifdef CONFIG_ESPRESSIF_DEDICATED_GPIO
#include "espressif/esp_dedic_gpio.h"
#endif
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
#include "esp32s3_rtc_gpio.h"
#endif
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#if !defined(CONFIG_ESP32S3_GPIO_IRQ) && BOARD_NGPIOINT > 0
# error "NGPIOINT is > 0 and GPIO interrupts aren't enabled"
#endif
/* Output pins. GPIO15 is used as an example, any other outputs could be
* used.
*/
#define GPIO_OUT1 15
/* Input pins. GPIO18 is used as an example, any other inputs could be
* used.
*/
#define GPIO_IN1 18
/* Interrupt pins. GPIO21 is used as an example, any other inputs could be
* used.
*/
#define GPIO_IRQPIN1 21
/* Dedicated GPIO pins. GPIO4 and GPIO5 is used as an example, any other
* GPIOs could be used.
*/
#define GPIO_DEDIC1 4
#define GPIO_DEDIC2 5
#define GPIO_DEDIC_COUNT 2
#define GPIO_RTC1 0
#define GPIO_RTC_COUNT 1
/****************************************************************************
* Private Types
****************************************************************************/
struct esp32s3gpio_dev_s
{
struct gpio_dev_s gpio;
uint8_t id;
};
struct esp32s3gpint_dev_s
{
struct esp32s3gpio_dev_s esp32s3gpio;
pin_interrupt_t callback;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
#if BOARD_NGPIOOUT > 0
static int gpout_read(struct gpio_dev_s *dev, bool *value);
static int gpout_write(struct gpio_dev_s *dev, bool value);
#endif
#if BOARD_NGPIOIN > 0
static int gpin_read(struct gpio_dev_s *dev, bool *value);
#endif
#if BOARD_NGPIOINT > 0
static int gpint_read(struct gpio_dev_s *dev, bool *value);
static int gpint_attach(struct gpio_dev_s *dev,
pin_interrupt_t callback);
static int gpint_enable(struct gpio_dev_s *dev, bool enable);
#endif
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
static int gprtc_read(struct gpio_dev_s *dev, bool *value);
static int gprtc_write(struct gpio_dev_s *dev, bool value);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#if BOARD_NGPIOOUT > 0
static const struct gpio_operations_s gpout_ops =
{
.go_read = gpout_read,
.go_write = gpout_write,
.go_attach = NULL,
.go_enable = NULL,
};
/* This array maps the GPIO pins used as OUTPUT */
static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] =
{
GPIO_OUT1
};
static struct esp32s3gpio_dev_s g_gpout[BOARD_NGPIOOUT];
#endif
#if BOARD_NGPIOIN > 0
static const struct gpio_operations_s gpin_ops =
{
.go_read = gpin_read,
.go_write = NULL,
.go_attach = NULL,
.go_enable = NULL,
};
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
static const uint32_t g_gpioinputs[BOARD_NGPIOIN] =
{
GPIO_IN1
};
static struct esp32s3gpio_dev_s g_gpin[BOARD_NGPIOIN];
#endif
#if BOARD_NGPIOINT > 0
static const struct gpio_operations_s gpint_ops =
{
.go_read = gpint_read,
.go_write = NULL,
.go_attach = gpint_attach,
.go_enable = gpint_enable,
};
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
static const uint32_t g_gpiointinputs[BOARD_NGPIOINT] =
{
GPIO_IRQPIN1,
};
static struct esp32s3gpint_dev_s g_gpint[BOARD_NGPIOINT];
#endif
/* This array maps the GPIO pins used as Dedicated GPIO */
#ifdef CONFIG_ESPRESSIF_DEDICATED_GPIO
static const int g_gpioidedic[GPIO_DEDIC_COUNT] =
{
GPIO_DEDIC1, GPIO_DEDIC2
};
static struct esp_dedic_gpio_flags_s dedic_gpio_flags =
{
.input_enable = 1,
.invert_input_enable = 0,
.output_enable = 1,
.invert_output_enable = 0
};
struct esp_dedic_gpio_config_s dedic_gpio_conf =
{
.gpio_array = g_gpioidedic,
.array_size = GPIO_DEDIC_COUNT,
.flags = &dedic_gpio_flags,
.path = "/dev/dedic_gpio0"
};
struct file *dedicated_gpio = NULL;
#endif
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
static const struct gpio_operations_s gprtc_ops =
{
.go_read = gprtc_read,
.go_write = gprtc_write,
.go_attach = NULL,
.go_enable = NULL,
.go_setpintype = NULL,
};
/* This array maps the GPIO pins used as OUTPUT */
static const uint32_t g_gpiortc[GPIO_RTC_COUNT] =
{
GPIO_RTC1
};
static struct esp32s3gpio_dev_s g_gprtc[GPIO_RTC_COUNT];
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
/****************************************************************************
* Name: gprtc_read
*
* Description:
* Read a RTC digital output pin.
*
* Parameters:
* dev - A pointer to the gpio driver struct.
* value - A pointer to store the state of the pin.
*
* Returned Value:
* Zero (OK).
*
****************************************************************************/
static int gprtc_read(struct gpio_dev_s *dev, bool *value)
{
struct esp32s3gpio_dev_s *espgpio = (struct esp32s3gpio_dev_s *)dev;
DEBUGASSERT(espgpio != NULL && value != NULL);
gpioinfo("Reading...\n");
*value = esp32s3_rtcioread(g_gpiortc[espgpio->id]);
return OK;
}
/****************************************************************************
* Name: gprtc_write
*
* Description:
* Write to a RTC digital output pin.
*
* Parameters:
* dev - A pointer to the gpio driver struct.
* value - The value to be written.
*
* Returned Value:
* Zero (OK).
*
****************************************************************************/
static int gprtc_write(struct gpio_dev_s *dev, bool value)
{
struct esp32s3gpio_dev_s *espgpio = (struct esp32s3gpio_dev_s *)dev;
DEBUGASSERT(espgpio != NULL);
gpioinfo("Writing %d\n", (int)value);
esp32s3_rtciowrite(g_gpiortc[espgpio->id], value);
return OK;
}
#endif
/****************************************************************************
* Name: gpout_read
****************************************************************************/
#if BOARD_NGPIOOUT > 0
static int gpout_read(struct gpio_dev_s *dev, bool *value)
{
struct esp32s3gpio_dev_s *esp32s3gpio = (struct esp32s3gpio_dev_s *)dev;
DEBUGASSERT(esp32s3gpio != NULL && value != NULL);
DEBUGASSERT(esp32s3gpio->id < BOARD_NGPIOOUT);
gpioinfo("Reading...\n");
*value = esp32s3_gpioread(g_gpiooutputs[esp32s3gpio->id]);
return OK;
}
/****************************************************************************
* Name: gpout_write
****************************************************************************/
static int gpout_write(struct gpio_dev_s *dev, bool value)
{
struct esp32s3gpio_dev_s *esp32s3gpio = (struct esp32s3gpio_dev_s *)dev;
DEBUGASSERT(esp32s3gpio != NULL);
DEBUGASSERT(esp32s3gpio->id < BOARD_NGPIOOUT);
gpioinfo("Writing %d\n", (int)value);
esp32s3_gpiowrite(g_gpiooutputs[esp32s3gpio->id], value);
return OK;
}
#endif
/****************************************************************************
* Name: gpin_read
****************************************************************************/
#if BOARD_NGPIOIN > 0
static int gpin_read(struct gpio_dev_s *dev, bool *value)
{
struct esp32s3gpio_dev_s *esp32s3gpio = (struct esp32s3gpio_dev_s *)dev;
DEBUGASSERT(esp32s3gpio != NULL && value != NULL);
DEBUGASSERT(esp32s3gpio->id < BOARD_NGPIOIN);
gpioinfo("Reading... pin %" PRIu32 "\n", g_gpioinputs[esp32s3gpio->id]);
*value = esp32s3_gpioread(g_gpioinputs[esp32s3gpio->id]);
return OK;
}
#endif
/****************************************************************************
* Name: esp32s3gpio_interrupt
****************************************************************************/
#if BOARD_NGPIOINT > 0
static int esp32s3gpio_interrupt(int irq, void *context, void *arg)
{
struct esp32s3gpint_dev_s *esp32s3gpint = (struct esp32s3gpint_dev_s *)arg;
DEBUGASSERT(esp32s3gpint != NULL && esp32s3gpint->callback != NULL);
gpioinfo("Interrupt! callback=%p\n", esp32s3gpint->callback);
esp32s3gpint->callback(&esp32s3gpint->esp32s3gpio.gpio,
esp32s3gpint->esp32s3gpio.id);
return OK;
}
/****************************************************************************
* Name: gpint_read
****************************************************************************/
static int gpint_read(struct gpio_dev_s *dev, bool *value)
{
struct esp32s3gpint_dev_s *esp32s3gpint = (struct esp32s3gpint_dev_s *)dev;
DEBUGASSERT(esp32s3gpint != NULL && value != NULL);
DEBUGASSERT(esp32s3gpint->esp32s3gpio.id < BOARD_NGPIOINT);
gpioinfo("Reading int pin...\n");
*value = esp32s3_gpioread(g_gpiointinputs[esp32s3gpint->esp32s3gpio.id]);
return OK;
}
/****************************************************************************
* Name: gpint_attach
****************************************************************************/
static int gpint_attach(struct gpio_dev_s *dev,
pin_interrupt_t callback)
{
struct esp32s3gpint_dev_s *esp32s3gpint =
(struct esp32s3gpint_dev_s *)dev;
int irq = ESP32S3_PIN2IRQ(g_gpiointinputs[esp32s3gpint->esp32s3gpio.id]);
int ret;
gpioinfo("Attaching the callback\n");
/* Make sure the interrupt is disabled */
esp32s3_gpioirqdisable(irq);
ret = irq_attach(irq,
esp32s3gpio_interrupt,
&g_gpint[esp32s3gpint->esp32s3gpio.id]);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: gpint_attach() failed: %d\n", ret);
return ret;
}
gpioinfo("Attach %p\n", callback);
esp32s3gpint->callback = callback;
return OK;
}
/****************************************************************************
* Name: gpint_enable
****************************************************************************/
static int gpint_enable(struct gpio_dev_s *dev, bool enable)
{
struct esp32s3gpint_dev_s *esp32s3gpint = (struct esp32s3gpint_dev_s *)dev;
int irq = ESP32S3_PIN2IRQ(g_gpiointinputs[esp32s3gpint->esp32s3gpio.id]);
if (enable)
{
if (esp32s3gpint->callback != NULL)
{
gpioinfo("Enabling the interrupt\n");
/* Configure the interrupt for rising edge */
esp32s3_gpioirqenable(irq, RISING);
}
}
else
{
gpioinfo("Disable the interrupt\n");
esp32s3_gpioirqdisable(irq);
}
return OK;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_gpio_init
****************************************************************************/
int esp32s3_gpio_init(void)
{
int pincount = 0;
int i;
#if BOARD_NGPIOOUT > 0
for (i = 0; i < BOARD_NGPIOOUT; i++)
{
/* Setup and register the GPIO pin */
g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
g_gpout[i].gpio.gp_ops = &gpout_ops;
g_gpout[i].id = i;
gpio_pin_register(&g_gpout[i].gpio, pincount);
/* Configure the pins that will be used as output */
esp32s3_gpio_matrix_out(g_gpiooutputs[i], SIG_GPIO_OUT_IDX, 0, 0);
esp32s3_configgpio(g_gpiooutputs[i], OUTPUT_FUNCTION_2 |
INPUT_FUNCTION_2);
esp32s3_gpiowrite(g_gpiooutputs[i], 0);
pincount++;
}
#endif
#if BOARD_NGPIOIN > 0
for (i = 0; i < BOARD_NGPIOIN; i++)
{
/* Setup and register the GPIO pin */
g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN;
g_gpin[i].gpio.gp_ops = &gpin_ops;
g_gpin[i].id = i;
gpio_pin_register(&g_gpin[i].gpio, pincount);
/* Configure the pins that will be used as INPUT */
esp32s3_configgpio(g_gpioinputs[i], INPUT_FUNCTION_2);
pincount++;
}
#endif
#if BOARD_NGPIOINT > 0
for (i = 0; i < BOARD_NGPIOINT; i++)
{
/* Setup and register the GPIO pin */
g_gpint[i].esp32s3gpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN;
g_gpint[i].esp32s3gpio.gpio.gp_ops = &gpint_ops;
g_gpint[i].esp32s3gpio.id = i;
gpio_pin_register(&g_gpint[i].esp32s3gpio.gpio, pincount);
/* Configure the pins that will be used as interrupt input */
esp32s3_configgpio(g_gpiointinputs[i], INPUT_FUNCTION_2 | PULLDOWN);
pincount++;
}
#endif
#ifdef CONFIG_ESPRESSIF_DEDICATED_GPIO
dedicated_gpio = esp_dedic_gpio_new_bundle(&dedic_gpio_conf);
pincount++;
#endif
#ifdef CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE
for (i = 0; i < GPIO_RTC_COUNT; i++)
{
/* Setup and register the GPIO pin */
g_gprtc[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
g_gprtc[i].gpio.gp_ops = &gprtc_ops;
g_gprtc[i].id = i;
gpio_pin_register(&g_gprtc[i].gpio, pincount);
/* Configure the pins that will be used as input/output */
esp32s3_configrtcio(g_gpiortc[i], RTC_INPUT | RTC_OUTPUT);
pincount++;
}
#endif
return OK;
}
#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */

View file

@ -0,0 +1,87 @@
/****************************************************************************
* boards/xtensa/esp32s3/esp32s3-ws-lcd128/src/esp32s3_reset.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdlib.h>
#include <debug.h>
#include <assert.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include "esp32s3_systemreset.h"
#ifdef CONFIG_BOARDCTL_RESET
#if CONFIG_BOARD_ASSERT_RESET_VALUE == EXIT_SUCCESS
# error "CONFIG_BOARD_ASSERT_RESET_VALUE must not be equal to EXIT_SUCCESS"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_reset
*
* Description:
* Reset board. Support for this function is required by board-level
* logic if CONFIG_BOARDCTL_RESET is selected.
*
* Input Parameters:
* status - Status information provided with the reset event. This
* meaning of this status information is board-specific. If not
* used by a board, the value zero may be provided in calls to
* board_reset().
*
* Returned Value:
* If this function returns, then it was not possible to power-off the
* board due to some constraints. The return value in this case is a
* board-specific reason for the failure to shutdown.
*
****************************************************************************/
int board_reset(int status)
{
syslog(LOG_INFO, "reboot status=%d\n", status);
switch (status)
{
case EXIT_SUCCESS:
up_shutdown_handler();
break;
case CONFIG_BOARD_ASSERT_RESET_VALUE:
break;
default:
break;
}
up_systemreset();
return 0;
}
#endif /* CONFIG_BOARDCTL_RESET */