Skip to content

Instantly share code, notes, and snippets.

@rampadc
Created April 15, 2025 12:39
Show Gist options
  • Save rampadc/20f44485f70093d39fbdbf3eb5112f95 to your computer and use it in GitHub Desktop.
Save rampadc/20f44485f70093d39fbdbf3eb5112f95 to your computer and use it in GitHub Desktop.
Issue: headphone audio appearing in microphone recordings when sidetone is enabled?
# Power down LOL/LOR and HPL/HPR drivers
w 30 00 01
w 30 09 00
###############################################
# Software Reset
###############################################
#
# Select Page 0
w 30 00 00
#
# Initialize the device through software reset
w 30 01 01
#
# Delay 1 millisecond
d 1
#
###############################################
###############################################
# Clock Settings
# ---------------------------------------------
# The codec receives: MCLK = 11.2896 MHz,
# BLCK = 2.8224 MHz, WCLK = 44.1 kHz
###############################################
#
# Set clock settings for DAC
#
# Select Page 0
w 30 00 00
#
# NDAC = 1, MDAC = 2
w 30 0b 81 82
#
# Select Page 1
w 30 00 00
#
# 24-bit data
w 30 1B 20
#
# Set clock settings for ADC
#
# Select Page 0
w 30 00 00
#
# NADC = 1, MADC = 2
w 30 12 81 82
###############################################
###############################################
# Signal Processing settings
###############################################
###############################################
# DAC
###############################################
#
# Select Page 0
w 30 00 00
#
# Set the DAC Mode to PRB_P8
w 30 3c 08
#
###############################################
###############################################
# ADC
###############################################
#
# Select Page 0
w 30 00 00
#
# Set the ADC Mode to PRB_P1
w 30 3d 01
#
###############################################
###############################################
# Configure Power Supplies (Combined)
###############################################
# Select Page 1
w 30 00 01
# Charge Pump Peak Load Current selected
# Charge Pump Divider = 6, 333kHz
w 30 7c 06
# Disable weak AVDD, Charge Pump powered, source = int 8MHz OSC
w 30 01 0a # Combines weak AVDD disable and CP power from playback
# Enable Master Analog Power Control
w 30 02 00
# Force REF charging time to 40ms
w 30 7b 05
# Select ADC PTM_R4
w 30 3d 00 # From recording script
# Set the input powerup time to 3.1ms (for ADC)
w 30 47 32 # From recording script
# Wait for reference to power up
d 40
###############################################
# Playback Setup (From playback_high_perf.txt)
# + Sidetone Routing Changes
###############################################
# Select Page 1
w 30 00 01
# Route LDAC/RDAC AND MAL/MAR (Sidetone) to HPL/HPR
w 30 0c 0a 0a # *** MODIFIED FOR SIDETONE ***
# Route LDAC/RDAC to LOL/LOR (optional sidetone here too)
w 30 0e 08 08 # Unchanged, no sidetone to line out in TI's example
# Set Mixer Amplifier Volume for Sidetone Path
w 30 18 00 # MAL->HPL
w 30 19 00 # MAR->HPR Volume
# Select Page 0
w 30 00 00
# Power up LDAC/RDAC
w 30 3f d6
# Select Page 1
w 30 00 01
# GCHP Mode, DC Offset corr Enabled on present routing
w 30 7d 12
# Unmute HPL/HPR driver, 0dB Gain
w 30 10 00 00
# Power up HPL/HPR drivers AND Mixer Amplifiers
w 30 09 33 # *** MODIFIED FOR SIDETONE ***
# Select Page 0
w 30 00 00
# Unmute LDAC/RDAC
w 30 40 00
###############################################
# Recording Setup (From recording_mic_in3.txt)
###############################################
# Select Page 1
w 30 00 01
# Mic Bias enabled, Source = Avdd, 1.25V
w 30 33 40
# Route IN3L to LEFT_P with Rin = 10K
w 30 34 04
# Route CM1L to LEFT_M with Rin = 10K
w 30 36 40
# Route IN3R to RIGHT_P with Rin = 10K
w 30 37 04
# Route CM1R to RIGHT_M with Rin = 10K
w 30 39 40
# Set left and right MicPGA Gain = 0dB
w 30 3b 00 00
# Select Page 0
w 30 00 00
# Power up LADC/RADC
w 30 51 c0
# Unmute LADC/RADC
w 30 52 00
###############################################
###############################################
# Set MicPGA gain to 24dB to hear just enough SIDETONE
###############################################
#
w 30 00 01
w 30 3b 30
w 30 3c 30
###############################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment