sensorium / Mozzi

sound synthesis library for Arduino
https://sensorium.github.io/Mozzi/
GNU Lesser General Public License v2.1
1.07k stars 186 forks source link

Mozzi on ESP32 with I2S Codec #271

Closed Duffsman closed 3 weeks ago

Duffsman commented 3 weeks ago

hello, I'm runnung into problems using Mozzi with the AiThinker Auidokit. My Sketch was working fine about two weeks ago, but apparently something has changed in the ESP core and now it doesn't anymore?!

Sketch:

#include "MozziConfigValues.h"  // for named option values

#define MOZZI_AUDIO_MODE MOZZI_OUTPUT_I2S_DAC
#define MOZZI_AUDIO_CHANNELS MOZZI_STEREO
#define MOZZI_CONTROL_RATE 256 // Hz, powers of 2 are most reliable
#define ESP32_I2S_BCK_PIN 27
#define ESP32_I2S_WS_PIN 25
#define ESP32_I2S_DATA_PIN 26

// #define MOZZI_I2S_PORT     I2S_NUM_1// (default: I2S_NUM_0)

#include <Mozzi.h>
#include <Oscil.h>
#include <tables/cos2048_int8.h> // table for Oscils to play

// Synthesis part
Oscil<COS2048_NUM_CELLS, MOZZI_AUDIO_RATE> aCos1(COS2048_DATA);

void setup() {
  aCos1.setFreq(440.f);
  startMozzi();
}

void updateControl() {

}

AudioOutput updateAudio() {
  int val = aCos1.next();
  return StereoOutput::from8Bit(val,val);
}

void loop() {
  audioHook();
}

Arduino Settings:

Board: Esp32 Dev Module
Events Run On: Core 1
Flash Frequency: 40 Mhz
Flash Mode: DIO
Arduino Runs On: Core 1
Partition Scheme: Default 4MP with spiffs
PSRAM: Disabled

The ESP is stuck in a boot-loop and always spits out the follwoing errormessage via serial:

ELF file SHA256: 615c5d1ed34a1bc8

E (185) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
E (194) esp_core_dump_elf: Elf write init failed!
E (198) esp_core_dump_common: Core dump write failed with error=-1
Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x1f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1288
load:0x40078000,len:13856
load:0x40080400,len:4
ho 8 tail 4 room 4
load:0x40080404,len:3048
entry 0x40080590
E (165) ADC: CONFLICT! driver_ng is not allowed to be used with the legacy driver

abort() was called at PC 0x400d884f on core 0

Backtrace: 0x4008237d:0x3ffe3b40 0x4008863d:0x3ffe3b60 0x4008d5e5:0x3ffe3b80 0x400d884f:0x3ffe3c00 0x400dada6:0x3ffe3c20 0x400826aa:0x3ffe3c50 0x400793fe:0x3ffe3c90 |<-CORRUPTED

it also looks like there is a problem with the ADC...

Duffsman commented 3 weeks ago

ok, i just realised that i have the same problem as in Issue #261.