求助:WM8978喇叭声音太小,用的是STM32的I2S主模式

2020-01-02 19:37发布

请教各位坛友,目前WM8978 L/R out2 BTL直推喇叭,出现声音过小问题,比蚊子声音稍微大点,手册介绍能达到1W,目前不知道哪出现问题
喇叭规格:8ohm
WM8978的电源:SPKVDD使用5V供电,其余3.3V
WM8978寄存器配置(目前只使用L/Rout2 直推喇叭,参考的是STM32 Radio),目前声音配置已经最大。

   codec_send(REG_SOFTWARE_RESET);

    // 1.5x boost power up sequence.
    // Mute all outputs.
    codec_send(REG_LOUT1_VOL | LOUT1MUTE);
    codec_send(REG_ROUT1_VOL | ROUT1MUTE);
    codec_send(REG_LOUT2_VOL | LOUT2MUTE);
    codec_send(REG_ROUT2_VOL | ROUT2MUTE);
    // Enable unused output chosen from L/ROUT2, OUT3 or OUT4.
    codec_send(REG_POWER_MANAGEMENT3 | OUT4EN);
    // Set BUFDCOPEN=1 and BUFIOEN=1 in register R1
    codec_send(REG_POWER_MANAGEMENT1 | BUFDCOPEN | BUFIOEN);
    // Set SPKBOOST=1 in register R49.
    codec_send(REG_OUTPUT | SPKBOOST);
    // Set VMIDSEL[1:0] to required value in register R1.
    codec_send(REG_POWER_MANAGEMENT1 | BUFDCOPEN | BUFIOEN | VMIDSEL_75K);
    // Set L/RMIXEN=1 and DACENL/R=1 in register R3.
    //codec_send(REG_POWER_MANAGEMENT3 | LMIXEN | RMIXEN | DACENL | DACENR);
                codec_send(REG_POWER_MANAGEMENT3 | DACENL | DACENR);
    // Set BIASEN=1 in register R1.
    codec_send(REG_POWER_MANAGEMENT1 | BUFDCOPEN | BUFIOEN | VMIDSEL_75K | BIASEN);
    // Set L/ROUT2EN=1 in register R3.
    codec_send(REG_POWER_MANAGEMENT3 | LMIXEN | RMIXEN | DACENL | DACENR | LOUT2EN | ROUT2EN);
                //codec_send(REG_POWER_MANAGEMENT3 | DACENL | DACENR | LOUT2EN | ROUT2EN);
    // Enable other mixers as required.
    // Enable other outputs as required.
    //codec_send(REG_POWER_MANAGEMENT2 | LOUT1EN | ROUT1EN | BOOSTENL | BOOSTENR | INPPGAENL | INPPGAENR);
                codec_send(REG_POWER_MANAGEMENT2 | BOOSTENL | BOOSTENR | INPPGAENL | INPPGAENR);
    // Digital inferface setup.
    codec_send(REG_AUDIO_INTERFACE | BCP_NORMAL | LRP_NORMAL | WL_16BITS | FMT_I2S);//FMT_PCM);//

    // PLL setup.
    // fs = 44.1KHz * 256fs = 11.2896MHz
    // F_PLL = 11.2896MHz * 4 * 2 = 90.3168MHz
    // R = 90.3168MHz / 12.288MHz = 7.35
    // PLL_N = 7
    // PLL_K = 0x59999A (0x5A5A5A for STM32's 44.117KHz fs generated from 72MHz clock)
    codec_send(REG_PLL_N | 7);
#if CODEC_MASTER_MODE
    codec_send(REG_PLL_K1 | 0x16);
    codec_send(REG_PLL_K2 | 0xCC);
    codec_send(REG_PLL_K3 | 0x19A);
#else
    codec_send(REG_PLL_K1 | 0x16);
    codec_send(REG_PLL_K2 | 0x12D);
    codec_send(REG_PLL_K3 | 0x5A);
#endif
    codec_send(REG_POWER_MANAGEMENT1 | BUFDCOPEN | BUFIOEN | VMIDSEL_75K | BIASEN | PLLEN);
    codec_send(r06);
               
    // Enable DAC 128x oversampling. R10
    codec_send(REG_DAC | DACOSR128);

    // Set LOUT2/ROUT2 in BTL operation.R43
    //codec_send(REG_BEEP | INVROUT2 | BEEPVOL_6DB | BEEPEN);
                codec_send(REG_BEEP | INVROUT2 );
               
    // Set output volume.R6.R7
    AudioVol_Set(99);
    SampleRate_Set(48000);
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。