Sampling with PGA advice | Cypress Semiconductor
Sampling with PGA advice
I'm having a problem while trying to sample some signals when using an AMUX, a PGA and the SAR ADC.
I need to sample many light sensors that can receive light from various groups of LEDs.
The LEDs are controlled by PWM in the same PSoC. Only one LED is on at a time. To multiplex the PWM I'm using AND gates conected to the PWM output and to a control register. I've also tried using a demultiplexer.
Anyway, the problem is happens when I do this:
PWM_Out_Reg_Write(LEDPowerOrder[selectedLED]); //Select PWM output pin.
PWM_LED_WriteCompare(10); //Configure LED power
AMux_1_FastSelect(0); //Select sensor input
PGA_1_SetGain(1); //Set PGA gain
sample = ADC_SAR_1_GetResult16();
PWM_Out_Reg_Write(LEDPowerOrder[selectedLED]); //Select second LED output
PWM_LED_WriteCompare(0); // Turn it off.
AMux_1_FastSelect(1); //Select second sensor
PGA_1_SetGain(1); //Set the gain of the PGA
sample2 = ADC_SAR_1_GetResult16();
Well after that, I graph both samples and the second sample still gets part of the signal of the first sample but with less amplitude even when I've turned off the LED. I also tried not using the PWM and just using the pin ON OFF directly and I get the same results. The sensor is fast enough to keep up with the LED and I have no capacitors in the ADC inputs.
So, I would like to ask what could be causing this or if I'm doing something wrong or missing something, since this is my first project with PSoC 5.
How much time should I wait for the signal to settle between multiplexor selections?
I have the PGA configured to high speed and the datasheets says that it has 7pF of input capacitance. The ADC is running at 100000 sps.
Thanks in advance!