diff --git a/src/dev/codec_wm8731.cpp b/src/dev/codec_wm8731.cpp index 190a5aa09..ba6da4b70 100644 --- a/src/dev/codec_wm8731.cpp +++ b/src/dev/codec_wm8731.cpp @@ -77,12 +77,6 @@ enum CodecSettings CODEC_FORMAT_MASTER = 0x40, CODEC_FORMAT_SLAVE = 0x00, CODEC_FORMAT_INVERT_CLOCK = 0x80, - - CODEC_RATE_48K_48K = 0x00 << 2, - CODEC_RATE_8K_8K = 0x03 << 2, - CODEC_RATE_96K_96K = 0x07 << 2, - CODEC_RATE_32K_32K = 0x06 << 2, - CODEC_RATE_44K_44K = 0x08 << 2, }; Wm8731::Result Wm8731::Init(const Wm8731::Config &config, I2CHandle i2c) @@ -149,9 +143,14 @@ Wm8731::Result Wm8731::Init(const Wm8731::Config &config, I2CHandle i2c) if(res != Result::OK) return Result::ERR; - // samplerate - // TODO: add support for other samplerates - res = WriteControlRegister(CODEC_REG_SAMPLE_RATE, CODEC_RATE_48K_48K); + // The WM8731 is designed to run from a fixed rate master clock and it + // has its own clock rate conversion mechanisms to derive various sample + // rates from the fixed master clock. In Daisy however we use a variable + // rate master clock generated by the STM32 SAI peripheral so we do not + // want this extra rate conversion. By setting the WM8731 sample rate + // register to 0, we disable the WM8731's own internal sample rate + // conversion. + res = WriteControlRegister(CODEC_REG_SAMPLE_RATE, 0x00); if(res != Result::OK) return Result::ERR;