Skip to content

Commit

Permalink
Bootloader and DAC correction
Browse files Browse the repository at this point in the history
Release configuration.
  • Loading branch information
karawin committed Feb 6, 2022
1 parent 85448f5 commit e841dce
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
Binary file modified binaries/KaRadio32.bin
Binary file not shown.
Binary file modified binaries/KaRadio32_22R1.bin
Binary file not shown.
Binary file modified binaries/bootloader.bin
Binary file not shown.
23 changes: 18 additions & 5 deletions components/audio_renderer/audio_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,18 @@ bool init_i2s(/*renderer_config_t *config*/)
{
renderer_config_t *config;
config = renderer_get();

config->bit_depth = I2S_BITS_PER_SAMPLE_16BIT;
config->i2s_num = I2S_NUM_0;
config->sample_rate = 44100;
config->sample_rate_modifier = 1.0;
config->output_mode = get_audio_output_mode();

if(config->output_mode == I2S_MERUS) {
config->bit_depth = I2S_BITS_PER_SAMPLE_32BIT;
}


i2s_mode_t mode = I2S_MODE_MASTER | I2S_MODE_TX;
i2s_comm_format_t comm_fmt = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB;
i2s_bits_per_sample_t bit_depth = config->bit_depth;
Expand All @@ -537,6 +549,7 @@ bool init_i2s(/*renderer_config_t *config*/)

if(config->output_mode == DAC_BUILT_IN)
{
config->bit_depth = I2S_BITS_PER_SAMPLE_16BIT;
mode = mode | I2S_MODE_DAC_BUILT_IN;
comm_fmt = I2S_COMM_FORMAT_I2S_MSB;
}
Expand All @@ -552,7 +565,7 @@ bool init_i2s(/*renderer_config_t *config*/)
}

if ((config->output_mode == I2S)||(config->output_mode == I2S_MERUS)
|| (config->output_mode == SPDIF) || (config->output_mode == DAC_BUILT_IN))
|| (config->output_mode == SPDIF) )//|| (config->output_mode == DAC_BUILT_IN))
{
/* don't use audio pll on buggy rev0 chips */
// don't do it for PDM
Expand Down Expand Up @@ -581,8 +594,8 @@ bool init_i2s(/*renderer_config_t *config*/)
.dma_buf_count = bc, // number of buffers, 128 max. 16
// .dma_buf_len = bigSram()?256:128, // size of each buffer 128
.dma_buf_len = 512, // size of each buffer 128
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest level 1
// .intr_alloc_flags = 0 , // default
// .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest level 1
.intr_alloc_flags = 0 , // default
.tx_desc_auto_clear = true,
.use_apll = use_apll
};
Expand All @@ -598,7 +611,7 @@ bool init_i2s(/*renderer_config_t *config*/)
.data_out_num = i2sdata,
.data_in_num = I2S_PIN_NO_CHANGE
};

ESP_LOGD(TAG, "mode:%d, sample_rate:%d, bit_depth:%d, comm:%d, data:%d",mode,sample_rate,bit_depth,comm_fmt,i2sdata);

if (i2s_driver_install(config->i2s_num, &i2s_config, 0, NULL) != ESP_OK)
{
Expand All @@ -617,7 +630,7 @@ bool init_i2s(/*renderer_config_t *config*/)
if(config->output_mode == DAC_BUILT_IN)// || (mode & I2S_MODE_PDM))
{
i2s_set_pin(config->i2s_num, NULL);
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
// i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
}
else {
if ((lrck!=255) && (bclk!=255) && (i2sdata!=255))
Expand Down
6 changes: 0 additions & 6 deletions main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,6 @@ static renderer_config_t *create_renderer_config()
{
renderer_config_t *renderer_config = calloc(1, sizeof(renderer_config_t));

renderer_config->bit_depth = I2S_BITS_PER_SAMPLE_16BIT;
renderer_config->i2s_num = I2S_NUM_0;
renderer_config->sample_rate = 44100;
renderer_config->sample_rate_modifier = 1.0;
renderer_config->output_mode = audio_output_mode;

if(renderer_config->output_mode == I2S_MERUS) {
renderer_config->bit_depth = I2S_BITS_PER_SAMPLE_32BIT;
}
Expand Down
11 changes: 5 additions & 6 deletions sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16
#
CONFIG_LOG_BOOTLOADER_LEVEL_NONE=
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=
CONFIG_LOG_BOOTLOADER_LEVEL_WARN=
CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y
CONFIG_LOG_BOOTLOADER_LEVEL_INFO=
CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG=y
CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG=
CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE=
CONFIG_LOG_BOOTLOADER_LEVEL=4
CONFIG_LOG_BOOTLOADER_LEVEL=2
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V=
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
CONFIG_BOOTLOADER_FACTORY_RESET=
Expand Down Expand Up @@ -125,8 +125,8 @@ CONFIG_PARTITION_TABLE_MD5=y
#
# Compiler options
#
CONFIG_OPTIMIZATION_LEVEL_DEBUG=y
CONFIG_OPTIMIZATION_LEVEL_RELEASE=
CONFIG_OPTIMIZATION_LEVEL_DEBUG=
CONFIG_OPTIMIZATION_LEVEL_RELEASE=y
CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y
CONFIG_OPTIMIZATION_ASSERTIONS_SILENT=
CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED=
Expand Down Expand Up @@ -736,7 +736,6 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
CONFIG_FREERTOS_USE_TRACE_FACILITY=
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=
CONFIG_FREERTOS_DEBUG_INTERNALS=
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=

Expand Down

0 comments on commit e841dce

Please sign in to comment.