attempts to get running on lyrat boards. Loads OK but inputs and outputs
silence. Still questionable but audible output from generic ESP32 boards with MAX98357A DAC/AMP and INMP 441 MEMS mic.
This commit is contained in:
parent
a82b66eb39
commit
3c604699ba
5 changed files with 61 additions and 33 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1 +1,3 @@
|
|||
build
|
||||
dependencies.lock
|
||||
managed_components
|
||||
|
|
|
|||
|
|
@ -2,5 +2,10 @@
|
|||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# for LyraT boards uncomment this line and use "esp_adf" instead of "esp_idf":
|
||||
#
|
||||
# include($ENV{ADF_PATH}/CMakeLists.txt)
|
||||
#
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(espd)
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ export IDF_PATH=~/bis/var/esp/esp-idf
|
|||
|
||||
for LyraT boards:
|
||||
|
||||
### FIRST edit Cmakelists.txt to enable esp_adf ###
|
||||
export IDF_TOOLS_PATH=~/bis/var/esp/tools
|
||||
export ADF_PATH=~/bis/var/esp/esp-adf
|
||||
. $ADF_PATH/esp-idf/export.sh
|
||||
|
|
|
|||
50
main/espd.c
50
main/espd.c
|
|
@ -9,11 +9,13 @@
|
|||
|
||||
#include "espd.h"
|
||||
#include <string.h>
|
||||
#include <math.h>g
|
||||
#include <math.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#ifdef PD_LYRAT
|
||||
#include "board.h"
|
||||
#endif /* PD_LYRAT */
|
||||
#include "driver/i2s.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
#include "nvs.h"
|
||||
#include "nvs_flash.h"
|
||||
|
|
@ -102,8 +104,9 @@ void senddacs( void)
|
|||
|
||||
static void initdacs( void)
|
||||
{
|
||||
i2s_config_t i2s_config = {
|
||||
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX
|
||||
i2s_config_t i2s_config =
|
||||
{
|
||||
.mode = (I2S_MODE_MASTER | I2S_MODE_TX
|
||||
#ifdef USEADC
|
||||
| I2S_MODE_RX
|
||||
#endif
|
||||
|
|
@ -111,34 +114,51 @@ static void initdacs( void)
|
|||
.sample_rate = 48000,
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
|
||||
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
|
||||
.communication_format =
|
||||
(i2s_comm_format_t)(I2S_COMM_FORMAT_STAND_I2S),
|
||||
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, /* high interrupt priority */
|
||||
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
|
||||
.dma_buf_count = 16,
|
||||
.dma_buf_len = 256,
|
||||
#ifdef PD_LYRAT
|
||||
.use_apll=1,
|
||||
#else
|
||||
.use_apll=0,
|
||||
#endif
|
||||
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, /* high interrupt priority */
|
||||
.tx_desc_auto_clear= true,
|
||||
.fixed_mclk=-1 };
|
||||
i2s_pin_config_t i2s_pin_cfg = {
|
||||
#if 1 /* generic board on big breadboard */
|
||||
.fixed_mclk=-1
|
||||
};
|
||||
|
||||
ESP_LOGI(TAG, "[ 1 ] Start audio codec chip");
|
||||
|
||||
#ifdef PD_LYRAT
|
||||
audio_board_handle_t board_handle = audio_board_init();
|
||||
audio_hal_ctrl_codec(board_handle->audio_hal,
|
||||
AUDIO_HAL_CODEC_MODE_BOTH, AUDIO_HAL_CTRL_START);
|
||||
audio_hal_set_volume(board_handle->audio_hal, 100);
|
||||
#endif
|
||||
|
||||
i2s_driver_install(TEST_I2S_NUM, &i2s_config, 0, NULL);
|
||||
|
||||
#ifndef PD_LYRAT
|
||||
{
|
||||
i2s_pin_config_t i2s_pin_cfg =
|
||||
{
|
||||
#if 1 /* generic board 1 - edit this as needed */
|
||||
.bck_io_num = 13, /* bit clock */
|
||||
.ws_io_num = 33, /* Word select, aka left right clock */
|
||||
.data_out_num = 32, /* Data out from ESP32, to DIN on 38357A */
|
||||
.data_in_num = 35 /* data from ADC */
|
||||
#endif
|
||||
#if 0
|
||||
#if 0 /* generic board 2 */
|
||||
.bck_io_num = 33, /* bit clock */
|
||||
.ws_io_num = 25, /* Word select, aka left right clock */
|
||||
.data_out_num = 32, /* Data out from ESP32, to DIN on 38357A */
|
||||
.data_in_num = I2S_PIN_NO_CHANGE /* no ADC */
|
||||
#endif
|
||||
};
|
||||
|
||||
ESP_LOGI(TAG, "[ 1 ] Start audio codec chip");
|
||||
|
||||
i2s_driver_install(TEST_I2S_NUM, &i2s_config, 0, NULL);
|
||||
i2s_set_pin(TEST_I2S_NUM, &i2s_pin_cfg);
|
||||
}
|
||||
#endif /* not PD_LYRAT */
|
||||
}
|
||||
|
||||
static int audiostate;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* #define PD_USE_BLUETOOTH */
|
||||
/* #define PD_USE_WIFI */
|
||||
#define PD_USE_CONSOLE
|
||||
|
||||
/* #define PD_USE_BLUETOOTH */ /* messages to Pd over bluetooth */
|
||||
/* #define PD_USE_WIFI */ /* messages to/from Pd over wifi TCP */
|
||||
#define PD_USE_CONSOLE /* messages to Pd over "console" (USB serial) */
|
||||
/* #define PD_LYRAT */ /* using LyraT or LyraT mini board */
|
||||
|
||||
/* task priorities */
|
||||
#define PRIORITY_WIFI 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue