Skip to content

Instantly share code, notes, and snippets.

@audionerd
Last active January 6, 2023 02:48
Show Gist options
  • Select an option

  • Save audionerd/564c7c7997b4ab836bc67723f9dc65d3 to your computer and use it in GitHub Desktop.

Select an option

Save audionerd/564c7c7997b4ab836bc67723f9dc65d3 to your computer and use it in GitHub Desktop.

Revisions

  1. audionerd revised this gist Jan 6, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions m5stack-rca-module.ino
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    // M5Stack Core Basic + RCA Module 13.2 (PCM5102)
    // based on https://github.com/m5stack/M5Stack/blob/b3e801f/examples/Unit/RCA/RCA.ino

    #include <M5Unified.h>

  2. audionerd renamed this gist Jan 6, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. audionerd created this gist Jan 6, 2023.
    37 changes: 37 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    // M5Stack Core Basic + RCA Module 13.2 (PCM5102)

    #include <M5Unified.h>

    void setup() {
    auto cfg = M5.config();
    cfg.external_spk = true;
    cfg.internal_spk = false;

    M5.begin();

    auto spk_cfg = M5.Speaker.config();
    spk_cfg.i2s_port = I2S_NUM_1;
    spk_cfg.sample_rate = 96000;

    // via schematic at https://docs.m5stack.com/en/module/RCA%20Module%2013.2
    // LRCK 23 (G0/IIS_MK)
    // DIN 24 (G15/IIS_OUT)
    // BCK 21 (G13/IIS_WS)
    spk_cfg.pin_data_out = 15;
    spk_cfg.pin_bck = 13;
    spk_cfg.pin_ws = 0; // LRCK

    spk_cfg.stereo = true;
    spk_cfg.buzzer = false;
    spk_cfg.use_dac = false;
    spk_cfg.magnification = 16;
    M5.Speaker.config(spk_cfg);

    M5.Speaker.begin();
    M5.Speaker.tone(661, 1000); //Set the speaker to tone at 661Hz for 1000ms
    }

    void loop() {
    M5.update();
    delay(100);
    }