Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions TLV320DAC3100_Examples/TLV320_Tone_Arduino/TLV320_Tone_Arduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

Adafruit_TLV320DAC3100 codec; // Create codec object

#define pBCLK D9 // BITCLOCK - I2S clock
#define pWS D10 // LRCLOCK - Word select
#define pDOUT D11 // DATA - I2S data
#define pBCLK D9 // BITCLOCK - I2S clock
#define pWS D10 // LRCLOCK - Word select
#define pDOUT D11 // DATA - I2S data
#define pRESET 7 // RST - hardware reset (required for Pico 2W / RP2350)

// Create I2S port
I2S i2s(OUTPUT);
Expand All @@ -31,6 +32,14 @@ void setup() {

while (!Serial) delay(10);
Serial.println("\n\nTLV320DAC3100 Sine Tone Test");

// Hardware reset - required for Pico 2W (RP2350), harmless on Pico (RP2040)
pinMode(pRESET, OUTPUT);
digitalWrite(pRESET, LOW);
delay(100);
digitalWrite(pRESET, HIGH);
delay(100);

// Start I2C communication with codec
Serial.println("Initializing codec...");
if (!codec.begin()) {
Expand Down Expand Up @@ -92,7 +101,7 @@ void setup() {
!codec.setChannelVolume(true, 18)) { // Right DAC +0dB
Serial.println("Failed to configure DAC volume control!");
}


if (!codec.setChannelVolume(false, 12.0) ||
!codec.setChannelVolume(true, 12.0)) {
Expand All @@ -106,6 +115,13 @@ void setup() {
Serial.println("Failed to configure speaker output!");
}

// Headphone output
codec.configureHeadphoneDriver(true, true, TLV320_HP_COMMON_1_35V, false);
codec.setHPLVolume(true, 0);
codec.setHPRVolume(true, 0);
codec.configureHPL_PGA(9, true);
codec.configureHPR_PGA(9, true);

// Initialize I2S peripheral
Serial.println("Initializing I2S...");
i2s.setBCLK(pBCLK);
Expand Down
Loading