pschatzmann / arduino-audiokit

Arduino ADF/Audiokit HAL (support for ESP32-A1S, AI-Thinker, LyraT for ES7148, ES7210, ES7243, ES8311, ES8347, ES8388, TAS5805M, AC101 audio chips)
GNU General Public License v3.0
153 stars 40 forks source link

Changing MCLK Pin Default for ES8388 #69

Closed HosseinKasaei closed 1 year ago

HosseinKasaei commented 1 year ago

Hi,

I've made a custom board included ESP32 and ES8388. I've used another pin rather than GPIO0 for MCLK, but it doesn't work and I'm getting junk data. I tried to change the default MCLK pin in board_def.h and board_pins_config.c but it doesn't work. Do I have to stick to GPIO0 for MCLK?

pschatzmann commented 1 year ago

To be honest I never looked in detail into this. I was just taking the logic which was implemented in the ADF. I think by default the pin should be taken from the codec specific configuration file. You should have the possibility to provide your custom definition in the AudioKitStreamConfig, but I never tested if this is properly working.

The ESP32 only supports 2 pins for the MCLK: GPIO0 and GPIO3.

But here is the key question: is this really used by the ES8388 ?

pschatzmann commented 1 year ago

Just made a test and I confirm that the functionality of setting the masterclock pin is working as expected. And I also confirm that this is needed by the ES8388: Setting it to 3 on an AudioKit was making that the audio did not work any more...

  auto config = out.defaultConfig(TX_MODE);
  config.sample_rate = sample_rate; 
  config.channels = channels;
  config.bits_per_sample = 16;
  config.masterclock_pin = 3;
  out.begin(config);