boards/esp32s3: Add initial support to the ESP32-S3-Korvo-2 board
The ESP32-S3-Korvo-2 is a multimedia development board based on the ESP32-S3 chip. It is equipped with a two-microphone array which is suitable for voice recognition and near/far-field voice wake-up applications. The board integrates multiple peripherals such as LCD, camera, and microSD card. It also supports JPEG video stream processing. With all of its outstanding features, the board is an ideal choice for the development of low-cost and low-power network-connected audio and video products.
After Width: | Height: | Size: 352 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 218 KiB |
After Width: | Height: | Size: 213 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 428 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 244 KiB |
After Width: | Height: | Size: 221 KiB |
After Width: | Height: | Size: 232 KiB |
After Width: | Height: | Size: 179 KiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 721 KiB |
After Width: | Height: | Size: 917 KiB |
|
@ -0,0 +1,962 @@
|
|||
=====================
|
||||
ESP32-S3-Korvo-2 V3.0
|
||||
=====================
|
||||
|
||||
The ESP32-S3-Korvo-2 is a multimedia development board based on the ESP32-S3 chip. It is equipped with a two-microphone array which is suitable for voice recognition and near/far-field voice wake-up applications. The board integrates multiple peripherals such as LCD, camera, and microSD card. It also supports JPEG video stream processing. With all of its outstanding features, the board is an ideal choice for the development of low-cost and low-power network-connected audio and video products.
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-overview.png
|
||||
:align: center
|
||||
:scale: 45%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 with ESP32-S3-WROOM-1 module
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 with ESP32-S3-WROOM-1 module
|
||||
|
||||
This board mainly consists of the following parts:
|
||||
|
||||
- Main board: ESP32-S3-Korvo-2
|
||||
- LCD extension board: `ESP32-S3-Korvo-2-LCD <user-guide-esp32https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2-lcd.html>`
|
||||
- Camera
|
||||
|
||||
This document is mostly dedicated to the main board. For detailed information on other parts, click the links above.
|
||||
|
||||
The document consists of the following sections:
|
||||
|
||||
- `Getting started`_: Overview of the board and hardware/software setup instructions to get started.
|
||||
- `Hardware Reference`_: More detailed information about the board's hardware.
|
||||
- `Hardware Revision Details`_: Hardware revision history, known issues, and links to user guides for previous versions (if any) of the board.
|
||||
- `Related Documents`_: Links to related documentation.
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
This section provides a brief introduction of ESP32-S3-Korvo-2 V3.0, instructions on how to do the initial hardware setup and how to flash firmware onto it.
|
||||
|
||||
|
||||
Description of Components
|
||||
-------------------------
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0.png
|
||||
:align: center
|
||||
:scale: 70%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 (click to enlarge)
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 (click to enlarge)
|
||||
|
||||
The key components of the board are described in a clockwise direction.
|
||||
|
||||
.. list-table::
|
||||
:widths: 30 70
|
||||
:header-rows: 1
|
||||
|
||||
* - Key Component
|
||||
- Description
|
||||
* - ESP32-S3-WROOM-1 Module
|
||||
- The ESP32-S3-WROOM-1 is a powerful, generic Wi-Fi + Bluetooth LE MCU module that is built around the ESP32-S3 series of SoCs. On top of a rich set of peripherals, the acceleration for neural network computing and signal processing workloads provided by the SoC make the modules an ideal choice for a wide variety of application scenarios related to AI and Artificial Intelligence of Things (AIoT), such as wake word detection, speech commands recognition, face detection and recognition, smart home, smart appliances, smart control panel, smart speaker, etc.
|
||||
* - Left Microphone
|
||||
- Onboard microphone connected to ADC.
|
||||
* - Audio ADC Chip
|
||||
- `ES7210 <http://www.everest-semi.com/pdf/ES7210%20PB.pdf>`_ is a high-performance, low-power 4-channel audio analog-to-digital converter for microphone array applications. It is very suitable for music and speech applications. In addition, ES7210 can also be used to collect acoustic echo cancellation (AEC) echo reference signals.
|
||||
* - Audio Codec Chip
|
||||
- The audio codec chip, `ES8311 <http://www.everest-semi.com/pdf/ES8311%20PB.pdf>`_, is a low-power mono audio codec. It consists of 1-channel ADC, 1-channel DAC, low noise pre-amplifier, headphone driver, digital sound effects, analog mixing, and gain functions. It is interfaced with ESP32-S3-WROOM-1 module over I2S and I2C buses to provide audio processing in hardware independently from the audio application.
|
||||
* - Audio PA Chip
|
||||
- NS4150 is an EMI, 3 W mono Class D audio power amplifier, amplifying audio signals from audio codec chips to drive speakers.
|
||||
* - Right Microphone
|
||||
- Onboard microphone connected to ADC.
|
||||
* - Speaker Output Port
|
||||
- Output socket to connect a speaker. The 4-ohm and 3-watt speaker is recommended. The pins have a 2.00 mm/0.08” pitch.
|
||||
* - USB-to-UART Bridge Chip
|
||||
- A single chip USB-UART bridge CP2102N provides up to 3 Mbps transfer rates for software download and debugging.
|
||||
* - USB-to-UART Port
|
||||
- Functions as the communication interface between a PC and the ESP32-S3-WROOM-1 module.
|
||||
* - USB Power Port
|
||||
- Provides power to the board. It is recommended to use at least 5V/2A power adapter to ensure a stable power supply.
|
||||
* - Battery Socket
|
||||
- Two pins socket to connect a single cell Li-ion battery.
|
||||
* - Power Switch
|
||||
- Power on/off knob: toggling it down powers the board on; toggling it up powers the board off.
|
||||
* - Battery Charger
|
||||
- AP5056 is a constant current and constant voltage linear charger for single cell lithium-ion batteries. Used for charging of a battery connected to the Battery Socket over the Micro USB Port.
|
||||
* - Function Press Keys
|
||||
- Six press keys labeled REC, MUTE, PLAY, SET, VOL- and VOL+. They are routed to ESP32-S3-WROOM-1 module and intended for development and testing of a UI for audio applications using a dedicated API.
|
||||
* - Boot/Reset Press Keys
|
||||
- | Boot: holding down the Boot key and momentarily pressing the Reset key initiates the firmware upload mode. Then you can upload firmware through the serial port.
|
||||
| Reset: pressing this button alone resets the system.
|
||||
* - MicroSD Slot
|
||||
- The development board supports a microSD card in 1-bit mode, and can store or play audio files in the microSD card.
|
||||
* - LCD Connector
|
||||
- A FPC connector with 0.5 mm pitch to connect to the LCD extension board.
|
||||
* - System LEDs
|
||||
- Two general-purpose LEDs (green and red) controlled by ESP32-S3-WROOM-1 module to indicate certain operation states of the audio application using dedicated API.
|
||||
* - Camera Connector
|
||||
- An external camera module that can be connected to the development board with the connector to transmit images.
|
||||
|
||||
Start Application Development
|
||||
-----------------------------
|
||||
|
||||
Before powering up your board, please make sure that it is in good condition with no obvious signs of damage.
|
||||
|
||||
Required Hardware
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
- 1 x ESP32-S3-Korvo-2 V3.0
|
||||
- 1 x Speaker
|
||||
- 2 x USB 2.0 cable (Standard-A to Micro-B)
|
||||
|
||||
.. note::
|
||||
|
||||
Be sure to use an appropriate USB cable. Some cables are for charging only and do not provide the needed data lines nor work for programming the boards.
|
||||
|
||||
Optional Hardware
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
- 1 x MicroSD card
|
||||
- 1 x Li-ion battery
|
||||
|
||||
.. note::
|
||||
|
||||
Be sure to use a Li-ion battery that has a built-in protection circuit.
|
||||
|
||||
Hardware Setup
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
1. Connect the speaker to the **Speaker Output**.
|
||||
2. Plug in the USB cables to the PC and to both USB ports of the board.
|
||||
3. The standby LED (green) should turn on. Assuming that a battery is not connected, the charging LED (red) will blink every couple of seconds.
|
||||
4. Toggle the **Power Switch**.
|
||||
5. The red Power On LED should turn on.
|
||||
|
||||
Contents and Packaging
|
||||
----------------------
|
||||
|
||||
.. _esp32-s3-korvo-2-v3.0-accessories:
|
||||
|
||||
The main board and its accessories can be ordered separately. The accessories include:
|
||||
|
||||
- LCD extension board: ESP32-S3-Korvo-2-LCD
|
||||
- Camera
|
||||
- Connectors:
|
||||
|
||||
- 20-pin FPC cable
|
||||
|
||||
- Fasteners:
|
||||
|
||||
- Copper standoffs (x8)
|
||||
- Screws (x4)
|
||||
|
||||
Retail Orders
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
If you order a few samples, each board comes in an individual package in either antistatic bag or any packaging depending on your retailer.
|
||||
|
||||
For retail orders, please go to https://www.espressif.com/en/company/contact/buy-a-sample.
|
||||
|
||||
|
||||
Wholesale Orders
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
If you order in bulk, the boards come in large cardboard boxes.
|
||||
|
||||
For wholesale orders, please go to https://www.espressif.com/en/contact-us/sales-questions.
|
||||
|
||||
|
||||
Hardware Reference
|
||||
==================
|
||||
|
||||
|
||||
Block Diagram
|
||||
-------------
|
||||
|
||||
The block diagram below shows the components of ESP32-S3-Korvo-2 V3.0 and their interconnections.
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-electrical-block-diagram.png
|
||||
:align: center
|
||||
:scale: 55%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 Electrical Block Diagram
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 Electrical Block Diagram
|
||||
|
||||
|
||||
Notes on Power Distribution
|
||||
---------------------------
|
||||
|
||||
Power Supply over USB and from Battery
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The main power supply is 5 V and provided by a USB. The secondary power supply is 3.7 V and provided by an optional battery. The USB power itself is fed with a dedicated cable, separating from a USB cable used for an application upload. To further reduce noise from the USB, the battery may be used instead of the USB.
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-usb-ps.png
|
||||
:align: center
|
||||
:scale: 40%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - Dedicated USB Power Supply Socket
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - Dedicated USB Power Supply Socket
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-battery-ps.png
|
||||
:align: center
|
||||
:scale: 40%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - Power Supply from a Battery
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - Power Supply from a Battery
|
||||
|
||||
As shown in the figure below, if the USB power supply and battery power supply are connected at the same time with a high VBUS, an off-state Q14, and an automatic cut-off VBAT, the USB becomes the power supply for the system.
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-ps-options.png
|
||||
:align: center
|
||||
:scale: 40%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - Power Supply Options
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - Power Supply Options
|
||||
|
||||
Independent Audio and Digital Power Supply
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 features independent power supplies to the audio components and ESP module. This should reduce noise in the audio signal from digital components and improve overall performance of the components.
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-digital-ps.png
|
||||
:align: center
|
||||
:scale: 40%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - Digital Power Supply
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - Digital Power Supply
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-audio-ps.png
|
||||
:align: center
|
||||
:scale: 40%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - Audio Power Supply
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - Audio Power Supply
|
||||
|
||||
|
||||
GPIO Allocation Summary
|
||||
-----------------------
|
||||
|
||||
The table below provides allocation of GPIOs exposed on terminals of ESP32-S3-WROOM-1 module to control specific components or functions of the board.
|
||||
|
||||
.. list-table:: ESP32-S3-WROOM-1 GPIO Allocation
|
||||
:header-rows: 1
|
||||
:widths: 10 10 10 10 10 10 10 10 10 10
|
||||
|
||||
* - Pin [#one]_
|
||||
- Pin Name
|
||||
- ES8311
|
||||
- ES7210
|
||||
- Camera
|
||||
- LCD
|
||||
- Keys
|
||||
- MicroSD
|
||||
- IO Expander
|
||||
- Other
|
||||
* - 3
|
||||
- EN
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- EN_KEY
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 4
|
||||
- IO4
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- DATA0
|
||||
-
|
||||
-
|
||||
* - 5
|
||||
- IO5
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- REC, MUTE, PLAY, SET, VOL-, VOL+
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 6
|
||||
- IO6
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- BAT_MEAS_ADC
|
||||
* - 7
|
||||
- IO7
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- CMD
|
||||
-
|
||||
-
|
||||
* - 8
|
||||
- IO15
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- CLK
|
||||
-
|
||||
-
|
||||
* - 9
|
||||
- IO16
|
||||
- I2S0_MCLK
|
||||
- MCLK
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 10
|
||||
- IO17
|
||||
- I2C_SDA
|
||||
- I2C_SDA
|
||||
- SIOD
|
||||
- TP_I2C_SDA
|
||||
-
|
||||
-
|
||||
- I2C_SDA
|
||||
-
|
||||
* - 11
|
||||
- IO18
|
||||
- I2C_CLK
|
||||
- I2C_CLK
|
||||
- SIOC
|
||||
- TP_I2C_CLK
|
||||
-
|
||||
-
|
||||
- I2C_CLK
|
||||
-
|
||||
* - 12
|
||||
- IO8
|
||||
- I2S0_DSDIN
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 13
|
||||
- IO19
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- ESP_USB_DM (Reserve)
|
||||
* - 14
|
||||
- IO20
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- ESP_USB_DP (Reserve)
|
||||
* - 15
|
||||
- IO3
|
||||
-
|
||||
-
|
||||
- D5
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 16
|
||||
- IO46
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- NC
|
||||
* - 17
|
||||
- IO9
|
||||
- I2S0_SCLK
|
||||
- SCLK
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 18
|
||||
- IO10
|
||||
-
|
||||
- SDOUT
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 19
|
||||
- IO11
|
||||
-
|
||||
-
|
||||
- PCLK
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 20
|
||||
- IO12
|
||||
-
|
||||
-
|
||||
- D6
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 21
|
||||
- IO13
|
||||
-
|
||||
-
|
||||
- D2
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 22
|
||||
- IO14
|
||||
-
|
||||
-
|
||||
- D4
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 23
|
||||
- IO21
|
||||
-
|
||||
-
|
||||
- VSYNC
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 24
|
||||
- IO47
|
||||
-
|
||||
-
|
||||
- D3
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 25
|
||||
- IO48
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- PA_CTRL
|
||||
* - 26
|
||||
- IO45
|
||||
- I2S0_LRCK
|
||||
- LRCK
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 27
|
||||
- IO0
|
||||
-
|
||||
-
|
||||
-
|
||||
- LCD_SPI_SDA
|
||||
- BOOT_KEY
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 28
|
||||
- IO35
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- NC
|
||||
* - 29
|
||||
- IO36
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- NC
|
||||
* - 30
|
||||
- IO37
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- NC
|
||||
* - 31
|
||||
- IO38
|
||||
-
|
||||
-
|
||||
- HREF
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 32
|
||||
- IO39
|
||||
-
|
||||
-
|
||||
- D9
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 33
|
||||
- IO40
|
||||
-
|
||||
-
|
||||
- XCLK
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 34
|
||||
- IO41
|
||||
-
|
||||
-
|
||||
- D8
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 35
|
||||
- IO42
|
||||
-
|
||||
-
|
||||
- D7
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 36
|
||||
- RXD0
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- ESP0_UART0_RX
|
||||
* - 37
|
||||
- TXD0
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- ESP0_UART0_TX
|
||||
* - 38
|
||||
- IO2
|
||||
-
|
||||
-
|
||||
-
|
||||
- LCD_SPI_DC
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 39
|
||||
- IO1
|
||||
-
|
||||
-
|
||||
-
|
||||
- LCD_SPI_CLK
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
* - 41
|
||||
- EPAD
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
.. [#one] Pin - ESP32-S3-WROOM-1 module pin number, GND and power supply pins are not listed.
|
||||
|
||||
The GPIOs allocated to the IO expander are further expanded to multiple GPIOs.
|
||||
|
||||
.. list-table:: IO Expander GPIO Allocation
|
||||
:header-rows: 1
|
||||
:widths: 10 10 10 10
|
||||
|
||||
* - IO Expander Pin
|
||||
- Pin Name
|
||||
- LCD
|
||||
- Other
|
||||
* - 4
|
||||
- P0
|
||||
-
|
||||
- PA_CTRL
|
||||
* - 5
|
||||
- P1
|
||||
- LCD_CTRL
|
||||
-
|
||||
* - 6
|
||||
- P2
|
||||
- LCD_RST
|
||||
-
|
||||
* - 7
|
||||
- P3
|
||||
- LCD_CS
|
||||
-
|
||||
* - 9
|
||||
- P4
|
||||
- TP_INT
|
||||
-
|
||||
* - 10
|
||||
- P5
|
||||
-
|
||||
- PERI_PWR_ON
|
||||
* - 11
|
||||
- P6
|
||||
-
|
||||
- LED1
|
||||
* - 12
|
||||
- P7
|
||||
-
|
||||
- LED2
|
||||
|
||||
Connector
|
||||
---------
|
||||
|
||||
Camera Connector
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
=== ============= ============
|
||||
No. Camera Signal ESP32-S3 Pin
|
||||
=== ============= ============
|
||||
1 SIOD GPIO17
|
||||
2 SIOC GPIO18
|
||||
3 D5 GPIO3
|
||||
4 PCLK GPIO11
|
||||
5 D6 GPIO12
|
||||
6 D2 GPIO13
|
||||
7 D4 GPIO14
|
||||
8 VSYNC GPIO21
|
||||
9 D3 GPIO47
|
||||
10 HREF GPIO38
|
||||
11 D9 GPIO39
|
||||
12 XCLK GPIO40
|
||||
13 D8 GPIO41
|
||||
14 D7 GPIO42
|
||||
=== ============= ============
|
||||
|
||||
LCD Connector
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
=== =========== ============
|
||||
No. LCD Signal ESP32-S3 Pin
|
||||
=== =========== ============
|
||||
1 TP_I2C_SDA GPIO17
|
||||
2 TP_I2C_CLK GPIO18
|
||||
3 LCD_SPI_SDA GPIO0
|
||||
4 LCD_SPI_DC GPIO2
|
||||
5 LCD_SPI_CLK GPIO1
|
||||
=== =========== ============
|
||||
|
||||
=== ============ ===========
|
||||
No. LCD Signal IO Expander
|
||||
=== ============ ===========
|
||||
1 ESP_LCD_CTRL P1
|
||||
2 ESP_LCD_RST P2
|
||||
3 ESP_LCD_CS P3
|
||||
4 ESP_TP_INT P4
|
||||
=== ============ ===========
|
||||
|
||||
AEC Path
|
||||
--------
|
||||
|
||||
AEC path provides reference signals for AEC algorithm.
|
||||
|
||||
ESP32-S3-Korvo-2 provides two compatible echo reference signal source designs. One is Codec (ES8311) DAC output (DAC_AOUTLN/DAC_AOUTLP), the other is PA (NS4150) output (PA_OUTL+/PA_OUTL-). The former is the default and recommended selection. Resistors R132 and R140 marked NC (no component) in the figure below should not be installed.
|
||||
|
||||
The echo reference signal is collected by ADC_MIC3P/ADC_MIC3N of ADC (ES7210) and then sent back to ESP32-S3 for AEC algorithm.
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-aec-codec-o.png
|
||||
:align: center
|
||||
:scale: 60%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - AEC Codec DAC Output (click to enlarge)
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - AEC Codec DAC Output (click to enlarge)
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-aec-pa-o.png
|
||||
:align: center
|
||||
:scale: 30%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - AEC PA Output (click to enlarge)
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - AEC PA Output (click to enlarge)
|
||||
|
||||
.. figure:: esp32-s3-korvo-2-v3.0-aec-signal-collection.png
|
||||
:align: center
|
||||
:scale: 60%
|
||||
:alt: ESP32-S3-Korvo-2 V3.0 - AEC Reference Signal Collection (click to enlarge)
|
||||
|
||||
ESP32-S3-Korvo-2 V3.0 - AEC Reference Signal Collection (click to enlarge)
|
||||
|
||||
Hardware Setup Options
|
||||
----------------------
|
||||
|
||||
Using Automatic Upload
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Entering of the ESP board into upload mode may be done in two ways:
|
||||
|
||||
- Manually by pressing both Boot and RST keys and then releasing first RST and then Boot key.
|
||||
- Automatically by software performing the upload. The software is using DTR and RTS signals of the serial interface to control states of EN and IO0 of the ESP board. For details see `ESP32-S3-Korvo-2 V3.0 Schematic`_ (PDF).
|
||||
|
||||
|
||||
Allocation of ESP Pins to Test Points
|
||||
-------------------------------------
|
||||
|
||||
This section describes the allocation of test points available on the ESP32-S3-Korvo-2 V3.0 board.
|
||||
|
||||
The test points are bare through hole solder pads and have a standard 2.54 mm/0.1" pitch. You may need to populate them with pin headers or sockets for easy connection of external hardware.
|
||||
|
||||
Codec Test Point/J15
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
=== ========== ============
|
||||
No. Codec Pin ESP32-S3 Pin
|
||||
=== ========== ============
|
||||
1 MCLK GPIO16
|
||||
2 SCLK GPIO9
|
||||
3 LRCK GPIO45
|
||||
4 DSDIN GPIO8
|
||||
5 ASDOUT –
|
||||
6 GND –
|
||||
=== ========== ============
|
||||
|
||||
ADC Test Point/J16
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
=== ========== ============
|
||||
No. ADC Pin ESP32-S3 Pin
|
||||
=== ========== ============
|
||||
1 MCLK GPIO16
|
||||
2 SCLK GPIO9
|
||||
3 LRCK GPIO45
|
||||
4 SDOUT GPIO10
|
||||
5 INT –
|
||||
6 GND –
|
||||
=== ========== ============
|
||||
|
||||
UART Test Point/J17
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
=== ==========
|
||||
No. UART Pin
|
||||
=== ==========
|
||||
1 3.3V
|
||||
2 TXD
|
||||
3 RXD
|
||||
4 IO0
|
||||
5 EN
|
||||
6 GND
|
||||
=== ==========
|
||||
|
||||
I2C Test Point/J18
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
=== ========== ============
|
||||
No. I2C Pin ESP32-S3 Pin
|
||||
=== ========== ============
|
||||
1 3.3V –
|
||||
2 CLK GPIO18
|
||||
3 SDA GPIO17
|
||||
4 GND –
|
||||
=== ========== ============
|
||||
|
||||
Hardware Revision Details
|
||||
=========================
|
||||
|
||||
This is the first revision of this board released.
|
||||
|
||||
Related Documents
|
||||
=================
|
||||
|
||||
- `ESP32-S3 Series Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf>`_ (PDF)
|
||||
- `ESP32-S3-WROOM-1/1U Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf>`_ (PDF)
|
||||
- `ESP32-S3-Korvo-2 V3.0 Schematic`_ (PDF)
|
||||
- `ESP32-S3-Korvo-2 V3.0 PapplicationsCB Layout <https://dl.espressif.com/dl/schematics/PCB_ESP32-S3-KORVO-2_V3.0_20210918.pdf>`_ (PDF)
|
||||
|
||||
For further design documentation for the board, please contact us at `sales@espressif.com <sales@espressif.com>`_.
|
||||
|
||||
.. _ESP32-S3-Korvo-2 V3.0 Schematic: https://dl.espressif.com/dl/schematics/SCH_ESP32-S3-KORVO-2_V3_0_20210918.pdf
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
All of the configurations presented below can be tested by running the following commands::
|
||||
|
||||
$ ./tools/configure.sh esp32s3-korvo-2:<config_name>
|
||||
$ make flash ESPTOOL_PORT=/dev/ttyUSB0 -j$(nproc)
|
||||
|
||||
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, wifi...
|
||||
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
|
||||
|
||||
audio
|
||||
-----
|
||||
|
||||
This configuration uses the I2S peripheral and the ES8311 audio codec to play an audio file.
|
||||
|
||||
**Simple HTTP server**
|
||||
|
||||
Prepare a PCM-encoded (`.wav`) audio file with 16 or 24 bits/sample (sampled at
|
||||
16~48kHz). This file must be placed into a folder in a computer that could
|
||||
be accessed on the same Wi-Fi network the ESP32 will be connecting to.
|
||||
|
||||
Python provides a simple HTTP server. ``cd`` to the audio file folder on the
|
||||
PC and run::
|
||||
|
||||
$ python3 -m http.server
|
||||
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
|
||||
|
||||
Look for your PC IP address and test playing the prepared audio on your
|
||||
browser:
|
||||
|
||||
.. figure:: ../esp32s3-devkit/esp32-audio-config-file.png
|
||||
:align: center
|
||||
|
||||
After successfully built and flashed, connect the board to the Wi-Fi network::
|
||||
|
||||
nsh> wapi psk wlan0 mypasswd 3
|
||||
nsh> wapi essid wlan0 myssid 1
|
||||
nsh> renew wlan0
|
||||
|
||||
Once connected, open NuttX's player and play the file according to the filename
|
||||
and the IP address of the HTTP server::
|
||||
|
||||
nsh> nxplayer
|
||||
nxplayer> play http://192.168.1.239:8000/tones.wav
|
||||
|
||||
nsh
|
||||
---
|
||||
|
||||
Basic NuttShell configuration (console enabled in UART0, exposed via
|
||||
USB connection by means of CP2102 converter, at 115200 bps).
|
||||
|
||||
rtptools
|
||||
--------
|
||||
|
||||
**RTP Tools** is a set of small applications that can be used for processing RTP data.
|
||||
|
||||
- ``rtpplay``: play-back RTP sessions recorded by ``rtpdump``
|
||||
- ``rtpsend``: generate RTP packets from the textual description, generated by hand or ``rtpdump``
|
||||
- ``rtpdump``: parse and print RTP packets, generating output files suitable for ``rtpplay`` and ``rtpsend``
|
||||
- ``rtptrans``: RTP translator between unicast and multicast networks
|
||||
|
||||
This set of tools enables receiving RTP packets and writing the content to a FIFO. ``nxplayer`` then reads
|
||||
from the FIFO, enabling using NuttX as a RTP receiver for audio applications.
|
||||
|
||||
This is particularly useful to stream uncompressed audio through Wi-Fi to remote speakers.
|
||||
|
||||
**Connect to your Network**
|
||||
|
||||
Connect the ESP32-S3-Korvo-2 board to your network to be able to receive RTP packets::
|
||||
|
||||
nsh> wapi psk wlan0 mypasswd 3
|
||||
nsh> wapi essid wlan0 myssid 1
|
||||
nsh> renew wlan0
|
||||
nsh> ifconfig
|
||||
wlan0 Link encap:Ethernet HWaddr aa:bb:cc:dd:ff:ee at RUNNING mtu 1504
|
||||
inet addr:192.168.1.38 DRaddr:192.168.1.1 Mask:255.255.255.0
|
||||
|
||||
IPv4 TCP UDP ICMP
|
||||
Received 00d5 0000 00d4 0000
|
||||
Dropped 0001 0000 0000 0000
|
||||
IPv4 VHL: 0000 Frg: 0000
|
||||
Checksum 0000 0000 0000 ----
|
||||
TCP ACK: 0000 SYN: 0000
|
||||
RST: 0000 0000
|
||||
Type 0000 ---- ---- 0000
|
||||
Sent 0002 0000 0002 0000
|
||||
Rexmit ---- 0000 ---- ----
|
||||
|
||||
Please, check your device's IP (``192.168.1.38`` in this example):
|
||||
RTP packets will be sent to it.
|
||||
|
||||
**Sending Audio through pulseaudio**
|
||||
|
||||
``pulseaudio`` is able to send RTP packets through the network::
|
||||
|
||||
pactl load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP'"
|
||||
pactl load-module module-rtp-send source=rtp.monitor format=s16le destination_ip=192.168.1.38 port=46998
|
||||
|
||||
The loaded sink is used to send PC audio through RTP, using the ``192.168.1.38:46998``
|
||||
(boards's IP in this example, please adjust accordingly).
|
||||
|
||||
**Receiving the RTP packets**
|
||||
|
||||
RTP packets will be written to a FIFO: create the FIFO and run ``rtpdump``
|
||||
on background::
|
||||
|
||||
nsh> mkfifo temp
|
||||
nsh> rtpdump -F payload -o temp /46998 &
|
||||
rtpdump [31:100]
|
||||
|
||||
**Playing Audio**
|
||||
|
||||
Finally, run ``nxplayer`` to play from the FIFO::
|
||||
|
||||
nsh> nxplayer
|
||||
NxPlayer version 1.05
|
||||
h for commands, q to exit
|
||||
|
||||
nxplayer> playraw temp 2 16 44100
|
||||
|
||||
This board contains the ES8311 audio codec. Please attach your passive loudspeaker to the Speaker Output Port to listen to the audio
|
||||
content streamed through the Wi-Fi in CD quality!
|
|
@ -314,7 +314,7 @@ config ARCH_BOARD_ESP32_2432S028
|
|||
depends on ARCH_CHIP_ESP32WROVER
|
||||
---help---
|
||||
ESP32-2432S028 is an ESP32 board with LCD Display, LED RGB and SD Cards.
|
||||
|
||||
|
||||
config ARCH_BOARD_LILYGO_TBEAM_LORA_GPS
|
||||
bool "LilyGO TBeam V1.1 LoRa/GPS"
|
||||
depends on ARCH_CHIP_ESP32WROOM32
|
||||
|
@ -477,6 +477,21 @@ config ARCH_BOARD_ESP32S3_BOX
|
|||
these development boards cater to both prototyping new projects and building complex
|
||||
IoT systems, providing a perfect balance of form and function.
|
||||
|
||||
config ARCH_BOARD_ESP32S3_KORVO_2
|
||||
bool "Espressif ESP32-S3-Korvo-2 Board"
|
||||
depends on ARCH_CHIP_ESP32S3WROOM1N16R8 || ARCH_CHIP_ESP32S3WROOM1N8R8
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS if ESP32S3_GPIO_IRQ
|
||||
---help---
|
||||
The ESP32-S3-Korvo-2 is a multimedia development board based on the ESP32-S3 chip.
|
||||
It is equipped with a two-microphone array which is suitable for voice recognition
|
||||
and near/far-field voice wake-up applications. The board integrates multiple
|
||||
peripherals such as LCD, camera, and microSD card. It also supports JPEG video
|
||||
stream processing. With all of its outstanding features, the board is an ideal
|
||||
choice for the development of low-cost and low-power network-connected audio and
|
||||
video products.
|
||||
|
||||
config ARCH_BOARD_ESP32S3_MEADOW
|
||||
bool "WildernessLabs ESP32S3-Meadow Board"
|
||||
depends on ARCH_CHIP_ESP32S3WROOM1N4 || ARCH_CHIP_ESP32S3CUSTOM
|
||||
|
@ -2211,7 +2226,7 @@ config ARCH_BOARD_ZCU111
|
|||
---help---
|
||||
This options selects support for NuttX on XilinX ZCU111 board
|
||||
based on XCZU28DR SoC with ARM Cortex-A53
|
||||
|
||||
|
||||
config ARCH_BOARD_SAMA5D2_XULT
|
||||
bool "Atmel SAMA5D2 Xplained Ultra development board"
|
||||
depends on ARCH_CHIP_ATSAMA5D27
|
||||
|
@ -3229,6 +3244,7 @@ config ARCH_BOARD
|
|||
default "esp32s3-meadow" if ARCH_BOARD_ESP32S3_MEADOW
|
||||
default "esp32s3-lcd-ev" if ARCH_BOARD_ESP32S3_LCD_EV
|
||||
default "esp32s3-box" if ARCH_BOARD_ESP32S3_BOX
|
||||
default "esp32s3-korvo-2" if ARCH_BOARD_ESP32S3_KORVO_2
|
||||
default "esp32c6-devkitc" if ARCH_BOARD_ESP32C6_DEVKITC
|
||||
default "esp32c6-devkitm" if ARCH_BOARD_ESP32C6_DEVKITM
|
||||
default "esp32h2-devkit" if ARCH_BOARD_ESP32H2_DEVKIT
|
||||
|
@ -4375,6 +4391,9 @@ endif
|
|||
if ARCH_BOARD_ESP32S3_BOX
|
||||
source "boards/xtensa/esp32s3/esp32s3-box/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_ESP32S3_KORVO_2
|
||||
source "boards/xtensa/esp32s3/esp32s3-korvo-2/Kconfig"
|
||||
endif
|
||||
#if ARCH_BOARD_ESP32C6_DEVKITC
|
||||
#source "boards/risc-v/esp32c6/esp32c6-devkitc/Kconfig"
|
||||
#endif
|
||||
|
|
|
@ -52,6 +52,10 @@ ifeq ($(CONFIG_AUDIO_CS4344),y)
|
|||
CSRCS += esp32s3_cs4344.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AUDIO_ES8311),y)
|
||||
CSRCS += esp32s3_es8311.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_BMP180),y)
|
||||
CSRCS += esp32s3_board_bmp180.c
|
||||
endif
|
||||
|
|
214
boards/xtensa/esp32s3/common/src/esp32s3_es8311.c
Normal file
|
@ -0,0 +1,214 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/common/src/esp32s3_es8311.c
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/audio/i2s.h>
|
||||
#include <nuttx/audio/pcm.h>
|
||||
#include <nuttx/audio/es8311.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "esp32s3_i2c.h"
|
||||
#include "esp32s3_i2s.h"
|
||||
|
||||
#if defined(CONFIG_ESP32S3_I2S) && defined(CONFIG_AUDIO_ES8311)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct es8311_lower_s g_es8311_lower[2];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_es8311_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function is called by platform-specific, setup logic to configure
|
||||
* and register the ES8311 device. This function will register the driver
|
||||
* as /dev/audio/pcm[x] where x is determined by the I2S port number.
|
||||
*
|
||||
* Input Parameters:
|
||||
* i2c_port - The I2C port used for the device
|
||||
* i2c_addr - The I2C address used by the device
|
||||
* i2c_freq - The I2C frequency used for the device
|
||||
* i2s_port - The I2S port used for the device
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s3_es8311_initialize(int i2c_port, uint8_t i2c_addr, int i2c_freq,
|
||||
int i2s_port)
|
||||
{
|
||||
struct audio_lowerhalf_s *es8311;
|
||||
struct i2s_dev_s *i2s;
|
||||
struct i2c_master_s *i2c;
|
||||
static bool initialized = false;
|
||||
int ret;
|
||||
|
||||
audinfo("i2c_port %d, i2c_addr %d, i2c_freq %d\n",
|
||||
i2c_port, i2c_addr, i2c_freq);
|
||||
|
||||
/* Have we already initialized? Since we never uninitialize we must
|
||||
* prevent multiple initializations. This is necessary, for example,
|
||||
* when the touchscreen example is used as a built-in application in
|
||||
* NSH and can be called numerous time. It will attempt to initialize
|
||||
* each time.
|
||||
*/
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* Get an instance of the I2S interface for the ES8311 data channel */
|
||||
|
||||
i2s = esp32s3_i2sbus_initialize(i2s_port);
|
||||
if (i2s == NULL)
|
||||
{
|
||||
auderr("ERROR: Failed to initialize I2S\n");
|
||||
ret = -ENODEV;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
i2c = esp32s3_i2cbus_initialize(i2c_port);
|
||||
if (i2c == NULL)
|
||||
{
|
||||
auderr("ERROR: Failed to initialize I2C%d\n", i2c_port);
|
||||
ret = -ENODEV;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Check wheter to enable a simple character driver that supports I2S
|
||||
* transfers via a read() and write(). The intent of this driver is to
|
||||
* support I2S testing. It is not an audio driver but does conform to
|
||||
* some of the buffer management heuristics of an audio driver. It is
|
||||
* not suitable for use in any real driver application in its current
|
||||
* form. The i2schar driver will be initialized at /dev/i2schar0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_AUDIO_I2SCHAR
|
||||
ret = i2schar_register(i2s, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
auderr("ERROR: i2schar_register failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we can use this I2S interface to initialize the ES8311 output
|
||||
* which will return an audio interface.
|
||||
*/
|
||||
|
||||
g_es8311_lower[0].address = i2c_addr;
|
||||
g_es8311_lower[0].frequency = i2c_freq;
|
||||
|
||||
es8311 = es8311_initialize(i2c, i2s, &g_es8311_lower[0]);
|
||||
if (es8311 == NULL)
|
||||
{
|
||||
auderr("ERROR: Failed to initialize the ES8311\n");
|
||||
ret = -ENODEV;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSTEM_NXLOOPER
|
||||
/* If nxlooper is selected, the playback buffer is not rendered as
|
||||
* a WAV file. Therefore, PCM decode will fail while processing such
|
||||
* output buffer. In such a case, we bypass the PCM decode.
|
||||
*/
|
||||
|
||||
ret = audio_register("pcm0", es8311);
|
||||
#else
|
||||
/* Now we can embed the ES8311/I2S conglomerate into a PCM decoder
|
||||
* instance so that we will have a PCM front end for the the ES8311
|
||||
* driver.
|
||||
*/
|
||||
|
||||
struct audio_lowerhalf_s *pcm = pcm_decode_initialize(es8311);
|
||||
if (pcm == NULL)
|
||||
{
|
||||
auderr("ERROR: Failed create the PCM decoder\n");
|
||||
ret = -ENODEV;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Finally, we can register the PCM/ES8311/I2S audio device. */
|
||||
|
||||
ret = audio_register("pcm0", pcm);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
{
|
||||
auderr("ERROR: Failed to register /dev/pcm0 device: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Now we can use this I2S interface to initialize the ES8311 input
|
||||
* which will return an audio interface.
|
||||
*/
|
||||
|
||||
g_es8311_lower[1].address = i2c_addr;
|
||||
g_es8311_lower[1].frequency = i2c_freq;
|
||||
|
||||
es8311 = es8311_initialize(i2c, i2s, &g_es8311_lower[1]);
|
||||
if (es8311 == NULL)
|
||||
{
|
||||
auderr("ERROR: Failed to initialize the ES8311\n");
|
||||
ret = -ENODEV;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Finally, we can register the PCM/ES8311/I2S audio device. */
|
||||
|
||||
ret = audio_register("pcm_in0", es8311);
|
||||
if (ret < 0)
|
||||
{
|
||||
auderr("ERROR: Failed to register /dev/pcm_in0 device: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ESP32S3_I2S && CONFIG_AUDIO_ES8311 */
|
60
boards/xtensa/esp32s3/esp32s3-korvo-2/Kconfig
Normal file
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# 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_KORVO_2
|
||||
|
||||
config ESP32S3_STORAGE_MTD_OFFSET
|
||||
hex "Storage MTD base address in SPI Flash"
|
||||
default 0x180000 if !ESP32S3_HAVE_OTA_PARTITION
|
||||
default 0x250000 if ESP32S3_HAVE_OTA_PARTITION
|
||||
depends on ESP32S3_MTD
|
||||
---help---
|
||||
MTD base address in SPI Flash.
|
||||
|
||||
config ESP32S3_STORAGE_MTD_SIZE
|
||||
hex "Storage MTD size in SPI Flash"
|
||||
default 0x100000
|
||||
range 0x0 0x800000 if ESP32S3_FLASH_8M
|
||||
range 0x0 0x1000000 if ESP32S3_FLASH_16M
|
||||
depends on ESP32S3_MTD
|
||||
---help---
|
||||
MTD size in SPI Flash.
|
||||
|
||||
choice ESP32S3_SPIFLASH_FS
|
||||
prompt "Mount SPI Flash MTD on bring-up"
|
||||
default ESP32S3_SPIFLASH_SMARTFS
|
||||
depends on ESP32S3_MTD
|
||||
optional
|
||||
---help---
|
||||
Mount the SPI Flash MTD with the selected File System format on board
|
||||
bring-up.
|
||||
If not selected, the MTD will be registered as a device node on /dev.
|
||||
|
||||
config ESP32S3_SPIFLASH_SMARTFS
|
||||
bool "SmartFS"
|
||||
select FS_SMARTFS
|
||||
select MTD_SMART
|
||||
|
||||
config ESP32S3_SPIFLASH_NXFFS
|
||||
bool "NXFFS"
|
||||
select FS_NXFFS
|
||||
|
||||
config ESP32S3_SPIFLASH_SPIFFS
|
||||
bool "SPIFFS"
|
||||
select FS_SPIFFS
|
||||
|
||||
config ESP32S3_SPIFLASH_LITTLEFS
|
||||
bool "LittleFS"
|
||||
select FS_LITTLEFS
|
||||
|
||||
endchoice # ESP32S3_SPIFLASH_FS
|
||||
|
||||
config ESP32S3_BOARD_I2C
|
||||
bool
|
||||
default y if ESP32S3_I2C0 || ESP32S3_I2C1
|
||||
|
||||
|
||||
endif # ARCH_BOARD_ESP32S3_KORVO_2
|
||||
|
115
boards/xtensa/esp32s3/esp32s3-korvo-2/configs/audio/defconfig
Normal file
|
@ -0,0 +1,115 @@
|
|||
#
|
||||
# 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_ARCH_LEDS is not set
|
||||
# CONFIG_AUDIO_FORMAT_MP3 is not set
|
||||
# CONFIG_AUDIO_FORMAT_SBC is not set
|
||||
# CONFIG_ESP32S3_I2S0_RX is not set
|
||||
# CONFIG_NDEBUG is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32s3-korvo-2"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32S3_KORVO_2=y
|
||||
CONFIG_ARCH_CHIP="esp32s3"
|
||||
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_AUDIO=y
|
||||
CONFIG_AUDIO_ES8311=y
|
||||
CONFIG_AUDIO_EXCLUDE_BALANCE=y
|
||||
CONFIG_AUDIO_EXCLUDE_FFORWARD=y
|
||||
CONFIG_AUDIO_EXCLUDE_TONE=y
|
||||
CONFIG_AUDIO_I2S=y
|
||||
CONFIG_AUDIO_I2SCHAR=y
|
||||
CONFIG_AUDIO_NUM_BUFFERS=8
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_FIFO_SIZE=20480
|
||||
CONFIG_DRIVERS_AUDIO=y
|
||||
CONFIG_DRIVERS_IEEE80211=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_ESP32S3_I2C0=y
|
||||
CONFIG_ESP32S3_I2C0_SCLPIN=18
|
||||
CONFIG_ESP32S3_I2C0_SDAPIN=17
|
||||
CONFIG_ESP32S3_I2S0=y
|
||||
CONFIG_ESP32S3_I2S0_BCLKPIN=9
|
||||
CONFIG_ESP32S3_I2S0_DOUTPIN=8
|
||||
CONFIG_ESP32S3_I2S0_MCLK=y
|
||||
CONFIG_ESP32S3_I2S0_MCLKPIN=16
|
||||
CONFIG_ESP32S3_I2S0_WSPIN=45
|
||||
CONFIG_ESP32S3_I2S=y
|
||||
CONFIG_ESP32S3_SPIFLASH=y
|
||||
CONFIG_ESP32S3_SPIFLASH_SPIFFS=y
|
||||
CONFIG_ESP32S3_SPIRAM=y
|
||||
CONFIG_ESP32S3_SPIRAM_MODE_OCT=y
|
||||
CONFIG_ESP32S3_UART0=y
|
||||
CONFIG_ESP32S3_WIFI=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_I2S_DMADESC_NUM=4
|
||||
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INIT_STACKSIZE=4096
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_IOB_NBUFFERS=124
|
||||
CONFIG_IOB_THROTTLE=24
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NAME_MAX=48
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||
CONFIG_NETUTILS_CJSON=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1518
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_DELAYED_ACK=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_WRITE_BUFFERS=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_PROMPT_MAX=32
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
|
||||
CONFIG_NXPLAYER_MAINTHREAD_STACKSIZE=4096
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_SMP_NCPUS=2
|
||||
CONFIG_SPIFFS_NAME_MAX=128
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSLOG_BUFFER=y
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NXPLAYER=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_TLS_TASK_NELEM=4
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_WAPI=y
|
||||
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
||||
CONFIG_WIRELESS_WAPI_INITCONF=y
|
||||
CONFIG_WIRELESS_WAPI_STACKSIZE=4096
|
49
boards/xtensa/esp32s3/esp32s3-korvo-2/configs/nsh/defconfig
Normal file
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# 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_ARCH_LEDS is not set
|
||||
# CONFIG_NDEBUG is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32s3-korvo-2"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32S3_KORVO_2=y
|
||||
CONFIG_ARCH_CHIP="esp32s3"
|
||||
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_ESP32S3_SPIRAM=y
|
||||
CONFIG_ESP32S3_SPIRAM_MODE_OCT=y
|
||||
CONFIG_ESP32S3_UART0=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
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
|
117
boards/xtensa/esp32s3/esp32s3-korvo-2/configs/rtptools/defconfig
Normal file
|
@ -0,0 +1,117 @@
|
|||
#
|
||||
# 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_ARCH_LEDS is not set
|
||||
# CONFIG_AUDIO_FORMAT_MP3 is not set
|
||||
# CONFIG_AUDIO_FORMAT_SBC is not set
|
||||
# CONFIG_ESP32S3_I2S0_RX is not set
|
||||
# CONFIG_NDEBUG is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32s3-korvo-2"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32S3_KORVO_2=y
|
||||
CONFIG_ARCH_CHIP="esp32s3"
|
||||
CONFIG_ARCH_CHIP_ESP32S3=y
|
||||
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_AUDIO=y
|
||||
CONFIG_AUDIO_ES8311=y
|
||||
CONFIG_AUDIO_EXCLUDE_BALANCE=y
|
||||
CONFIG_AUDIO_EXCLUDE_FFORWARD=y
|
||||
CONFIG_AUDIO_EXCLUDE_TONE=y
|
||||
CONFIG_AUDIO_FORMAT_RAW=y
|
||||
CONFIG_AUDIO_I2S=y
|
||||
CONFIG_AUDIO_I2SCHAR=y
|
||||
CONFIG_AUDIO_NUM_BUFFERS=8
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_FIFO_SIZE=20480
|
||||
CONFIG_DRIVERS_AUDIO=y
|
||||
CONFIG_DRIVERS_IEEE80211=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_ESP32S3_I2C0=y
|
||||
CONFIG_ESP32S3_I2C0_SCLPIN=18
|
||||
CONFIG_ESP32S3_I2C0_SDAPIN=17
|
||||
CONFIG_ESP32S3_I2S0=y
|
||||
CONFIG_ESP32S3_I2S0_BCLKPIN=9
|
||||
CONFIG_ESP32S3_I2S0_DOUTPIN=8
|
||||
CONFIG_ESP32S3_I2S0_MCLK=y
|
||||
CONFIG_ESP32S3_I2S0_MCLKPIN=16
|
||||
CONFIG_ESP32S3_I2S0_WSPIN=45
|
||||
CONFIG_ESP32S3_I2S=y
|
||||
CONFIG_ESP32S3_SPIFLASH=y
|
||||
CONFIG_ESP32S3_SPIFLASH_SPIFFS=y
|
||||
CONFIG_ESP32S3_SPIRAM=y
|
||||
CONFIG_ESP32S3_SPIRAM_MODE_OCT=y
|
||||
CONFIG_ESP32S3_UART0=y
|
||||
CONFIG_ESP32S3_WIFI=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_I2S_DMADESC_NUM=4
|
||||
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INIT_STACKSIZE=4096
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_IOB_NBUFFERS=124
|
||||
CONFIG_IOB_THROTTLE=24
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NAME_MAX=48
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||
CONFIG_NETUTILS_CJSON=y
|
||||
CONFIG_NETUTILS_RTPTOOLS=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1518
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_DELAYED_ACK=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_WRITE_BUFFERS=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_PROMPT_MAX=32
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
|
||||
CONFIG_NXPLAYER_MAINTHREAD_STACKSIZE=4096
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_SMP_NCPUS=2
|
||||
CONFIG_SPIFFS_NAME_MAX=128
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSLOG_BUFFER=y
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NXPLAYER=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_TLS_TASK_NELEM=4
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_WAPI=y
|
||||
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
||||
CONFIG_WIRELESS_WAPI_INITCONF=y
|
||||
CONFIG_WIRELESS_WAPI_STACKSIZE=4096
|
47
boards/xtensa/esp32s3/esp32s3-korvo-2/include/board.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/include/board.h
|
||||
*
|
||||
* 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_KORVO_2_INCLUDE_BOARD_H
|
||||
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* The ESP32-S3-Korvo-2 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
|
||||
|
||||
/* Peripherals definitions **************************************************/
|
||||
|
||||
#ifdef CONFIG_AUDIO_ES8311
|
||||
# define ES8311_I2C_FREQ 100000
|
||||
# define ES8311_I2C_ADDR 0x18
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_INCLUDE_BOARD_H */
|
116
boards/xtensa/esp32s3/esp32s3-korvo-2/include/board_memorymap.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/include/board_memorymap.h
|
||||
*
|
||||
* 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_KORVO_2_INCLUDE_BOARD_MEMORYMAP_H
|
||||
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_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_KORVO_2_INCLUDE_BOARD_MEMORYMAP_H */
|
74
boards/xtensa/esp32s3/esp32s3-korvo-2/scripts/Make.defs
Normal file
|
@ -0,0 +1,74 @@
|
|||
############################################################################
|
||||
# boards/xtensa/esp32s3/esp32s3-korvo-2/scripts/Make.defs
|
||||
#
|
||||
# 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.ld
|
||||
ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32s3_rom_api.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)
|
||||
ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)
|
||||
ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld)
|
||||
else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
|
||||
ARCHSCRIPT += $(call FINDSCRIPT,simple_boot_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) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
# Loadable module definitions
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mtext-section-literals
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
LDMODULEFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld)
|
||||
|
||||
# ELF module definitions
|
||||
|
||||
CELFFLAGS = $(CFLAGS) -mtext-section-literals
|
||||
CXXELFFLAGS = $(CXXFLAGS) -mtext-section-literals
|
||||
|
||||
LDELFFLAGS = -r -e main
|
||||
LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld)
|
55
boards/xtensa/esp32s3/esp32s3-korvo-2/src/Make.defs
Normal file
|
@ -0,0 +1,55 @@
|
|||
############################################################################
|
||||
# boards/xtensa/esp32s3/esp32s3-korvo-2/src/Make.defs
|
||||
#
|
||||
# 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)/Make.defs
|
||||
|
||||
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_ESP32S3_SPI),y)
|
||||
CSRCS += esp32s3_board_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_TWAI),y)
|
||||
CSRCS += esp32s3_twai.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEV_GPIO),y)
|
||||
CSRCS += esp32s3_gpio.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += esp32s3_ledc.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
|
118
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3-korvo-2.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3-korvo-2.h
|
||||
*
|
||||
* 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_KORVO_2_SRC_ESP32S3_KORVO_2_H
|
||||
#define __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_SRC_ESP32S3_KORVO_2_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* ESP32-S3-Korvo-2 GPIOs ***************************************************/
|
||||
|
||||
/* BOOT Button */
|
||||
|
||||
#define BUTTON_BOOT 0
|
||||
|
||||
/* I2C Port */
|
||||
|
||||
#define I2C_PORT 0
|
||||
|
||||
#ifdef CONFIG_AUDIO_ES8311
|
||||
# define SPEAKER_ENABLE_GPIO 48
|
||||
#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: board_spiflash_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize the SPIFLASH and register the MTD device.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPIFLASH
|
||||
int board_spiflash_init(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_es8311_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function is called by platform-specific, setup logic to configure
|
||||
* and register the ES8311 device. This function will register the driver
|
||||
* as /dev/audio/pcm[x] where x is determined by the I2S port number.
|
||||
*
|
||||
* Input Parameters:
|
||||
* i2c_port - The I2C port used for the device
|
||||
* i2c_addr - The I2C address used by the device
|
||||
* i2c_freq - The I2C frequency used for the device
|
||||
* i2s_port - The I2S port used for the device
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_AUDIO_ES8311
|
||||
int esp32s3_es8311_initialize(int i2c_port, uint8_t i2c_addr, int i2c_freq,
|
||||
int i2s_port);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_KORVO_2_SRC_ESP32S3_KORVO_2_H */
|
80
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_appinit.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_appinit.c
|
||||
*
|
||||
* 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-korvo-2.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 */
|
126
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_board_spi.c
Normal file
|
@ -0,0 +1,126 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_board_spi.c
|
||||
*
|
||||
* 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 "esp32s3_gpio.h"
|
||||
#include "esp32s3-korvo-2.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_spi2_status
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPI2
|
||||
|
||||
uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid)
|
||||
{
|
||||
uint8_t status = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
if (devid == SPIDEV_DISPLAY(0))
|
||||
{
|
||||
/* This is the Data/Command control pad which determines whether the
|
||||
* data bits are data or a command.
|
||||
*/
|
||||
|
||||
esp32s3_gpiowrite(GPIO_LCD_DC, !cmd);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
|
||||
"data");
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_spi3_status
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPI3
|
||||
|
||||
uint8_t esp32s3_spi3_status(struct spi_dev_s *dev, uint32_t devid)
|
||||
{
|
||||
uint8_t status = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
if (devid == SPIDEV_DISPLAY(0))
|
||||
{
|
||||
/* This is the Data/Command control pad which determines whether the
|
||||
* data bits are data or a command.
|
||||
*/
|
||||
|
||||
esp32s3_gpiowrite(CONFIG_ESP32S3_SPI3_MISOPIN, !cmd);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
|
||||
"data");
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
83
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_boot.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_boot.c
|
||||
*
|
||||
* 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-korvo-2.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
|
452
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c
Normal file
|
@ -0,0 +1,452 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <debug.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "esp32s3_gpio.h"
|
||||
|
||||
#ifdef CONFIG_ESP32S3_TIMER
|
||||
# include "esp32s3_board_tim.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_WIFI
|
||||
# include "esp32s3_board_wlan.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BLE
|
||||
# include "esp32s3_ble.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_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_ESP32S3_I2S
|
||||
# include "esp32s3_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_ESP32S3_EFUSE
|
||||
# include "esp32s3_efuse.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_LEDC
|
||||
# include "esp32s3_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"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_AES_ACCELERATOR
|
||||
# include "esp32s3_aes.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_ADC
|
||||
#include "esp32s3_board_adc.h"
|
||||
#endif
|
||||
|
||||
#include "esp32s3-korvo-2.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;
|
||||
#if (defined(CONFIG_ESP32S3_I2S0) && !defined(CONFIG_AUDIO_CS4344) && \
|
||||
!defined(CONFIG_AUDIO_ES8311)) || defined(CONFIG_ESP32S3_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)
|
||||
#ifdef CONFIG_ESP32S3_SPI2
|
||||
ret = board_spidev_initialize(ESP32S3_SPI2);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to init spidev 2: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPI3
|
||||
ret = board_spidev_initialize(ESP32S3_SPI3);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to init spidev 3: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ESP32S3_EFUSE)
|
||||
ret = esp32s3_efuse_initialize("/dev/efuse");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %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_ESP32S3_LEDC
|
||||
ret = esp32s3_pwm_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: esp32s3_pwm_setup() failed: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_ESP32S3_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)
|
||||
{
|
||||
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_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_ESP32S3_I2S
|
||||
# ifdef CONFIG_ESP32S3_I2S0
|
||||
# ifdef CONFIG_AUDIO_ES8311
|
||||
|
||||
/* Configure ES8311 audio on I2C0 and I2S0 */
|
||||
|
||||
esp32s3_configgpio(SPEAKER_ENABLE_GPIO, OUTPUT);
|
||||
esp32s3_gpiowrite(SPEAKER_ENABLE_GPIO, true);
|
||||
|
||||
ret = esp32s3_es8311_initialize(ESP32S3_I2C0, ES8311_I2C_ADDR,
|
||||
ES8311_I2C_FREQ, ESP32S3_I2S0);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize ES8311 audio: %d\n", ret);
|
||||
}
|
||||
|
||||
# else
|
||||
# ifdef CONFIG_ESP32S3_I2S0_TX
|
||||
i2s_enable_tx = true;
|
||||
# else
|
||||
i2s_enable_tx = false;
|
||||
# endif /* CONFIG_ESP32S3_I2S0_TX */
|
||||
|
||||
# ifdef CONFIG_ESP32S3_I2S0_RX
|
||||
i2s_enable_rx = true;
|
||||
# else
|
||||
i2s_enable_rx = false;
|
||||
# endif /* CONFIG_ESP32S3_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_ES8311 */
|
||||
# endif /* CONFIG_ESP32S3_I2S0 */
|
||||
|
||||
# ifdef CONFIG_ESP32S3_I2S1
|
||||
# ifdef CONFIG_ESP32S3_I2S1_TX
|
||||
i2s_enable_tx = true;
|
||||
# else
|
||||
i2s_enable_tx = false;
|
||||
# endif /* CONFIG_ESP32S3_I2S1_TX */
|
||||
|
||||
# ifdef CONFIG_ESP32S3_I2S1_RX
|
||||
i2s_enable_rx = true;
|
||||
# else
|
||||
i2s_enable_rx = false;
|
||||
# endif /* CONFIG_ESP32S3_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",
|
||||
CONFIG_ESP32S3_I2S1, ret);
|
||||
}
|
||||
|
||||
# endif /* CONFIG_ESP32S3_I2S1 */
|
||||
#endif /* CONFIG_ESP32S3_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_ESP32S3_WIRELESS
|
||||
|
||||
#ifdef CONFIG_ESP32S3_WIFI_BT_COEXIST
|
||||
ret = esp32s3_wifi_bt_coexist_init();
|
||||
if (ret)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize Wi-Fi and BT coexist\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_BLE
|
||||
ret = esp32s3_ble_initialize();
|
||||
if (ret)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize BLE\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32S3_WIFI
|
||||
ret = board_wlan_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize wireless subsystem=%d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_GPIO
|
||||
ret = esp32s3_gpio_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %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_ESP32S3_ADC
|
||||
/* Configure ADC */
|
||||
|
||||
ret = board_adc_init();
|
||||
if (ret)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: board_adc_init() failed: %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
|
||||
|
||||
/* If we got here then perhaps not all initialization was successful, but
|
||||
* at least enough succeeded to bring-up NSH with perhaps reduced
|
||||
* capabilities.
|
||||
*/
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
164
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_buttons.c
Normal file
|
@ -0,0 +1,164 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_buttons.c
|
||||
*
|
||||
* 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-korvo-2.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
|
85
boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_reset.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
/****************************************************************************
|
||||
* boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_reset.c
|
||||
*
|
||||
* 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 */
|