It's for a particular implementation of the DCX. What I have currently is an AV preamp that feeds the analogue inputs of the DCX, (not great gain structure for music but fine for movies and TV) and what I would like to do is use the SPDIF input on the DCX fed from a music server with a separate volume control. I'll use the input switching toggle on the DCX to drive relays so in AV mode the PGAs are bypassed, but in music mode the volume control is inline. That way I can just store two identical, ( or different! 🙂 ) programs in the crossover and not worry about setting output levels on the new volume control every time I want to use the system in AV mode.
Remote control would be nice, but I'm not too fussed about a LCD or even balance controls, as long as the PGAs all clock up and down at the same rate that will do the job adequately.
I suppose in an ideal world each channel would have programmable offsets for balancing outputs to differing sensitivity drivers so you can bypass the digital attenuation in the DCX, but I could live without that. I basically just want something cheap and simple that'll fit in a small external case, or even internally in my modded DCX.
Hi Al
From those that i understand your intention is to manage the volume level of 6 channels simultaneously. A 3 way stereo electronic x-over offers 3 outputs (Low-Mid-High) per channel, so total 6 outputs.
I don't know something about this DCX, but from those you refer i can perceive that its headroom is some small. Using 3 PGA2310, you could get same volume level and more gain at the same time.
To manage just the gain of the 3 PGAs, is very simple. There is no need for a big micro like this on the current project, a 18 pin device can do the job just fine. The only external part needed is the encoder, so 2 - 3 inputs. Outputs to manage 3 PGAs are the same: CS - SDI - SCLK. The program code will be very small.
Well, tell me if you have available a PIC programmer. In this case i could post you the program in HEX file. Then you will be able to test the program on actual project and you will notify me if there is need for any correction.
Hi Fotios, i'm paying a lot of attention to this thread having a strong need to build a source selector for my amplifier. Do you sell also some pcb's or publish some pdf to etch opur ouwn boards ?
Ps. It's possible to come to Thassos this june 😉
Ps. It's possible to come to Thassos this june 😉
Last Post
This is my last post in this already polluted thread, and i simply publish the last and definitive upgrade on which i am working. The preamplifier will have the shape appears in the block diagram. I am already working on the upgraded program and the microcontroller used is a PIC18F45K22. The display is also changed to 2 lines X 20 characters. Of course i will provide you again with all the necessary schematics and artworks to make your own PCBs and the program of microcontroller. I will also provide you with ready made PCBs for the analog part and the control board.
I ask your patience for few days.
We meet again in a new thread
Thank you.
This is my last post in this already polluted thread, and i simply publish the last and definitive upgrade on which i am working. The preamplifier will have the shape appears in the block diagram. I am already working on the upgraded program and the microcontroller used is a PIC18F45K22. The display is also changed to 2 lines X 20 characters. Of course i will provide you again with all the necessary schematics and artworks to make your own PCBs and the program of microcontroller. I will also provide you with ready made PCBs for the analog part and the control board.
I ask your patience for few days.
We meet again in a new thread
Thank you.
Attachments
Hi Fotios,
I am very interested in building this preamp. Has seen here Matrix Multimedia user forums • View topic - Hi-Fi audio preamplifier using Burr-Brown PGA2310 all the mighty work!
I was wondering do you have some PCB artwork or ready made PCBs fpr this project.
Thanks,
Alex
I am very interested in building this preamp. Has seen here Matrix Multimedia user forums • View topic - Hi-Fi audio preamplifier using Burr-Brown PGA2310 all the mighty work!
I was wondering do you have some PCB artwork or ready made PCBs fpr this project.
Thanks,
Alex
Just a quick question, would your PIC and s/w be capable of driving three daisy chained PGA chips? I'm looking for a 6ch volume control for a DCX crossover. I can design the rest of the circuitry and PCB, but as a non-programmer, it would be useful if I could use your expertise to bypass that stage of the process. 🙂
Or just use an Arduino? Code is already available. It's very easy to learn and change code. Upload code via USB. Loads of resources and examples on the net on how to add LCDs, switches etc. Cheap 🙂
It basically comes down to
1) Configuring the SPI registers for Tx rate and clock data transiston settings
2) Enable a Tx cycle by holding CS low
3) Loading the SPI Tx register with the first 8 bits, to transmit
4) Check for spi tx rwegister empty or done, reload next byte for Tx until you have shifted out all the data to the string of devices.
5) Lift cs high to latch the data into PGA registers
This is BASCOM code but consider it pseudo-code for an xmega
If you past you "C" I can take a look at it. Just make a simple test to Tx a frame out.
Happy new Year
Rick
1) Configuring the SPI registers for Tx rate and clock data transiston settings
2) Enable a Tx cycle by holding CS low
3) Loading the SPI Tx register with the first 8 bits, to transmit
4) Check for spi tx rwegister empty or done, reload next byte for Tx until you have shifted out all the data to the string of devices.
5) Lift cs high to latch the data into PGA registers
This is BASCOM code but consider it pseudo-code for an xmega
' XMEGA SPI MASTER
' xmega_spi_master.bas
' This example should be used with xmega_spi_slave.bas or with xmega_spi_slave_interrupts.bas
$regfile = "xm128a1def.dat"
$crystal = 32000000 '32MHz
$hwstack = 50
$swstack = 50
$framesize = 200
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
'-------------------CLOCK CONFIGURATION-----------------------------------------
Config Osc = Disabled , 32mhzosc = Enabled ', 32khzosc = Enabled '32MHz and 32KHz enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'CPU Clock = 32MHz
'Init and enable the DFLL (Digital Frequency Locked Loop) for automatic run-time calibration of the internal 32MHz Oscillator
Osc_dfllctrl = &B00000000 'The internal 32.768 KHz Oscillator is used for calibration
Set Dfllrc32m_ctrl.0 'Enable DFLL and autocalibration
'-------------------------------------------------------------------------------
Config Priority = Static , Vector = Application , Lo = Enabled 'Interrupt Setup
'---------------------CONFIGURE TIME, DATE AND RTC FOR SECOND TICK--------------
Config Date = Dmy , Separator = .
Config Clock = Soft , Rtc = 1khz_int32khz_rcosc 'Internal 32KHz
'COM Interface to PC (COM5 is PINE.6 and PINE.7)
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM5:" For Binary As #1
Config Porte.4 = Output 'Slave Select Pin
Set Porte.4
Dim Select_bit As Bit
Reset Select_bit 'We start with 0
'CONFIG SPI MASTER on Port E
Config Spie = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk32 , Data_order = Msb , Ss = None
Open "SPIE" For Binary As #10
Dim Array(10) As Byte
'Array(1) = incremented
Array(2) = 2
Array(3) = 3
Array(4) = 4
Array(5) = 5
Array(6) = 6
Array(7) = 7
Array(8) = 8
Array(9) = 9
Array(10) = 10
Const Start_of_frame = 111
Do
'Second Tick from RTC
If Rtc_intflags.1 = 1 Then
Set Rtc_intflags.1 'Clear the Flag
Incr Array(1)
'SEND 10 BYTE ARRAY TO SLAVE
Reset Porte.4 'Select Slave
Print #10 , Start_of_frame ; Array(1) , 10 'SEND Start Byte then ARRAY WITH 10 BYTES
Set Porte.4 'Deselect Slave
Print #1 , Array(1) 'Print B to Serial PC connection
End If
Loop
End 'end program
If you past you "C" I can take a look at it. Just make a simple test to Tx a frame out.
Happy new Year
Rick
Some specific PGA23xx code. I used the xmega PWM mode to create a sq wave, coupled through a cap, as my source to the PGA so that I did not need an external source.
I basically got to the point of getting the getting to read the encoder, display calc the dB setting and program one PGA chip. I did not get to the point of implementing balance and muti-channel operation but it is an extension of the basic low level code.
As part of the main loop
Encoder Interrupt code
Hope that you can make use of any of this stuff
Rick
I basically got to the point of getting the getting to read the encoder, display calc the dB setting and program one PGA chip. I did not get to the point of implementing balance and muti-channel operation but it is an extension of the basic low level code.
'CONFIG SPI MASTER on Port C
'PGA2311: MSB first, clocked on rising edge,R7..R0,L7..L0
'
' MOSI, PortC.5: Connect to PGA2311.3 (SDI)
' MISO, PortC.6: Not used
' SCK, PortC.7: Connect to PGA2311.6 (SCLK)
' CS, PortC.4: Connect to PGA2311.2 (~CS)
Config Portc.4 = Output
Pga_cs Alias Portc.4
Set Pga_cs 'Slave Select Pin, Connect to PGA2311-2 (CS), active low
'Dim Select_bit As Bit
'Portc_pin0ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
'Portc_pin1ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
'Portc_pin2ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
'Portc_pin3ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portc_pin4ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portc_pin5ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portc_pin7ctrl = &B10_011_010 ' slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk32 , Data_order = Msb , Ss = None
'Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk64 , Data_order = Msb , Ss = None
Open "SPIC" For Binary As #3
''''''''''''''''''
'Configure Port D'
''''''''''''''''''
Config Portd.0 = Output 'Output for PWM
'Use as a ~1KHz source for testing PGA2310
'Config Tcd0 Prescale = 8 , Wgmode = Pwm
' Select Clock Source for timer/counter0
Tcd0_ctrla = &B0000_0100 'DIV8 --> 32MHz/8 = 4MHz
'Call Tc0_configclocksource( "D" , 4) 'DIV8 --> 32MHz/8 = 4MHz timer clock
' <--TCC0_CCA->
' +-----------+ +
' | | |
'------+ +----------+
'
' <--------------------->
' Period = 1.02mSec(977Hz)
'
'SET Resolution of PWM (min. = &H0003 ...... max. = &HFFFF)
'Tcd0_per = &HFFFF 'Set Period = FFFF = 65535 --> 65535/4MHz = 16.38mSec(61Hz)
Tcd0_per = &H0FFF 'Set Period = FFF = 4095 --> 4095/4MHz = 1.02mSec(977Hz)
'Enable PWM Output
Tcd0_ctrlb = &B0001_0_011
' ^ ^
' ^ Waveform Generation Mode = Single Slope PWM
' Enable OD0A ---> PinD.0 for PWM Output
'Change TCD0_CCA (Duty Cycle)
Tcd0_cca = &H07FF '2047/4MHz = 0.512mSec
'Tcd0_cca = 32767 '32767/4MHz = 8.19mSec
'Tcd0_cca = 20000 '20000/4MHz = 5ms
'Tcd0_cca = 10000 '10000/4MHz = 2.5mSec
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Configure Port K; Used for Bourns encoders & PGA MUTE & ZCEN'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'PortK_dir = &B0000_0000 'If DIRn is written to one, pin is configured as an output pin.
Config Portk = Input
Config Portk.6 = Output 'PGA2311 Mute, active Low
Set Portk.6
Pga2311_mute Alias Portk.6
Dim Mute_state As Bit
Mute_state = 1
Config Portk.7 = Output 'PGA2311 ZEN, active High
Pga2311_zen Alias Portk.7
Reset Portk.7
Portk_pin0ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin1ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin2ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin3ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin4ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin5ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin6ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
Portk_pin7ctrl = &B00_011_010 ' no slew, no invert, Totempole, Pull-up (on input),Sense falling edge
'--PGA2311 volume control variables
Dim Volume As Integer
Dim Volume_old As Integer
Dim Volume_cntr As Integer
Dim Volume_sub As Integer
Dim Volume_frnt_left As Integer
Dim Volume_frnt_right As Integer
Dim Volume_side_left As Integer
Dim Volume_side_right As Integer
Dim Volume_rear_left As Integer
Dim Volume_rear_right As Integer
Dim Volume_max As Integer 'Gain (dB) = 31.5 - [0.5 * (255 - N)]
Volume_max = 212 '10dB
Dim Volume_count As Integer
Dim Volume_word As Word 'Word to be written to PGA2310/2320/2311
'Dim V_right As Byte , V_left As Byte
'Dim Volume As Word At V_right Overlay
Dim V_right As Byte At Volume_word Overlay
Dim V_left As Byte At Volume_word + 1 Overlay
Dim Volume_s As Single
Dim Volume_s_old As Single
'--Rotary encoder variables
Dim Encoder1 As Integer
Dim Encoder1old As Integer
Dim Code1 As Byte
Dim Pink_temp As Byte
Dim Code1old As Byte
Dim Code1_count As Byte 'use for encoders that
Code1_count = 0 'put out two pulses per revolution
Dim Encoder2 As Integer
Dim Encoder2old As Integer
Dim Code2 As Byte
Dim Code2old As Byte
'Dim Code2_count As Byte
'Code2_count = 0
Dim Encoder3 As Integer
Dim Encoder3old As Integer
Dim Code3 As Byte
Dim Code3old As Byte
'Start timer by selecting a clock source
Call Tc1_configclocksource( "C" , 2) 'DIV4 --> 32MHz/4 = 8MHz timer clock = 8.192ms interrupt
'sets the overflow interrupt level of Timer/Counter 1 Port C to LOW Level Interrupt
Call Tc1_setoverflowintlevel( "C" , 1)
'
'Start timer by selecting a clock source
'Tcf1_ctrla = &B0000_0110 'DIV1024 --> 32MHz/1024 = 15625Hz timer clock
Call Tc1_configclocksource( "F" , 6) 'Timer 1 Port F --> DIV1024
'Set period/TOP value = 1 Second in Timer 0 on Port C
'Call Tc1_setperiod( "F" , 655) '16MHz/1024 = 15625
'sets the overflow interrupt level of Timer/Counter 1 Port F to LOW Level Interrupt
Call Tc1_setoverflowintlevel( "F" , 1)
'*******Code from dspradio168.bas********
'Config Timer0 = Timer , Prescale = 8
'On Ovf0 Tim0_isr
'Enable Timer0
'Enable Interrupts
'****************************************
'----------------------------------Interrupts-----------------------------------
Config Priority = Static , Vector = Application , Lo = Enabled
On Tcc1_ovf Tcc1_ovf_isr 'Setup overflow interrupt for Timer C/Counter 1 and ISR
Enable Tcc1_ovf , Lo 'Enable overflow interrupt using LOW Priority
On Tcf1_ovf Second_tick_isr 'Setup overflow interrupt for Timer F/Counter 1 and ISR
Enable Tcf1_ovf , Lo 'Enable overflow interrupt using LOW Priority
Enable Interrupts
''''''''''''''''''''''
'Initialize variables'
''''''''''''''''''''''
'Volume = &HC0C0 'set PGA gain to 0dB, Gain (dB) = 31.5 - [0.5 * (255 - N)]
'V_right = 192
'V_left = 192
'V_max = 255
Volume = 192
Volume_count = 0
As part of the main loop
If Encoder2old <> Encoder2 Then 'Use for Volume/Balance Function
If Pga2311_mute = 1 Then '
Volume_count = Encoder2
Encoder2old = 0
Encoder2 = 0
Volume = Volume + Volume_count
'Volume_L = Volume_L + Volume_count
'Volume_R = Volume_R + Volume_count
Disable Interrupts
Encoder2old = Encoder2
Enable Interrupts
'If Volume_L > 212 Then Volume = 212
'If Volume_R > 212 Then Volume = 212
If Volume > Volume_max Then Volume = Volume_max 'Volume Limit, max 255
If Volume < 0 Then Volume = 0
'If Volume_L < 0 Then Volume_L = 0
'If Volume_R < 0 Then Volume_R = 0
Volume_s = Volume
Volume_s = 255 - Volume_s
Volume_s = Volume_s / 2
Volume_s = 31.5 - Volume_s '31.5 -(0.5 *(255 - N))
___lcde = 1
Locate 1 , 1
'Lcd "****************************************"
Lcd "Volume L = "
Locate 1 , 12
Lcd Fusing(volume_s , "#.#") ; " dB "
Locate 1 , 21
Lcd "R = "
Lcd Fusing(volume_s , "#.#") ; " dB"
'Dim Volume_word As Word
'Dim V_right As Byte At Volume_word Overlay
'Dim V_left As Byte At Volume_word + 1 Overlay
V_right = Volume 'Assemble word for PGA2311
V_left = Volume 'Need to add balance function
Reset Pga_cs 'Select SPI Slave
Print #3 , Volume_word 'Send 16 bits to PGA2310
Set Pga_cs 'Deselect SPI Slave
End If
End If
Encoder Interrupt code
Tcc1_ovf_isr:
'Set Second 'DEBUG
Code1 = Pink
'Pink_temp = Code1 "Not required!!
Code1 = Code1 And &B0000_0011
If Code1.1 < Code1old.1 Then
Incr Code1_count
If Code1_count = 2 Then
If Code1.0 = 1 Then Encoder1 = Encoder1 - 1
If Code1.0 = 0 Then Encoder1 = Encoder1 + 1
Code1_count = 0
End If
End If
Code1old = Code1
Code2 = Pink
Code2 = Pink And &B0000_1100
If Code2.3 < Code2old.3 Then
If Code2.2 = 1 Then Encoder2 = Encoder2 - 1
If Code2.2 = 0 Then Encoder2 = Encoder2 + 1
End If
Code2old = Code2
Code3 = Pink
Code3 = Pink And &B0011_0000
If Code3.5 < Code3old.5 Then
If Code3.4 = 1 Then Encoder3 = Encoder3 - 1
If Code3.4 = 0 Then Encoder3 = Encoder3 + 1
End If
Code3old = Code3
Return
Hope that you can make use of any of this stuff
Rick
- Status
- Not open for further replies.
- Home
- Source & Line
- Analog Line Level
- PGA2310 Line Preamplifier + Free Software