Advertisement

Quick Links

Read the Docs Template
Documentation
Release
Read the Docs
Jul 01, 2018

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-LyraT and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Espressif ESP32-LyraT

  • Page 1 Read the Docs Template Documentation Release Read the Docs Jul 01, 2018...
  • Page 3: Table Of Contents

    1 Get Started ESP32-LyraT V4.3 Getting Started Guide ....... .
  • Page 5 Read the Docs Template Documentation, Release This is the documentation for Espressif Audio Development Framework. Get Started API Reference Design Guide Contents...
  • Page 6 Read the Docs Template Documentation, Release Contents...
  • Page 7: Get Started

    This document is intended to help users set up the software environment for the development of audio applications using hardware based on the ESP32 by Espressif. Through a simple example, we would like to illustrate how to use ESP-ADF (Espressif Audio Development Framework).
  • Page 8: Esp32-Lyrat V4.3 Getting Started Guide

    The block diagram below presents main components of the ESP32-LyraT and interconnections between components. Components The following list and figure describe key components, interfaces and controls of the ESP32-LyraT used in this guide. This covers just what is needed now. For detailed technical documentation of this board, please refer to ESP32-LyraT V4.3 Hardware Reference...
  • Page 9 Power Switch Power on/off knob: toggling it to the left powers the board on; toggling it to the right powers the board off. Power On LED Red LED indicating that Power On Switch is turned on. 1.1. ESP32-LyraT V4.3 Getting Started Guide...
  • Page 10 Read the Docs Template Documentation, Release Fig. 1.3: ESP32-LyraT V4.3 Board Layout Overview Chapter 1. Get Started...
  • Page 11 Read the Docs Template Documentation, Release 1.1.2 Start Application Development Before powering up the ESP32-LyraT, please make sure that the board has been received in good condition with no obvious signs of damage. Initial Setup Prepare the board for loading of the first sample application: 1.
  • Page 12: About Esp-Adf

    Read the Docs Template Documentation, Release 1.1.4 Other Versions of LyraT • ESP32-LyraT V4.2 Getting Started Guide • ESP32-LyraT V4 Getting Started Guide 1.1.5 Related Documents • ESP32-LyraT V4.3 Hardware Reference • ESP32 LyraT V4.3 schematic (PDF) • ESP32 Datasheet (PDF) •...
  • Page 13: Setup Path To Esp-Adf

    Read the Docs Template Documentation, Release ~/esp git clone --recursive https://github.com/espressif/esp-adf.git ESP-ADF will be downloaded into ~/esp/esp-adf. Note: Do not miss the --recursive option. If you have already cloned ESP-ADF without this option, run another command to get all the submodules:...
  • Page 14: Build, Flash And Monitor

    Read the Docs Template Documentation, Release ~/esp/play_mp3 make menuconfig Save the configuration. 1.8 Build, Flash and Monitor Now you can build, upload and check the application. Run: make flash monitor -j5 This will build the application including ESP-IDF / ESP-ADF components, upload binaries to your ESP32 board and start the monitor.
  • Page 15: Related Documents

    ESP32-LyraT board. The ESP32-LyraT development board is a hardware platform designed for the dual-core ESP32 audio applications, e.g., Wi-Fi or BT audio speakers, speech-based remote controllers, smart-home appliances with audio functional- ity(ies), etc.
  • Page 16 Fig. 1.4: ESP32-LyraT Block Diagram Functional Description The following list and figure describe key components, interfaces and controls of the ESP32-LyraT board. ESP32-WROVER Module The ESP32-WROVER module contains ESP32 chip to provide Wi-Fi / BT connectivity and data processing power as well as integrates 32 Mbit SPI flash and 32 Mbit PSRAM for flexible data storage.
  • Page 17 Headphone Output Output socket to connect headphones with a 3.5 mm stereo jack. Fig. 1.5: ESP32-LyraT V4.2 Board Layout Right Microphone Onboard microphone connected to IN1 of the Audio Codec Chip. Left Speaker Output Output socket to connect 4 ohm speaker. The pins have a standard 2.54 mm / 0.1” pitch.
  • Page 18 Note: The Power On Switch does not affect / disconnect the Li-ion battery charging. Hardware Setup Options There are a couple of options to change the hardware configuration of the ESP32-LyraT board. The options are selectable with the Function DIP Switch.
  • Page 19 Read the Docs Template Documentation, Release Enable MicroSD Card in 1-wire Mode DIP SW Position 1. AUX Input detection may be enabled by toggling the DIP SW 7 ON In this mode: • JTAG functionality is not available • Vol- touch button is available for use with the API Enable MicroSD Card in 4-wire Mode DIP SW Position...
  • Page 20 Read the Docs Template Documentation, Release In this mode: • MicroSD Card functionality is not available, remove the card from the slot • Vol- touch button is not available for use with the API • AUX Input detection from the API is not available Allocation of ESP32 Pins Several pins / terminals of ESP32 modules are allocated to the on board hardware.
  • Page 21 Read the Docs Template Documentation, Release UART Header / JP2 Header Pin 3.3V EN and IO0 Headers / JP23 and J24 ESP32 Pin Header Pin EN_Auto ESP32 Pin Header Pin IO0_Auto GPIO0 I2S Header / JP4 I2C Header Pin ESP32 Pin MCLK GPI0 SCLK...
  • Page 22 1. The AUX Input signal pin should not be be plugged in when the system powers up. Otherwise the ESP32 may not be able to boot correctly. Start Application Development Before powering up the ESP32-LyraT, please make sure that the board has been received in good condition with no obvious signs of damage. Initial Setup Prepare the board for loading of the first sample application:...
  • Page 23 ESP32-LyraT board. The ESP32-LyraT development board is a hardware platform specifically designed for the dual-core ESP32 audio applications, e.g., Wi-Fi or BT audio speakers, speech-based remote controllers, smart-home appliances with audio functionality(ies), etc.
  • Page 24 Fig. 1.6: ESP32-LyraT block diagram Functional Description The following list and figure below describe key components, interfaces and controls of the ESP32-LyraT board. ESP32-WROVER Module The ESP32-WROVER module contains ESP32 chip to provide Wi-Fi / BT connectivity and data processing power as well as integrates 32 Mbit SPI flash and 32 Mbit PSRAM for flexible data storage.
  • Page 25 Read the Docs Template Documentation, Release MicroSD Card The development board supports a MicroSD card in SPI/1-bit/4-bit modes, and can store or play audio files in the MicroSD card. See MicroSD Card / J5 for pinout details. Note that JTAG cannot be used and should be disconnected by setting Function DIP Switch when MicroSD Card is in operation, because some of the signals are shared by both devices.
  • Page 26 Note: The Power On Switch does not affect / disconnect the Li-ion battery charging. Hardware Setup Options There are couple of options to change the hardware configuration of the ESP32-LyraT board. The options are selectable with the Function DIP Switch.
  • Page 27 Read the Docs Template Documentation, Release • JTAG functionality is not available • Vol- touch button is available for use with the API Enable MicroSD Card in 4-wire Mode DIP SW Position In this mode: • JTAG functionality is not available •...
  • Page 28 Read the Docs Template Documentation, Release Red / Green LEDs ESP32 Pin LED Color GPIO19 Red LED GPIO22 Green LED Touch Pads ESP32 Pin Touch Pad Function GPIO33 Play GPIO32 GPIO13 Vol- GPIO27 Vol+ 1. Vol- function is not available if JTAG is used. It is also not available for the MicroSD Card configured to operate in 4-wire mode.
  • Page 29 1. The AUX Input signal pin should not be plugged in when the system powers up. Otherwise the ESP32 may not be able to boot correctly. Start Application Development Before powering up the ESP32-LyraT, please make sure that the board has been received in good condition with no obvious signs of damage. Initial Setup Prepare the board for loading of the first sample application:...
  • Page 30 Develop Applications If the ESP32-LyraT is initially set up and checked, you can proceed with preparation of the development tools. Go to section Started, which will walk you through the following steps: •...
  • Page 31: Api Reference

    CHAPTER API Reference This API provides a way to develop audio applications using Elements like Codecs, Streams or Filters. Fig. 2.1: Elements of the Audio Development Framework The application is developed by combining the Elements into a Pipeline. A diagram below presents organization of two elements, MP3 decoder and I2S stream, in the Audio Pipeline, that has been used in get-started/play_mp3 example.
  • Page 32: Audio Framework

    Read the Docs Template Documentation, Release The audio data is typically acquired using an input Stream, processed with Codecs and Filters, and finally output with another Stream. There is an Event Interface to facilitate communication of the application events. Interfacing with specific hardware is done using Peripherals.
  • Page 33 Read the Docs Template Documentation, Release Parameters • el: The audio element handle esp_err_t el, void *data) audio_element_setdata(audio_element_handle_t Set context data to element handle object, it can be retrieve by getdata. Return • ESP_OK • ESP_FAIL Parameters • el: The audio element handle •...
  • Page 34 Read the Docs Template Documentation, Release • el: The audio element handle • info: The information pointer esp_err_t audio_element_info_t *info) audio_element_getinfo(audio_element_handle_t Get audio element infomation. Return • ESP_OK • ESP_FAIL Parameters • el: The audio element handle • info: The information pointer esp_err_t el, const char *uri) audio_element_set_uri(audio_element_handle_t...
  • Page 35 Read the Docs Template Documentation, Release • ESP_OK • ESP_FAIL Parameters • el: The audio element handle esp_err_t audio_element_stop(audio_element_handle_t Request stop of the Audio Element. After receiving the stop request, the element will ignore the actions being performed (read/write, wait for the ringbuffer . . . ) and close the task, reset the state variables. Note: this API only sends requests, Element does not actually stop when this function returns.
  • Page 36 Read the Docs Template Documentation, Release Parameters • el: The audio element handle • wait_for_rb_threshold: The wait for rb threshold (0 .. 1) • timeout: The timeout esp_err_t audio_element_msg_set_listener(audio_element_handle_t dio_event_iface_handle_t listener) This function will add a listener to listen to all events from audio element el Any event from el- >external_event will be send to the listener.
  • Page 37 Read the Docs Template Documentation, Release esp_err_t ringbuf_handle_t audio_element_set_output_ringbuf(audio_element_handle_t Set Element output ringbuffer. Return • ESP_OK • ESP_FAIL Parameters • el: The audio element handle • rb: The ringbuffer handle ringbuf_handle_t audio_element_get_output_ringbuf(audio_element_handle_t Get Element output ringbuffer. Return ringbuf_handle_t Parameters • el: The audio element handle audio_element_state_t audio_element_get_state(audio_element_handle_t Get current Element state.
  • Page 38 Read the Docs Template Documentation, Release esp_err_t el, int size_expect, TickType_t audio_element_wait_for_buffer(audio_element_handle_t timeout) This function will wait until the sizeof the output ringbuffer is greater than or equal to size_expect If the timeout period has been exceeded and ringbuffer output has not yet reached size_expect then the function will return ESP_FAIL Return •...
  • Page 39 Read the Docs Template Documentation, Release Return • ESP_OK • ESP_FAIL Parameters • el: The audio element handle • timeout: The timeout esp_err_t audio_element_set_output_timeout(audio_element_handle_t el, TickType_t timeout) Set output read timeout (default is portMAX_DELAY) Return • ESP_OK • ESP_FAIL Parameters •...
  • Page 40 Read the Docs Template Documentation, Release • el: The audio element handle • buffer: The buffer pointer • wanted_size: The wanted size audio_element_err_t audio_element_output(audio_element_handle_t el, char *buffer, int write_size) Call this function to sendout Element output data. Return • > 0 number of bytes written •...
  • Page 41 Read the Docs Template Documentation, Release • context: An optional context which will be passed to callback function on every invocation QueueHandle_t audio_element_get_event_queue(audio_element_handle_t Get External queue of Emitter, we can read any event that has been send out of Element from this QueueHandle_t Return QueueHandle_t Parameters...
  • Page 42 Read the Docs Template Documentation, Release int64_t byte_pos The current position (in bytes) being processed for an element int64_t total_bytes The total bytes for an element char *uri URI (optional) audio_codec_t codec_fmt Music format (optional) struct audio_element_cfg_t Audio Element configurations Each Element at startup will be a self-running task. These tasks will execute the callback open ->...
  • Page 43 Read the Docs Template Documentation, Release Macros AUDIO_ELEMENT_INFO_DEFAULT DEFAULT_ELEMENT_BUFFER_LENGTH DEFAULT_ELEMENT_STACK_SIZE DEFAULT_ELEMENT_TASK_PRIO DEFAULT_ELEMENT_TASK_CORE DEFAULT_AUDIO_ELEMENT_CONFIG Type Definitions typedef struct audio_element *audio_element_handle_t typedef esp_err_t (*io_func)(audio_element_handle_t self) audio_element_err_t (*process_func)(audio_element_handle_t self, char *el_buffer, int typedef el_buf_len) audio_element_err_t (*stream_func)(audio_element_handle_t self, char *buffer, int len, Tick- typedef Type_t ticks_to_wait, void *context) Enumerations enum audio_element_err_t...
  • Page 44 Read the Docs Template Documentation, Release enum audio_element_msg_cmd_t Audio element action command, process on dispatcher Values: AEL_MSG_CMD_NONE = 0 AEL_MSG_CMD_ERROR = 1 AEL_MSG_CMD_FINISH = 2 AEL_MSG_CMD_STOP = 3 AEL_MSG_CMD_PAUSE = 4 AEL_MSG_CMD_RESUME = 5 AEL_MSG_CMD_DESTROY = 6 AEL_MSG_CMD_REPORT_STATUS = 8 AEL_MSG_CMD_REPORT_MUSIC_INFO = 9 AEL_MSG_CMD_REPORT_CODEC_FMT = 10 enum audio_element_status_t...
  • Page 45 Read the Docs Template Documentation, Release 2.1.2 Audio Pipeline Dynamic combination of a group of linked Elements is done using the Audio Pipeline. You do not deal with the individual elements but with just one audio pipeline. Every element is connected by a ringbuffer. The Audio Pipeline also takes care of forwarding messages from the element tasks to an application.
  • Page 46 Read the Docs Template Documentation, Release esp_err_t pipeline, audio_element_handle_t audio_pipeline_register(audio_pipeline_handle_t const char *name) Registering an element for audio_pipeline, each element can be registered multiple times, but name (as String) must be unique in audio_pipeline, which is used to identify the element for link creation mentioned in the audio_pipeline_link Return •...
  • Page 47 Read the Docs Template Documentation, Release • pipeline: The Audio Pipeline Handle esp_err_t pipeline) audio_pipeline_resume(audio_pipeline_handle_t This function will set all the elements to the RUNNING state and process the audio data as an inherent feature of audio_pipeline. Return • ESP_OK on success •...
  • Page 48 Read the Docs Template Documentation, Release esp_err_t pipeline, const char *link_tag[], int audio_pipeline_link(audio_pipeline_handle_t link_num) The audio_element added to audio_pipeline will be unconnected before it is called by this function. Based on el- ement’s name already registered by audio_pipeline_register, the path of the data will be linked in the order of the link_tag.
  • Page 49 Read the Docs Template Documentation, Release audio_event_iface_handle_t audio_pipeline_get_event_iface(audio_pipeline_handle_t pipeline) Get the event iface using by this pipeline. Return The Event Handle Parameters • pipeline: The pipeline esp_err_t pipeline, bool first, audio_pipeline_link_insert(audio_pipeline_handle_t dio_element_handle_t prev, ringbuf_handle_t conect_rb, audio_element_handle_t next) Insert the specific audio_element to audio_pipeline, previous element connect to the next element by ring buffer. Return •...
  • Page 50 Read the Docs Template Documentation, Release • ...: Additional elements to add to the audio_pipeline. esp_err_t pipeline, audio_element_handle_t audio_pipeline_link_more(audio_pipeline_handle_t ement_1, ...) Adds a NULL-terminated list of elements to audio_pipeline. Return • ESP_OK • ESP_FAIL Parameters • pipeline: The audio pipeline handle •...
  • Page 51 Read the Docs Template Documentation, Release Parameters • pipeline: The Audio Pipeline Handle Structures struct audio_pipeline_cfg Audio Pipeline configurations. Public Members int rb_size Audio Pipeline ringbuffer size Macros DEFAULT_PIPELINE_RINGBUF_SIZE DEFAULT_AUDIO_PIPELINE_CONFIG Type Definitions typedef struct audio_pipeline *audio_pipeline_handle_t audio_pipeline_cfg typedef struct audio_pipeline_cfg_t Audio Pipeline configurations.
  • Page 52 Read the Docs Template Documentation, Release Functions *config) audio_event_iface_handle_t audio_event_iface_init(audio_event_iface_cfg_t Initialize audio event. Return • ESP_OK • ESP_FAIL Parameters • config: The configurations esp_err_t evt) audio_event_iface_destroy(audio_event_iface_handle_t Cleanup event, it doesn’t free evt pointer. Return • ESP_OK • ESP_FAIL Parameters • evt: The event esp_err_t evt, audio_event_iface_set_listener(audio_event_iface_handle_t...
  • Page 53 Read the Docs Template Documentation, Release Return • ESP_OK • ESP_FAIL Parameters • evt: The event • wait_time: The wait time esp_err_t audio_event_iface_waiting_cmd_msg(audio_event_iface_handle_t evt) Waiting internal queue message. Return • ESP_OK • ESP_FAIL Parameters • evt: The event esp_err_t *msg) audio_event_iface_cmd(audio_event_iface_handle_t evt, audio_event_iface_msg_t...
  • Page 54 Read the Docs Template Documentation, Release Parameters • evt: The event • msg: The message esp_err_t evt) audio_event_iface_discard(audio_event_iface_handle_t Discard all ongoing event message. Return • ESP_OK • ESP_FAIL Parameters • evt: The event esp_err_t evt, audio_event_iface_msg_t audio_event_iface_listen(audio_event_iface_handle_t *msg, TickType_t wait_time) Listening and invoke callback function if there are any event are comming.
  • Page 55 Read the Docs Template Documentation, Release QueueHandle_t evt) audio_event_iface_get_msg_queue_handle(audio_event_iface_handle_t Get Internal queue handle of Emmitter. Return Internal QueueHandle_t Parameters • evt: The Internal queue esp_err_t evt, audio_event_iface_set_msg_listener(audio_event_iface_handle_t dio_event_iface_handle_t listener) Add audio internal event evt to the listener, then we can listen evt event from listen Return •...
  • Page 56 Read the Docs Template Documentation, Release int external_queue_size It’s optional, Queue size for event external_queue int queue_set_size It’s optional, QueueSet size for event queue_set on_event_iface_func on_cmd Function callback for listener when any event arrived void *context Context will pass to callback function TickType_t wait_time Timeout to check for event queue int type...
  • Page 57: Audio Streams

    Read the Docs Template Documentation, Release AUDIO_ELEMENT_TYPE_ELEMENT = 0x01<<(ELEMENT_SUB_TYPE_OFFSET+1) AUDIO_ELEMENT_TYPE_PLAYER = 0x01<<(ELEMENT_SUB_TYPE_OFFSET+2) AUDIO_ELEMENT_TYPE_SERVICE = 0x01<<(ELEMENT_SUB_TYPE_OFFSET+3) AUDIO_ELEMENT_TYPE_PERIPH = 0x01<<(ELEMENT_SUB_TYPE_OFFSET+4) enum audio_stream_type_t Values: AUDIO_STREAM_NONE = 0 AUDIO_STREAM_READER AUDIO_STREAM_WRITER enum audio_codec_type_t Values: AUDIO_CODEC_TYPE_NONE = 0 AUDIO_CODEC_TYPE_DECODER AUDIO_CODEC_TYPE_ENCODER enum audio_codec_t Values: AUDIO_CODEC_NONE = 0 AUDIO_CODEC_RAW AUDIO_CODEC_WAV AUDIO_CODEC_MP3...
  • Page 58 Read the Docs Template Documentation, Release To set the stream type, use provided structure, e.g. for I2S stream, together with i2s_stream_cfg_t enumerator. audio_stream_type_t See description below for the API details. 2.2.1 I2S Stream When the I2S stream type is “writer”, the data may be sent either to a codec chip or to the internal DAC of ESP32. To simplify configuration, two macros are provided to cover each case: •...
  • Page 59 Read the Docs Template Documentation, Release Structures struct i2s_stream_cfg_t I2S Stream configurations Default value will be used if any entry is zero. Public Members audio_stream_type_t type Type of stream i2s_config_t i2s_config I2S driver configurations i2s_pin_config_t i2s_pin_config I2S driver hardware pin configurations i2s_port_t i2s_port I2S driver hardware port Macros...
  • Page 60 Read the Docs Template Documentation, Release Public Members http_stream_event_id_t event_id Event ID void *http_client Reference to HTTP Client using by this HTTP Stream void *buffer Reference to Buffer using by the Audio Element int buffer_len Lenght of buffer void *user_data User data context, from http_stream_cfg_t struct http_stream_cfg_t...
  • Page 61: Codecs

    Read the Docs Template Documentation, Release HTTP_STREAM_ON_RESPONSE The event handler will be called when HTTP Client is receiving data If the fucntion return the value (-1: ESP_FAIL), HTTP Client will be stopped If the fucntion return the value > 0, HTTP Stream will ignore the read function If the fucntion return the value = 0, HTTP Stream continue read data from HTTP Server HTTP_STREAM_POST_REQUEST The event handler will be called after HTTP Client send header and body to the serve, before fetching the...
  • Page 62: Peripherals

    Read the Docs Template Documentation, Release Application Examples Implementation of this API is demonstrated in the following examples: • get-started/play_mp3 • player/pipeline_sdcard_mp3 API Reference 2.3.2 WAV Decoder and Encoder Decode and encode an audio data stream from / to WAV format. Application Examples Implementation of this API is demonstrated in the following examples: •...
  • Page 63 Read the Docs Template Documentation, Release API Reference 2.4.2 SD Card Peripheral If your board has a SD card connected, use this API to initialize, mount and unmount the card, see functions periph_sdcard_init(), periph_sdcard_mount() and periph_sdcard_unmount(). The data read- ing / writing is implemented in a separate API described in FatFs Stream.
  • Page 64 Read the Docs Template Documentation, Release esp_err_t _periph_event_handle(audio_event_iface_msg_t event, context) static void switch ((int)event->source_type) { case PERIPH_ID_CONSOLE: ESP_LOGI(TAG, "CONSOLE, command id=%d", event->cmd); break; return ESP_OK; esp_err_t console_test_cb(esp_periph_handle_t periph, argc, char argv[]) ESP_LOGI(TAG, "CONSOLE Callback, argc=%d", argc); (i=0; i<argc; i++) { ESP_LOGI(TAG, "CONSOLE Args[%d] %s", i, argv[i]);...
  • Page 65 Read the Docs Template Documentation, Release Note: Note that if you do not intend to integrate new peripherals into esp_peripherals, you are only interested in simple api esp_periph_init, esp_periph_start, esp_periph_stop and esp_periph_destroy. If you want to integrate new peripherals, please refer to source code Periph Button Examples...
  • Page 66: Abstraction Layer

    Read the Docs Template Documentation, Release esp_periph_handle_t button_handle periph_button_init(&btn_cfg); // Setup TOUCH peripheral periph_touch_cfg_t touch_cfg .touch_mask TOUCH_PAD_SEL4 TOUCH_PAD_SEL7 TOUCH_PAD_SEL8 TOUCH_PAD_ SEL9, .tap_threshold_percent esp_periph_handle_t touch_handle periph_touch_init(&touch_cfg); // Start all peripheral esp_periph_start(button_handle); esp_periph_start(sdcard_handle); esp_periph_start(touch_handle); vTaskDelay(10 1000/portTICK_RATE_MS); //Stop button peripheral esp_periph_stop(button_handle); vTaskDelay(10 1000/portTICK_RATE_MS); //Start button again esp_periph_start(button_handle);...
  • Page 67 Read the Docs Template Documentation, Release API Reference Header File • audio_pipeline/include/ringbuf.h Functions ringbuf_handle_t rb_create(int size, int block_size) Create ringbuffer with total size = size * block_size. Return ringbuf_handle_t Parameters • size: The size • block_size: The block size esp_err_t rb_destroy(ringbuf_handle_t Cleanup and free all memory created by ringbuf_handle_t.
  • Page 68 Read the Docs Template Documentation, Release Return total bytes available Parameters • rb: The Ringbuffer handle rb_bytes_filled(ringbuf_handle_t Get the number of bytes that have filled the ringbuffer. Return The number of bytes that have filled the ringbuffer Parameters • rb: The Ringbuffer handle rb_get_size(ringbuf_handle_t Get total size of Ringbuffer (in bytes) Return total size of Ringbuffer...
  • Page 69: Configuration Options

    Read the Docs Template Documentation, Release • rb: The Ringbuffer handle esp_err_t rb_done_write(ringbuf_handle_t Set status of writing to ringbuffer is done. Return • ESP_OK • ESP_FAIL Parameters • rb: The Ringbuffer handle Macros RB_OK RB_FAIL RB_DONE RB_ABORT RB_TIMEOUT Type Definitions typedef struct ringbuf *ringbuf_handle_t 2.5.2 Audio HAL Abstraction layer for audio board hardware, serves as an interface between the user application and the hardware driver...
  • Page 70 Read the Docs Template Documentation, Release 2.6.1 ESP HTTP client ESP_HTTP_CLIENT_ENABLE_HTTPS Enable https Found in: Component config > ESP HTTP client This option will enable https protocol by linking mbedtls library and initializing SSL transport 2.6.2 Audio HAL AUDIO_BOARD Audio board Found in: Audio HAL Select an audio board to use with the ESP-ADF Available options:...
  • Page 71: Design Guide

    CHAPTER Design Guide The ESP32 is a powerful chip well positioned as a MCU of the audio projects. This section is intended to provide guidance on process of designing an audio project with the ESP32 inside. 3.1 Project Design When designing a project with ability to process an audio signal or audio data we typically consider a subset of the following components: Input: •...
  • Page 72 Read the Docs Template Documentation, Release • Ethernet interface to stream an audio data stream to the internet • An internal chip’s flash memory to store some audio recording • User Interface e.g. a display, LEDs or some means of haptic feedback Main Processing Unit:...
  • Page 73: Design Considerations

    Read the Docs Template Documentation, Release Fig. 3.2: Audio Project Example - Internet Connected Radio Player 3.1.3 Typical Project When looking for better audio quality and more interfacing options we would use an external I2S codec to do all the analog input and output signal processing.
  • Page 74 Read the Docs Template Documentation, Release Fig. 3.3: Typical Audio Project Example external memory is incorporated in the memory map and is, within certain restrictions, usable in the same way internal Data-RAM is. Refer to External SPI-connected RAM section in IDF documenation for details, especially pay attention to its Restric- tions section which is very important.
  • Page 75 Read the Docs Template Documentation, Release • Set CONFIG_WL_SECTOR_SIZE as 512 in Component config > Wear Levelling Note: The smaller the size of sector be, the slower the Write / Read speed will be, and vice versa, but only 512 and 4096 are supported.
  • Page 76: Software Design

    LWIP > TCP • If external antenna is used, then set PHY_RF_CAL_PARTIAL as PHY_RF_CAL_FULL in ‘’esp- idf/components/esp32/phy_init.c’‘ 3.3 Software Design Espressif audio framework project. 3.3.1 Features 1. All of Streams and Codecs based on audio element. 2. All events based on queue.
  • Page 77 Read the Docs Template Documentation, Release 3.3.2 Design Components Five basic components are - Audio Element, Audio Event, Audio Pipeline, ESP peripherals, ESP audio Audio Element Example audio_element_handle_t el; audio_element_cfg_t cfg DEFAULT_AUDIO_ELEMENT_CONFIG(); cfg.open _el_open; cfg.read _el_read; cfg.process _el_process; cfg.write _el_write; cfg.close _el_close;...
  • Page 78 Read the Docs Template Documentation, Release el_cfg.open _el_open; el_cfg.read _el_read; el_cfg.process _el_process; el_cfg.close _el_close; first_el audio_element_init(&el_cfg, "first"); TEST_ASSERT_NOT_NULL(first_el); el_cfg.read NULL; el_cfg.write NULL; mid_el audio_element_init(&el_cfg, "mid"); TEST_ASSERT_NOT_NULL(mid_el); el_cfg.write _el_write; last_el audio_element_init(&el_cfg, "last"); TEST_ASSERT_NOT_NULL(last_el); audio_pipeline_cfg_t pipeline_cfg DEFAULT_AUDIO_PIPELINE_CONFIG(); audio_pipeline_handle_t pipeline audio_pipeline_init(&pipeline_cfg); TEST_ASSERT_NOT_NULL(pipeline); TEST_ASSERT_EQUAL(ESP_OK, audio_pipeline_register(pipeline, first_el, mid_el, last_ el));...
  • Page 79: Development Boards

    Hardware details of audio development boards designed by Espressif around ESP32. 3.4.1 ESP32-LyraT V4.3 Hardware Reference This guide provides functional descriptions, configuration options for ESP32-LyraT V4.3 audio development board. As an introduction to functionality and using the LyraT, please see ESP32-LyraT V4.3 Getting Started...
  • Page 80 • Related Documents Overview The ESP32-LyraT development board is a hardware platform designed for the dual-core ESP32 audio applications, e.g., Wi-Fi or BT audio speakers, speech-based remote controllers, smart-home appliances with audio functional- ity(ies), etc. The block diagram below presents main components of the ESP32-LyraT.
  • Page 81 Read the Docs Template Documentation, Release Fig. 3.4: ESP32-LyraT V4.3 Electrical Block Diagram JTAG Header Provides access to the JTAG interface of ESP32-WROVER Module. It may be used for debugging, application upload, as well as implementing several other functions, e.g., Application Level Tracing.
  • Page 82 Read the Docs Template Documentation, Release Fig. 3.5: ESP32-LyraT V4.3 Board Layout Chapter 3. Design Guide...
  • Page 83 Power Switch Power on/off knob: toggling it to the left powers the board on; toggling it to the right powers the board off. Hardware Setup Options There are a couple of options to change the hardware configuration of the ESP32-LyraT board. The options are selectable with the Function DIP Switch. 3.4. Development Boards...
  • Page 84 Read the Docs Template Documentation, Release Enable MicroSD Card in 1-wire Mode DIP SW Position 1. AUX Input detection may be enabled by toggling the DIP SW 7 ON. Note that the AUX Input signal pin should not be be plugged in when the system powers up. Otherwise the ESP32 may not be able to boot correctly. In this mode: •...
  • Page 85 Read the Docs Template Documentation, Release In this mode: • MicroSD Card functionality is not available, remove the card from the slot • Vol- touch button is not available for use with the API • AUX Input detection from the API is not available Using Automatic Upload Entering of the ESP32 into upload mode may be done in two ways: •...
  • Page 86 Read the Docs Template Documentation, Release Pinout of Extension Headers There are several pin headers available to connect external components, check the state of particular signal bus or debug operation of ESP32. Note that some signals are shared, see section for details.
  • Page 87 Read the Docs Template Documentation, Release Power Supply Separation The main power supply is 5V and provided by a USB. The secondary power supply is 3.7V and provided by an optional battery. The USB power itself is fed with a dedicated cable, separate 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.
  • Page 88 Read the Docs Template Documentation, Release Fig. 3.7: ESP32 LyraT V4.3 - Dedicated LDO for the ESP32 Module Fig. 3.8: ESP32 LyraT V4.3 - Dedicated LDO for the MicroSD Card Chapter 3. Design Guide...
  • Page 89 Other Versions of LyraT • ESP32-LyraT V4.2 Getting Started Guide • ESP32-LyraT V4 Getting Started Guide Related Documents •...
  • Page 90 Read the Docs Template Documentation, Release • ESP32-WROVER Datasheet (PDF) • JTAG Debugging Chapter 3. Design Guide...
  • Page 91: Resources

    • Several books have been written about ESP32 and they are listed on Espressif web site. • For additional ESP32 product related information, please refer to documentation section of Espressif site. • Mirror of this documentation is available under: https://dl.espressif.com/doc/esp-adf/latest/.
  • Page 92 Read the Docs Template Documentation, Release Chapter 4. Resources...
  • Page 93: Copyrights And Licenses

    Copyrights and Licenses 5.1 Software Copyrights All original source code in this repository is Copyright (C) 2015-2018 Espressif Systems. This source code is licensed under the ESPRESSIF MIT License as described in the file LICENSE. Additional third party copyrighted code is included under the following licenses: •...
  • Page 94 Read the Docs Template Documentation, Release Chapter 5. Copyrights and Licenses...
  • Page 95: About

    The ESP-ADF also provides integration with Baidu DauerOS cloud services. A range of components is coming to provide integration with DeepBrain, Amazon, Google, Alibaba and Turing cloud services. The ESP-ADF builds on well established, FreeRTOS based, Espressif IOT Development Framework ESP-IDF. • genindex...
  • Page 96 Read the Docs Template Documentation, Release Fig. 6.1: Espressif Audio Development Framework Chapter 6. About...
  • Page 97 Index tor), AEL_STATUS_INPUT_DONE (C++ enumerator), AEL_IO_ABORT (C++ enumerator), AEL_STATUS_MOUNTED (C++ enumerator), AEL_IO_DONE (C++ enumerator), AEL_STATUS_NONE (C++ enumerator), AEL_IO_FAIL (C++ enumerator), AEL_STATUS_OUTPUT_BUFFERING (C++ enumera- AEL_IO_OK (C++ enumerator), tor), AEL_IO_TIMEOUT (C++ enumerator), AEL_STATUS_OUTPUT_DONE (C++ enumerator), AEL_MSG_CMD_DESTROY (C++ enumerator), AEL_STATUS_STATE_PAUSED (C++ enumerator), AEL_MSG_CMD_ERROR (C++ enumerator), AEL_STATUS_STATE_RUNNING (C++ enumerator), AEL_MSG_CMD_FINISH (C++ enumerator), AEL_MSG_CMD_NONE (C++ enumerator),...
  • Page 98 Read the Docs Template Documentation, Release audio_element_cfg_t::task_stack (C++ member), AUDIO_ELEMENT_TYPE_ELEMENT (C++ enumera- audio_element_cfg_t::write (C++ member), tor), audio_element_deinit (C++ function), AUDIO_ELEMENT_TYPE_PERIPH (C++ enumerator), audio_element_err_t (C++ type), audio_element_get_event_queue (C++ function), AUDIO_ELEMENT_TYPE_PLAYER (C++ enumera- audio_element_get_input_ringbuf (C++ function), tor), audio_element_get_output_ringbuf (C++ function), AUDIO_ELEMENT_TYPE_SERVICE (C++ enumera- audio_element_get_state (C++ function), tor), audio_element_get_tag (C++ function),...
  • Page 99 Read the Docs Template Documentation, Release audio_pipeline_cfg::rb_size (C++ member), http_stream_cfg_t (C++ class), audio_pipeline_cfg_t (C++ type), http_stream_cfg_t::event_handle (C++ member), audio_pipeline_check_items_state (C++ function), http_stream_cfg_t::type (C++ member), audio_pipeline_deinit (C++ function), http_stream_cfg_t::user_data (C++ member), audio_pipeline_get_event_iface (C++ function), http_stream_event_handle_t (C++ type), audio_pipeline_handle_t (C++ type), http_stream_event_id_t (C++ type), audio_pipeline_init (C++ function), http_stream_event_msg_t (C++ class), audio_pipeline_link (C++ function),...
  • Page 100 Read the Docs Template Documentation, Release rb_done_write (C++ function), RB_FAIL (C macro), rb_get_size (C++ function), RB_OK (C macro), rb_read (C++ function), rb_reset (C++ function), rb_size_get (C++ function), RB_TIMEOUT (C macro), rb_write (C++ function), ringbuf_handle_t (C++ type), stream_func (C++ type), Index...

Table of Contents