Hi.
I've been trying to use a Teensy Audio Adapter with a Raspberry Pi 3. It's still 3.3 V, and all of the communication protocols are present.
I can send a master clock from a GPIO pin as I explain here:
https://www.raspberrypi.org/forums/viewtopic.php?p=957996#p957996
And then I see 0a on running
If I turn off that GPIO clock, that 0a disappears, so this much appears to be working.
If I run
I get a list of supposed registers:
0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
00: 11a0 0000 0000 0000 0000 0000 0000 0000
08: 0000 0000 0000 0000 0000 0000 0000 0000
10: 0000 0000 0000 0000 0000 0000 0000 0000
.... and so on, all 0000 except the first one. If I then write OR read any of the registers, i2cdump returns the exact same list, but with different, changing values for address 00.
I suspect something is happening with the I2C address communication; I wonder if, instead of reading different registers, RPi's I2C (whether wiringpi, i2cset/get, pigpio, or smbus) is receiving a longer list of bytes and understanding 0x0000 as the register address for all of them???
I don't know how the Teensy Audio Adapter should work with I2C, but I can't imagine that this is not a mistake. Modify functions would be useless if you can't read values from the registers. Could anyone tell me, if you read individual addresses from the SGTL5000's register using I2C, whether you use Teensy or RPi to communicate with it, do you get this? Even after running my setup script (an adapted version of the Teensy SGTL5000 control driver startup), i2cdump shows me 1700 at address 0x0000 and the rest all 0000.
I've double and triple checked my wiring. I checked my soldering on the TAA pins. The board actually shows up at address 0x0a.
Here are the values I'm sending for the SGTL5000's configuration/initialization. As I said, most are from the Teensy Audio Library, but I'm using a different speed of master clock, so I activated PLL, etc.
CHIP_ANA_POWER = 0x0030
CHIP_LINREG_CTRL = 0x0026
CHIP_REF_CTRL = 0x0028
CHIP_LINE_OUT_CTRL = 0x002C
CHIP_SHORT_CTRL = 0x003C
CHIP_ANA_CTRL = 0x0024
CHIP_PLL_CTRL = 0x0032
CHIP_DIG_POWER = 0x0002
CHIP_LINE_OUT_VOL = 0x002E
CHIP_CLK_CTRL = 0x0004
CHIP_I2S_CTRL = 0x0006
CHIP_SSS_CTRL = 0x000A
CHIP_ADCDAC_CTRL = 0x000E
CHIP_DAC_VOL = 0x0010
CHIP_ANA_HP_CTRL = 0x0022
pi.i2c_write_word_data(h,CHIP_ANA_POWER, 0x4060) # VDDD is externally driven with 1.8V
pi.i2c_write_word_data(h,CHIP_LINREG_CTRL, 0x006C) # VDDA & VDDIO both over 3.1V
pi.i2c_write_word_data(h,CHIP_REF_CTRL, 0x01F2) # VAG=1.575, normal ramp, +12.5% bias current
pi.i2c_write_word_data(h,CHIP_LINE_OUT_CTRL, 0x0F22) # LO_VAGCNTRL=1.65V, OUT_CURRENT=0.54mA
pi.i2c_write_word_data(h,CHIP_SHORT_CTRL, 0x4446) # allow up to 125mA
pi.i2c_write_word_data(h,CHIP_ANA_CTRL, 0x0137) # enable zero cross detectors
pi.i2c_write_word_data(h,CHIP_ANA_POWER, 0x40FF) # power up: lineout, hp, adc, dac
pi.i2c_write_word_data(h,CHIP_DIG_POWER, 0x0073) # power up all digital stuff
# delay(400)
time.sleep(0.4)
pi.i2c_write_word_data(h,CHIP_LINE_OUT_VOL, 0x1D1D) # default approx 1.3 volts peak-to-peak
anap = 0x40FF | 0b0000010100000000
pi.i2c_write_word_data(h,CHIP_PLL_CTRL,0x9687)
pi.i2c_write_word_data(h,CHIP_CLK_CTRL,0x0007) # 44.1 kHz, 256*Fs
pi.i2c_write_word_data(h,CHIP_I2S_CTRL,0x01b0) # SCLK=32*Fs, 16bit, I2S format
pi.i2c_write_word_data(h,CHIP_ANA_POWER,anap)
pi.i2c_write_word_data(h,CHIP_SSS_CTRL, 0x0010) # ADC->I2S, I2S->DAC
pi.i2c_write_word_data(h,CHIP_ADCDAC_CTRL, 0x0000) # disable dac mute
pi.i2c_write_word_data(h,CHIP_DAC_VOL, 0x3C3C) # digital gain, 0dB
pi.i2c_write_word_data(h,CHIP_ANA_HP_CTRL, 0x1818) # set volume (lowest level)
pi.i2c_write_word_data(h,CHIP_ANA_CTRL, 0x0036) # enable zero cross detectors
Anyone see any problem with the values I'm sending or the order? Or is the problem just that my RPi and my TAA are communicating haphazardly?
-Chuckk
I've been trying to use a Teensy Audio Adapter with a Raspberry Pi 3. It's still 3.3 V, and all of the communication protocols are present.
I can send a master clock from a GPIO pin as I explain here:
https://www.raspberrypi.org/forums/viewtopic.php?p=957996#p957996
And then I see 0a on running
Code:
i2cdetect -y 1
If I run
Code:
i2cdump -y 1 0x0a w
0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f
00: 11a0 0000 0000 0000 0000 0000 0000 0000
08: 0000 0000 0000 0000 0000 0000 0000 0000
10: 0000 0000 0000 0000 0000 0000 0000 0000
.... and so on, all 0000 except the first one. If I then write OR read any of the registers, i2cdump returns the exact same list, but with different, changing values for address 00.
I suspect something is happening with the I2C address communication; I wonder if, instead of reading different registers, RPi's I2C (whether wiringpi, i2cset/get, pigpio, or smbus) is receiving a longer list of bytes and understanding 0x0000 as the register address for all of them???
I don't know how the Teensy Audio Adapter should work with I2C, but I can't imagine that this is not a mistake. Modify functions would be useless if you can't read values from the registers. Could anyone tell me, if you read individual addresses from the SGTL5000's register using I2C, whether you use Teensy or RPi to communicate with it, do you get this? Even after running my setup script (an adapted version of the Teensy SGTL5000 control driver startup), i2cdump shows me 1700 at address 0x0000 and the rest all 0000.
I've double and triple checked my wiring. I checked my soldering on the TAA pins. The board actually shows up at address 0x0a.
Here are the values I'm sending for the SGTL5000's configuration/initialization. As I said, most are from the Teensy Audio Library, but I'm using a different speed of master clock, so I activated PLL, etc.
CHIP_ANA_POWER = 0x0030
CHIP_LINREG_CTRL = 0x0026
CHIP_REF_CTRL = 0x0028
CHIP_LINE_OUT_CTRL = 0x002C
CHIP_SHORT_CTRL = 0x003C
CHIP_ANA_CTRL = 0x0024
CHIP_PLL_CTRL = 0x0032
CHIP_DIG_POWER = 0x0002
CHIP_LINE_OUT_VOL = 0x002E
CHIP_CLK_CTRL = 0x0004
CHIP_I2S_CTRL = 0x0006
CHIP_SSS_CTRL = 0x000A
CHIP_ADCDAC_CTRL = 0x000E
CHIP_DAC_VOL = 0x0010
CHIP_ANA_HP_CTRL = 0x0022
pi.i2c_write_word_data(h,CHIP_ANA_POWER, 0x4060) # VDDD is externally driven with 1.8V
pi.i2c_write_word_data(h,CHIP_LINREG_CTRL, 0x006C) # VDDA & VDDIO both over 3.1V
pi.i2c_write_word_data(h,CHIP_REF_CTRL, 0x01F2) # VAG=1.575, normal ramp, +12.5% bias current
pi.i2c_write_word_data(h,CHIP_LINE_OUT_CTRL, 0x0F22) # LO_VAGCNTRL=1.65V, OUT_CURRENT=0.54mA
pi.i2c_write_word_data(h,CHIP_SHORT_CTRL, 0x4446) # allow up to 125mA
pi.i2c_write_word_data(h,CHIP_ANA_CTRL, 0x0137) # enable zero cross detectors
pi.i2c_write_word_data(h,CHIP_ANA_POWER, 0x40FF) # power up: lineout, hp, adc, dac
pi.i2c_write_word_data(h,CHIP_DIG_POWER, 0x0073) # power up all digital stuff
# delay(400)
time.sleep(0.4)
pi.i2c_write_word_data(h,CHIP_LINE_OUT_VOL, 0x1D1D) # default approx 1.3 volts peak-to-peak
anap = 0x40FF | 0b0000010100000000
pi.i2c_write_word_data(h,CHIP_PLL_CTRL,0x9687)
pi.i2c_write_word_data(h,CHIP_CLK_CTRL,0x0007) # 44.1 kHz, 256*Fs
pi.i2c_write_word_data(h,CHIP_I2S_CTRL,0x01b0) # SCLK=32*Fs, 16bit, I2S format
pi.i2c_write_word_data(h,CHIP_ANA_POWER,anap)
pi.i2c_write_word_data(h,CHIP_SSS_CTRL, 0x0010) # ADC->I2S, I2S->DAC
pi.i2c_write_word_data(h,CHIP_ADCDAC_CTRL, 0x0000) # disable dac mute
pi.i2c_write_word_data(h,CHIP_DAC_VOL, 0x3C3C) # digital gain, 0dB
pi.i2c_write_word_data(h,CHIP_ANA_HP_CTRL, 0x1818) # set volume (lowest level)
pi.i2c_write_word_data(h,CHIP_ANA_CTRL, 0x0036) # enable zero cross detectors
Anyone see any problem with the values I'm sending or the order? Or is the problem just that my RPi and my TAA are communicating haphazardly?
-Chuckk