I am trying to use a SPH0645 mic with a Lora32 board. The mic is not connected to the board yet.
When I try to install and RX i2s driver I always get an error.
Unfortunately I don't know how to interpret the error description (yet ) and I absolutely have no idea why is this not working
I really appreciate any help.
Here is my sample code.
Code: Select all
#include <stdlib.h>
#include <stddef.h>
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <sys/time.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_log.h"
#include "esp_system.h"
#include "driver/i2s.h"
#define TAG "main"
static void init_i2s()
{
/* RX: I2S_NUM_1 */
i2s_config_t i2s_config_rx = {
mode: (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
sample_rate: 44100,
bits_per_sample: I2S_BITS_PER_SAMPLE_32BIT,
channel_format: I2S_CHANNEL_FMT_RIGHT_LEFT,
communication_format: (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
intr_alloc_flags: ESP_INTR_FLAG_LEVEL1,
dma_buf_count: 14,
dma_buf_len: 64
};
printf("1.\r\n");
i2s_pin_config_t pin_config_rx = {
.bck_io_num = GPIO_NUM_17,
.ws_io_num = GPIO_NUM_18,
.data_out_num = I2S_PIN_NO_CHANGE,
.data_in_num = GPIO_NUM_5
};
printf("2.\r\n");
i2s_driver_install(I2S_NUM_1, &i2s_config_rx, 0, NULL);
printf("3.\r\n");
// i2s_set_pin(I2S_NUM_1, &pin_config_rx);
}
void example(void *pvParams)
{
init_i2s();
}
void app_main()
{
printf("Hello world!\n");
xTaskCreatePinnedToCore(&example, "example", 16384, NULL, 20, NULL, 0);
}
------------------------------------------------------------------------------------------------------------
Hello world!
1.
2.
V (263) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args[0m
V (273) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x2[0m
D (283) intr_alloc: Connected src 33 to int 13 (cpu 0)[0m
D (283) I2S: Addr[0] = 1073455492[0m
D (283) I2S: Addr[1] = 1073456008[0m
D (293) I2S: Addr[2] = 1073456524[0m
D (293) I2S: Addr[3] = 1073457040[0m
D (293) I2S: Addr[4] = 1073457556[0m
D (303) I2S: Addr[5] = 1073458072[0m
D (303) I2S: Addr[6] = 1073458588[0m
D (303) I2S: Addr[7] = 1073459104[0m
D (313) I2S: Addr[8] = 1073459620[0m
D (313) I2S: Addr[9] = 1073460136[0m
D (313) I2S: Addr[10] = 1073460652[0m
D (323) I2S: Addr[11] = 1073461168[0m
D (323) I2S: Addr[12] = 1073461684[0m
D (323) I2S: Addr[13] = 1073462200[0m
[0;32mI (333) I2S: DMA Malloc info, datalen=blocksize=512, dma_buf_count=14[0m
[0;32mI (343) I2S: PLL_D2: Req RATE: 44100, real rate: 44642.000, BITS: 32, CLKM: 14, BCK: 4, MCLK: 11289966.924, SCLK: 2857088.000000, diva: 64, divb: 11[0m
3.
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction)
. Exception was unhandled.
Register dump:
PC : 0x400d22f6 PS : 0x00060b30 A0 : 0x00000000 A1 : 0x3ffb9ee0
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800d22f6 A9 : 0x3ffb9e90
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00060023 A13 : 0x3ffb9f6c
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffe
Backtrace: 0x400d22f6:0x3ffb9ee0 0x7ffffffd:0x3ffb9f00
Rebooting...
------------------------------------------------------------------------------------------------------------
thanks,
Janos