Hello, I am interfacing a Cmedia CM108B USB codec to a MAX98390 amp and I get no audio at all, and speaker + and - outputs do not toggle.
I am breadboarding this for now to validate the circuit before incorporating into an existing board design.
So the Windows demo SW and board works and DSM enabled sounds great! I generated a register list for 48 kHz sampling using DSM Sound Studio. Now to match up with the CM108B codec's I2S format (48 kHz, 16-bit data, 32 clocks per LRCLK) I modified the register values.
I am using a small MCU board to program the I2C registers. I verified that the I2C reads and writes are working correctly by verifying the written values, and also reading default register values. I am using a MOSFET style level translator to convert its 3.3V logic down to 1.8V. The MicroPython code is attached. Lines with # in front are commented out.
I've attached a protocol analyzer capture of the CM108B's I2S output into the MAX chip. I am only using BCLK, LRCLK and DIN signals into the MAX98390. I confirmed that it can run without the master clock by wiring the AUDINT3 and MAX board with jumper wires and only connecting these I2S signals (and I2C).
I am using a TXB0108B level translator to drop the 3.3V I2S from the CM108B to 1.8V for the MAX chip. Scope plots look good. Scope shows ground bounce (typical of breadboards), but the I2S signals are well within valid logic levels so should not be an issue.
I get no sound and no toggling of the speaker + and - outputs at all. I put the demo HW setup back using the AUDINT3 board and it works, so the HW is not damaged.
I've tried reading various fault registers and I don't see any warning of UVLO, overtemp, whatever.
- Any ideas on what could be wrong or things to try?
- Can you double check my registers, see if I have a wrong value or missing something?
- Can the MAX chip run with just the the bare 3 I2S signals?
- Any registers I can check to confirm that it's actually seeing the I2S data?
- Any registers I can check to see why it has no output (error or faults)
Thanks for your help! -Vince
# This MicroPython running on an RP2040 MCU board
# Configure the MAX98390 I2C registers for CM108B USB codec:
# 48 kHz sampling, 16-bit data, 32 clocks per LRCLK
from machine import Pin, I2C
i2c = I2C(1, scl=Pin(15), sda=Pin(14), freq=100_000)
lst = i2c.scan()
print(f"I2C devices found: {lst}")
#MAX_ADDR = 0x70
MAX_ADDR = 0x38 # Different addressing scheme, needs 0x70 right shifted 1 bit
dat = i2c.readfrom_mem(MAX_ADDR, 0x24FF, 1, addrsize=16)
print(f"MAX Rev ID: 0b{dat[0]:08b}")
DATA_48k = [
[0x2000, 0x00],
[0x2002, 0x00],
[0x2003, 0x00],
[0x2004, 0x00],
[0x2005, 0x00],
[0x2006, 0x1c],
[0x2007, 0x05],
[0x2008, 0x00],
[0x2009, 0x00],
[0x200a, 0x00],
[0x200b, 0xf0],
[0x200c, 0x00],
[0x200d, 0x00],
[0x200e, 0x00],
[0x200f, 0x00],
[0x2010, 0x00],
[0x2011, 0x01],
[0x2012, 0x6c],
[0x2014, 0x00],
[0x2015, 0x00],
[0x2016, 0x00],
[0x2017, 0x75],
[0x2018, 0x8c],
[0x2019, 0x08],
[0x201a, 0x55],
[0x201b, 0x03],
[0x201c, 0x00],
[0x201d, 0x03],
[0x201e, 0x00],
[0x201f, 0xfc],
[0x2020, 0xff],
[0x2021, 0x10],
[0x2022, 0x10],
[0x2023, 0x00],
#[0x2024, 0xc0], # Chan is 32 bits, I2S mode, data on BCLK rising, falling LRCLK=chan 0
[0x2024, 0x40], # Data is 16 bits ("must be programmed to be less than or equal to the channel length")
[0x2025, 0x1c], # BCLK clock source, 12.288MHz, Slave mode
#[0x2025, 0x14], # BCLK clock source, 11.2896MHz MCLK, Slave Mode
#[0x2026, 0x44],
[0x2026, 0x22], # 32 BCLK per LRCLK (must be 2x the data width)
[0x2027, 0x08], # 48 kHz PCM (LRCLK freq)
[0x202c, 0x00],
[0x202d, 0x00],
[0x202e, 0x00],
[0x202f, 0x00],
[0x2030, 0x00],
[0x2031, 0x00],
[0x2032, 0x00],
[0x2033, 0x00],
[0x2039, 0x0f],
[0x203a, 0x81],
[0x203b, 0x00],
[0x203c, 0x00],
[0x203d, 0x05],
[0x203e, 0x85],
[0x203f, 0x03],
[0x2040, 0xf7],
[0x2041, 0x1c],
[0x2042, 0x01],
[0x2043, 0x40],
[0x2044, 0x07],
[0x2045, 0x00],
[0x2046, 0x23],
[0x2047, 0x00],
[0x2048, 0x00],
[0x2049, 0x00],
[0x204a, 0x00],
[0x204b, 0x00],
[0x204c, 0x00],
[0x204d, 0x68],
[0x204e, 0x00],
[0x204f, 0x2a],
[0x2050, 0x2c],
[0x2051, 0x00],
[0x2052, 0x66],
[0x2053, 0x00],
[0x2054, 0x00],
[0x2055, 0x00],
[0x2056, 0x00],
[0x2057, 0x00],
[0x2058, 0x00],
[0x2059, 0x00],
[0x205a, 0x00],
[0x205b, 0x00],
[0x205c, 0x00],
[0x205d, 0x00],
[0x205e, 0x00],
[0x205f, 0x1f],
[0x2060, 0x00],
[0x2061, 0x00],
[0x2062, 0x00],
[0x2063, 0x00],
[0x2064, 0x00],
[0x2065, 0x00],
[0x2066, 0x00],
[0x2067, 0x00],
[0x2068, 0x00],
[0x2069, 0x00],
[0x206a, 0x00],
[0x206b, 0x00],
[0x206c, 0x00],
[0x206d, 0x00],
[0x206e, 0x00],
[0x206f, 0x00],
[0x2070, 0x00],
[0x2071, 0x00],
[0x2072, 0x00],
[0x2073, 0x00],
[0x2074, 0x00],
[0x2075, 0x00],
[0x2076, 0x0e],
[0x2077, 0x84],
[0x2078, 0x07],
[0x2079, 0x07],
[0x207a, 0x01],
[0x207b, 0x00],
[0x207c, 0x46],
[0x207d, 0x2b],
[0x207e, 0x08],
[0x207f, 0x00],
[0x2080, 0x03],
[0x2081, 0x03],
[0x2082, 0x07],
[0x2083, 0x00],
[0x2084, 0x01],
[0x2090, 0x00],
[0x23b9, 0x00],
[0x23ba, 0xa0],
[0x23e0, 0x00],
[0x23e1, 0x00],
[0x23ff, 0x01]]
print("Writing MAX98390 registers")
n = 0
for reg, dat in DATA_48k:
n += 1
print(f" Reg: 0x{reg:04X}, Dat: 0x{dat:02X}", end="")
i2c.writeto_mem(MAX_ADDR, reg, dat.to_bytes(), addrsize=16)
print("\r", end="")
print(f"\n{n} registers written")
