Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 27

Thread: SPI not working - Teensy 3.2

  1. #1

    SPI not working - Teensy 3.2

    Hi all,

    I am new with the teensy, I got 3.2, I am trying to control PGA2311 with the SPI channel.
    I followed the SPI lib guide page to make the conections (https://www.pjrc.com/teensy/td_libs_SPI.html)
    Teensy 8 (SS) to PGA2311 2 (CS)
    Teensy 11 (MOSI) to PGA2311 3 (SDI)
    Teensy 12 (MISO) to PGA2311 7 (SDO) optional..
    Teensy 13 (CLK) to PGA2311 6 (SCLK)
    I didnt got any change in the behavior of the gain in the PGA, so i decided to check with osciloscope if the teensy SPI channel works as it should.
    I found that the SS\CS leg drops down and up but i didnt found any bits sending from leg 11, and also didnt find any clock out from leg 13.
    maybe the scope configurations??
    i have connected the probe to the 13 leg, the ground is connected to the GND next to 0 leg.

    and this is my simple code:
    Code:
    #include <SPI.h>  // include the SPI library:
    const int slaveSelectPin = 8;
    
    void setup() {
      // set the slaveSelectPin as an output:
      pinMode (slaveSelectPin, OUTPUT);
      // initialize SPI:
      Serial.begin(9600);
    //  SPI.setSCK(13);       // SCK on pin 13
    //  SPI.setMOSI(11);
      SPI.begin(); 
    }
    
    void loop() {
     // take the SS pin low to select the chip:
      SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
      digitalWrite(slaveSelectPin,HIGH);
      delayMicroseconds(10);
      digitalWrite(slaveSelectPin,LOW);
      delayMicroseconds(10);
      SPI.transfer(0x55);
      SPI.transfer(0x55);
      // take the SS pin high to de-select the chip:
      digitalWrite(slaveSelectPin,HIGH);
      SPI.endTransaction(); 
      delay(200);
    }
    btw, what are those spi modes SPI_MODE0\1\2\3 ?

    I hope i did something wrong...
    Thanks a lot!
    Best
    Last edited by alonper; 01-09-2017 at 07:14 PM.

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,308
    "digitalWrite(slaveSelectPin,HIGH);"

    why are you calling this AFTER the transaction and before the LOW? move this line behind SPI.begin(); but after pinMode

    i would also presume you installed the latest teensyduino?

  3. #3
    i dowloaded the last teensyduino just today...

    regarding the code,
    if we leave the pga just for this moment,
    shouldnt i get clock and bits out from 13 and 11?
    11 is stable on about 3.3 v dc
    13 remains low , no change...

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,807
    Quote Originally Posted by alonper View Post
    shouldnt i get clock and bits out from 13 and 11?
    You certainly should see clock and data on those pins.

    11 is stable on about 3.3 v dc
    13 remains low , no change...
    Well, how are you measuring?

    I'm running your code on a Teensy 3.2 right now. Here's what I see on my oscilloscope:

    Click image for larger version. 

Name:	file.png 
Views:	116 
Size:	29.2 KB 
ID:	9385
    (click for full size)

    If you're viewing with a DC multimeter, or even an oscilloscope with trigger mode set to "auto", you'll end up observing the DC voltage that exists for 200 ms, rather than the activity which lasts only microseconds.

    If I adjust the horizontal scope (with my scope properly triggering in "normal" mode on the falling edge of pin 8), here's what I see:

    Click image for larger version. 

Name:	file.png 
Views:	139 
Size:	35.3 KB 
ID:	9386
    (click for full size)

    It's definitely working here. My guess is you're probably measuring with a multimeter that can't see such short bursts, or with a scope not properly configured to trigger on the waveform.

  5. #5
    Hi Paul, Thanks for your help.
    It seems that I didnt used the oscilloscope as I should... Now I got clock, and stream of data. So I assume the SPI channel is ok, but not I have another problem, with the analog circuit(I know its not about the teensy).
    I looked at the PGA2311 datasheet, there is the typical application Click image for larger version. 

Name:	typical.PNG 
Views:	494 
Size:	55.0 KB 
ID:	9634

    I'm just making lab test to check the functionality of this PGA.. So I didn't put the capacitors... and I feeded the device only from single power supply of 5VDC.. (my system is feeded by usb interface, so only 1 5VDC supply) and my signal is around the 2.5VDC. I hope its ok..
    Click image for larger version. 

Name:	typical2.png 
Views:	598 
Size:	44.7 KB 
ID:	9635

    I am trying to test this circuit by feeding the VINR(pin9) with (CH2, BLUE) sin of 1Khz, 200mv P-P with offset of +2.5VDC... but the signal measured on the output(pin 11) is 600mv DC, no sin, same signal even if I am changing the level through the SPI channel...
    Click image for larger version. 

Name:	Capture.jpg 
Views:	127 
Size:	70.5 KB 
ID:	9639


    Am I wrong? I cannot use the PGA2311 with single power supply?
    Any idea where am I wrong?

    Hope I explained myself right..
    Thanks a lot..

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,807
    Did you connect all the pins? What about Mute (pin 8)? Maybe post a photo showing how you've actually wired the signals?

    I have not used this PGA2311, but if you show the wiring and the actual code you're using (if not the same as above), maybe someone can notice what's wrong?

  7. #7
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,339
    I don't see anything in the specs to say you run a single-sided analog supply... since it's not working, maybe you can't?

    Re MUTE -- specs say is active LOW ... so you'd have to pull it HIGH I believe.

    Never heard of that chip... could be very useful for modular synth modules for uC control over analog signals.
    Last edited by oddson; 02-08-2017 at 06:19 PM.

  8. #8
    Hi Guys! Thanks a lot.
    I can upload a picture of my connections but its on a matrix and its hard to understand the connections..

    So I brought another 5V and connected to the VA- = -5VDC, and now i got amplified signal, and it looks ok, responding to changes from the SPI channel...So this is good news, but my system is gonna be feeded only by single 5V.
    Is there any way to double the single 5V to dual +5,-5VDC?

  9. #9
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,339
    I know guitar pedals use charge pumps to get negative supply when needed...


    Looks like http://www.ti.com/product/lm27761 would be ideal except for the non-hand-solder-friendly package... but http://www.ti.com/product/LM2776 looks OK.
    Last edited by oddson; 02-12-2017 at 04:04 PM.

  10. #10
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,308
    use a DPDT relay (even reed relays) to supply the negative 5v (the inputs are reversed on common), simplified reverse voltage

  11. #11
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    Check out the ICL7660 charge pump IC. It gives -5V at up to 45 mA, from a +5V supply. It needs only 2 capacitors in addition to the IC itself. You can get it in SOIC or DIP, 8 pin packages. Digikey has it, as would Mouser, Newark. I've used these many times and they work great.

  12. #12
    Thank you all!

    Quote Originally Posted by oddson View Post
    I known guitar pedals use charge pumps to get negative supply when needed...


    Looks like http://www.ti.com/product/lm27761 would be ideal except for the non-hand-solder-friendly package... but http://www.ti.com/product/LM2776 looks OK.
    I see that the package of the LM2776 available only in DBV package, Its good for the PCB that I will print later, but in this point i need something to work on the breadboard, do you know if there's any breakout board for this package? I tried to google DBV to DIP but nothing came out...

    Check out the ICL7660 charge pump IC. It gives -5V at up to 45 mA, from a +5V supply. It needs only 2 capacitors in addition to the IC itself. You can get it in SOIC or DIP, 8 pin packages. Digikey has it, as would Mouser, Newark. I've used these many times and they work great.
    I am afraid that current supply is below of the pga2311 requirements...How can I know its enough?
    And what is the Oscillator for?


    tonton81
    use a DPDT relay (even reed relays) to supply the negative 5v (the inputs are reversed on common), simplified reverse voltage
    Thanks, but i am afraid that this technic will cause noises in my system..


    Thanks a lot everybody!
    Last edited by alonper; 02-12-2017 at 12:51 PM.

  13. #13
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,339
    ADM8660ANZ is the only active status DIP part that gives 100mA that I could find... can't you just use a bench supply until you make your board...

  14. #14
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    Why do you need more than 45 ma for the PGA2311? It only draw a 10 ma quiescent, and unless you were using a very low load resistance on its output, it won't draw a whole lot more in operation. Exactly how much more I don't know, as the spec sheet doesn't specify, but it can't be more than 45 ma IMO. If you've measured the -5V load current in your circuit, and found that you actually need more than 45 ma, then please disregard my comments.
    You asked about the Oscillator. Inside the ICL7660 there is a high freq oscillator which is what drives the charge pump switches/capacitors, and gives you the -5V out.

  15. #15
    Quote Originally Posted by bmillier View Post
    Why do you need more than 45 ma for the PGA2311? It only draw a 10 ma quiescent, and unless you were using a very low load resistance on its output, it won't draw a whole lot more in operation. Exactly how much more I don't know, as the spec sheet doesn't specify, but it can't be more than 45 ma IMO. If you've measured the -5V load current in your circuit, and found that you actually need more than 45 ma, then please disregard my comments.
    You asked about the Oscillator. Inside the ICL7660 there is a high freq oscillator which is what drives the charge pump switches/capacitors, and gives you the -5V out.
    Dear bmiller, thanks for the explanation and the tips.
    I am checking for the ICL7660 and I see that there are variety of types, all are DIP,

    INTERSIL - ICL7660CPAZ - IC, VOLT CONVERTER, 7660, DIP8
    INTERSIL - ICL7660ACPAZ - IC, CMOS VOLTAGE CONVERTER
    INTERSIL - ICL7660SCPAZ - IC, DC-DC CONVERTOR, PDIP-8
    MAXIM INTEGRATED PRODUCTS - ICL7660CPA+ - DC/DC, 1.5V TO 10VIN, ADJ, 8DIP
    MAXIM INTEGRATED PRODUCTS - ICL7660EPA+ - CHARGE PUMP, DOUBLER/INVERTING, DIP-8

    I am trying to understand in the spec but I dont have enough knowledge to understand the difference between those types (http://www.intersil.com/content/dam/...icl7660s-a.pdf)

    Which one of those I need to order?

  16. #16
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    The ICL7660CPAZ will be fine, assuming you are feeding it with 5V. The A and S versions work over a much wider supply voltage of 1.2- 12 volts, which you don't need. They're all about the same price so you could go with the A and S versions, if you think you might want to use the chip, in future, on a wide range of voltages.All versions put out 45 mA, but at a that current the negative 5V will be a bit lower than 5.0V. I doubt that will affect your PGA. Since the PGA datasheet doesn't quote operating current, I can't predict how much less than -5 volts you will get from the 7660.
    FIgure 15 in the Intersil ICL7660 datasheet shows how to wire it up.

  17. #17
    Hi bmiller,

    I just brought the ICL7660CPAZ, it works ok (I need to check if the ripples wont affect on my signal...
    Anyway I got another problem that I am trying to handle,
    The signal from the PGA2311 looking good, but after adding the Teensy Audio Adapter the PGA getting crazy, much noises and problems, I guess it because the mutual pins of the SPI channel, but i cant understand how to solve this and make SPI channel with the PGA and in the same time working with the audio board..

    Thanks a lot for guiding me

  18. #18
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    @ alonper. I doubt that the ICL7660would produce ripple that would be a problem for normal audio- its internal oscillator is >100 KHz I believe (would vary a bit from manufacturer to another) so its ripple would be high in frequency and low in amplitude.
    I don't know what your circuit is trying to accomplish, so I can't help much on the noise problem. But, off-hand, I am wondering what the PGA2311 is doing for you? It does not provide any gain, just a pro-grade quality volume control with small steps i.e. attenuation. Its meant to work with signals in the 1 -2 volt input range- putting out a signal from zero up to the full value of the input. But, the Audio board can handle signals averaging a few hundred millivolts up to several volts, depending upon the input gain you select in your program for the Audio board( 16 discrete steps). This allows you to match various input signal levels to roughly the full-scale input value of the ADC, giving you the best signal/noise ratio. Then, if you need to adjust the volume in smooth. small steps, the Audio designer Mixer control can do that with a very fine resolution (16-bit). On top of all of that, the Line output level can be adjusted in 20 rough steps from 1V to 3V full scale. And, if you are using the headphone output, it has its own very high resolution output gain control which is distinct from the Line output volume level.
    So, I can't see the use case for the PGA2311- but I don't know what you are building so I can't be a fair judge on this. But, since it uses SPI to control it, you are going to be sending powerful (3.3V) digital (basically RF) signals from the SCK pin constantly, and other digital signals on the MOSI, MISO pins occasionally (almost constantly if you use an SPI TFT display, for example). Some of this digital signal will pass through the ground connection wire between your PGA2311 board and the Teensy/Audio board, and will be superimposed on your audio signal. That is probably the noise you are talking about- it will sound like a constant buzz at a frequency higher than the 60 Hz line frequency (50 Hz in Europe).
    I built a Teensy Digital guitar amplifer a while back using the Audio board. I added a small preamp for the guitar signal (1 transistor) and a 20Watt Power amplifier IC for the output. In the end, the only way I eliminated this buzz was to use 1 power supply for the preamp and power amp IC (with a zener diode to lower the voltage to the preamp) and a separate 5V power supply for the Teensy/Audio board/TFT display (basically this was a 5V USB charger that plugged directly into the Teensy and ran the Display/Audio board too). Doing it this way, I eliminated the ground loop that occurs when you have only 1 power supply for everything.
    You may eliminate your noise by doing something similar. In my case I did not need any negative voltage supply, like you do with the PGA2311. But, in your case you might end up with 1 5V supply for the Teensy/Audio board, another +5 volt supply for the PGA2311, with the ICL7660 (running from the PGA2311's 5V supply) to provide the -5 volts. Not a "neat" solution, but maybe the only way to go.
    These are very hard things to diagnose "from afar" - I spent a while solving my noise problem on the Teensy Digital guitar amplifier, and I had it right in front of me, and have excellent scopes etc. for measurement.

  19. #19
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,339
    ...Teensy Digital guitar amplifier...
    Oooh! - did you add any waveshaping or is it for a 'clean' sound (with time-effects perhaps?). I'd assume you can't just overdrive it...

    ...oh... and thanks for the part tip... that piece is even available as a DIP from my walk-in local electronics store... in stock (if not exactly cheap)
    Last edited by oddson; 03-09-2017 at 10:54 PM.

  20. #20
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    @ oddson- Yeh, I couldn't come up with a good overdrive algorithm on my own, at least not quickly. But I did write a vibrato routine, implemented tremolo easily enough, have a decent reverb using an external SRAM and multi-tapped delay with feedback.i repaired the audio flanger routine which didn't work properly at that time. I have a guitar tuner in there- using a modified version of the audio designer object ( which allows me to use it in the same program as my code, since the orig audio designer freq detection object needed >70% CPU, and couldn't be turned off, and my routines need 50-70% too.) The SGTL5000 DAP provides a 5 band para EQ and the AVC functions gives a (barely acceptable) compressor/soft limiter.
    My guitar playing friend, who I have introduced to Teensy, would dearly love to get the Teensy to do convolution cabinet simulation and true overdrive. But, that is a much taller order😀
    I have built Frank's (DD4WH??) Teensy SDR which uses a lot of DSP functions, some of which might work for the things my friend wants. RIght now though, I am patching Frank's SDR program to work with a fancier FT800 touchscreen display which I like, so I haven't dug into his FFT, iFFT, convolution/ filtering routines yet.
    I've also done a nice Hammond B3/Leslie speaker midi instrument ( there are others but I wrote mine from scratch ). Also the audio designer guitar object using Karplus-Strong is actually pretty good, and I wrote a strummed acoustic guitar midi instrument from that. No end to what you can do with this platform!
    Regards

  21. #21
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,339
    Quote Originally Posted by Wikipedia
    The most common fast convolution algorithms use fast Fourier transform (FFT) algorithms via the circular convolution theorem. Specifically, the circular convolution of two finite-length sequences is found by taking an FFT of each sequence, multiplying pointwise, and then performing an inverse FFT. Convolutions of the type defined above are then efficiently implemented using that technique in conjunction with zero-extension and/or discarding portions of the output. Other fast convolution algorithms, such as the Schönhage–Strassen algorithm or the Mersenne transform, use fast Fourier transforms in other rings.
    ...hmmm. I'll pass

    Waveshaping, and even passable tube-emulation, on the other hand are possible for mere mortals... but my C coding skills and knowledge of Paul's audio library just aren't there yet.

  22. #22
    Quote Originally Posted by bmillier View Post
    @ alonper. I doubt that the ICL7660would produce ripple that would be a problem for normal audio- its internal oscillator is >100 KHz I believe (would vary a bit from manufacturer to another) so its ripple would be high in frequency and low in amplitude.
    I got it.Sorry if its a stupid question but is the 100Khz oscillator wouldn't cause aliasing ? (the SGTL5000 sampling rate)
    Quote Originally Posted by bmillier View Post
    I am wondering what the PGA2311 is doing for you? It does not provide any gain, just a pro-grade quality volume control with small steps i.e. attenuation. Its meant to work with signals in the 1 -2 volt input range- putting out a signal from zero up to the full value of the input. But, the Audio board can handle signals averaging a few hundred millivolts up to several volts, depending upon the input gain you select in your program for the Audio board( 16 discrete steps). This allows you to match various input signal levels to roughly the full-scale input value of the ADC, giving you the best signal/noise ratio.
    My source is a piezo sensor, and it's p-p is around 100mv, it's not enough for the minimum...
    by the way, what is the meaning of "averaging" of signal? how can i check the average of my piezo? (I have oscilloscope)
    My assume was that the piezo not pushing enough voltage, Thats why I chose the PGA2311, and it works ok (it give me gain 10:1).

    Quote Originally Posted by bmillier View Post
    So, I can't see the use case for the PGA2311- but I don't know what you are building so I can't be a fair judge on this. But, since it uses SPI to control it, you are going to be sending powerful (3.3V) digital (basically RF) signals from the SCK pin constantly, and other digital signals on the MOSI, MISO pins occasionally (almost constantly if you use an SPI TFT display, for example). Some of this digital signal will pass through the ground connection wire between your PGA2311 board and the Teensy/Audio board, and will be superimposed on your audio signal. That is probably the noise you are talking about- it will sound like a constant buzz at a frequency higher than the 60 Hz line frequency (50 Hz in Europe).
    I built a Teensy Digital guitar amplifer a while back using the Audio board. I added a small preamp for the guitar signal (1 transistor) and a 20Watt Power amplifier IC for the output. In the end, the only way I eliminated this buzz was to use 1 power supply for the preamp and power amp IC (with a zener diode to lower the voltage to the preamp) and a separate 5V power supply for the Teensy/Audio board/TFT display (basically this was a 5V USB charger that plugged directly into the Teensy and ran the Display/Audio board too). Doing it this way, I eliminated the ground loop that occurs when you have only 1 power supply for everything.
    You may eliminate your noise by doing something similar. In my case I did not need any negative voltage supply, like you do with the PGA2311. But, in your case you might end up with 1 5V supply for the Teensy/Audio board, another +5 volt supply for the PGA2311, with the ICL7660 (running from the PGA2311's 5V supply) to provide the -5 volts. Not a "neat" solution, but maybe the only way to go.
    These are very hard things to diagnose "from afar" - I spent a while solving my noise problem on the Teensy Digital guitar amplifier, and I had it right in front of me, and have excellent scopes etc. for measurement.
    Thanks for all that information. I guess that i didn't take this in acount.
    I will explain my idea.
    I would like to stream the piezo signals (4) to the usb and to get it in MAX-MSP to analyze and manipulate the signals.
    So my main idea is to build a kind of audio interface with 4 interfaces with the teensy & audio board.
    The piezo sensor has big impedance so that's one more reason i coudln't connect them strait to the SGTL5000.. that's why I made a buffer with active filters (60hz-20Khz) and pass it to the PGA2311 to get some gain that will fit to the input range of the SGTL5000

    Regarding my noises, I found out that while measuring the signal where the audio adapter is removed, everything looks ok, but after adding the Audio Adapter the PGA2311 starts getting crazy, I think it's because of common pins that disturbing the PGA2311.. Do I need to change something? Can I? what pins are free and can operate for SPI channel with the PGA?

    these are my connections :
    Teensy 8 (SS) to PGA2311 2 (CS)
    Teensy 11 (MOSI) to PGA2311 3 (SDI)
    Teensy 12 (MISO) to PGA2311 7 (SDO)
    Teensy 13 (CLK) to PGA2311 6 (SCLK)



    Is there any git or blog that you share your work? look like you've got some gold there..
    Thanks a lot for the inspiration.

  23. #23
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    @alonper: I am sorry- I had a few things wrong:
    1) The ICL7660 has an internal Oscillator of 10K not 100K.It was another charge pump chip I have used that had the 100K rate. Still, I have used these frequently and there is virtually no ripple on the negative output, assuming you are using tantalum caps with the chip.
    2) The PGA2311 indeed has up to about 30 dB of voltage Gain at full volume (I.e.gain of X31). This is a lot of gain at full volume, even if your input filter just presents a high impedance to the piezo, and doesn't provide any gain. I assume you set the SGTL5000 input gain at mid scale (around 1.5 volts p-p) and crank the PGA2311 up until you get the correct levels.
    3) I didnt' mean "averaging" of the signal, I just meant that the average value , not peak value, that the SGTL handled was in the 200mv to 1 volt range. This is the RMS value of the signal.
    The PGA2311 needs 5V power for its logic section, as well as utilizing 5V logic levels. The Teensy tolerates 5V logic levels on its inputs, so inputs are OK. The Teensy only puts out 3.3V logic high levels, but the PGA2311 only needs minimum 2V for high level logic inputs, so that's OK too.
    There is nothing wrong with the pins you are using for SPI, nor any reason to think that changing them would help. I still think that you are getting your noise problems from a ground loop or possibly the fact that your SPI wires are long enough and unshielded so that they are feeding in some interference to either the PGA2311 input, or even the PGA2311 output/Audio boards input.
    Given that your piezos have 100 mv output p-p (when fed into a high impedance), and the SGTL5000 needs only 300 mv p-p on its most sensitive line input level setting, personally I would have designed my active band pass filter for
    1) high impedance input
    2) a gain of about 3 or 4 in the pass band.
    Then you would not need the pGA2311 at all, and might not need the -5V supply I guess. (I don't know how you are building your active filter using op-amps. If you are using single supply op amps then you wouldn't need -5V). You would not have to worry about the SPI lines and any noise they might contribute. The Mixer function in audio designer would handle the gain control function)

  24. #24
    @bmillier
    I designed an active filter in the following way :
    Click image for larger version. 

Name:	filter.jpg 
Views:	191 
Size:	67.3 KB 
ID:	9969

    I chose the PGA2311 because my piezo signals are inconsistent and I need to handle with bigger or smaller signals(depends on where the piezo sticked on)...
    Do you think that I should make the active filter to amp with 3\4 gain and let the SGTL5000 to handle with the different values?
    Anyway, if this is better way to avoid the SPI noises from the PGA step, should I add one more step that will make the gain? can you tell me what will be the resistor values?

    one more question :
    My active filter's op-amps feeded by 5V and 0, because my signal is center is 0v so i got negative values, that's why I pushed to signal to 2.5V ( before the first step).
    the 5V is taken from the 5V leg of the teensy,and the 0 is connected to the AGND and GND ( they are all the grounds are shorted)
    this could result noises to the signal? if it does, can I add some cap or other solution to handle with that noises?

    Thanks a lot.
    Last edited by alonper; 03-14-2017 at 05:01 PM.

  25. #25
    Senior Member bmillier's Avatar
    Join Date
    Apr 2016
    Location
    Halifax, N.S. Canada
    Posts
    187
    @alonper. Following is a mod you can make to your buffer/filter. I am just showing the part of the input stage that is DIFFERENT.
    Click image for larger version. 

Name:	capture1.PNG 
Views:	194 
Size:	4.0 KB 
ID:	9971

    This will give you a gain of between 1 and 6, depending upon the pot value.That should be enough to make up for the loss of the PGA2311's gain, and you can get a lot of volume control from within the SGTL5000- via program control. If you still have noise problems with the PGA2311 gone, then you might need some more filtering for this preamp section's power supply. Putting a 10 ohm resistor in series with the 5V line supplying power from the Teensy, and then adding a 50 -100uf electrolytic capacitor is one thing to try. Also add a 0.1 uf capacitor from the preamp's 5V line to ground.
    If none of this works well enough, you should try a separate 5V supply just for the preamp/filter (to avoid ground loops)
    This said, I hesitate to offer advice on a circuit that I have not built myself, and/or cannot physically test. I was pretty confident in the advice about the ICL7660 charge pump for the -5V supply for PGA2311, as I've used that part many times.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •