# Simple downconverting ADC

**URL:** <https://discuss.pynq.io/t/simple-downconverting-adc/6699>\
**Category:** Support\
**Created:** [March 1, 2024, 4:57pm UTC](https://discuss.pynq.io/t/simple-downconverting-adc/6699 "2024-03-01T16:57:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodolfocarobene](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rodolfocarobene/32/5659_2.png) [@rodolfocarobene](https://discuss.pynq.io/u/rodolfocarobene)\
**Post date:** [March 1, 2024, 4:57pm UTC](https://discuss.pynq.io/t/simple-downconverting-adc/6699/1 "2024-03-01T16:57:54Z")

</div>

Hello!

I am currently a beginner of FPGA design and PYNQ.  
I wanted to activate a single ADC of a ZCU111 board and control the down conversion mixer (of the tile) from PYNQ, but I am having unexpected results.

To acquire from the ADC axi-stream, in order to add the tlast signal, I’m using the axis\_packet\_controller IP from strath-sdr/pynq\_nco with a little edit (I added a pass-through tready signal), but at this point I’m not sure anymore of the correctness of that.

When I try to acquire a signal from PYNQ, the code works, but I end up seeing a very noisy signal (or a signal convoluted with something else?) that is also not stable.  
I attach an example in the following picture (note that this is just the real component of the signal):

 ![noisy_signal](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/2/2a191d4597b0d5c2ad1cf5947aab759875d918e6.png)

The code for the acquisition is:

```auto
def acquire(channel=0, packetsize=4096):
        _recv_buffer = allocate(shape=(packetsize*2), dtype=np.int16)
        pk.packetsize = int(packetsize)
        pk.reset = 0
        dma.recvchannel.transfer(_recv_buffer)
        pk.enable = 1
        dma.recvchannel.wait()
        pk.enable = 0
        pk.reset = 1
        toti = list(_recv_buffer[0:packetsize*2][::2])
        totq= list(_recv_buffer[0:packetsize*2][1::2])
        
    return np.array(toti)/2**16, np.array(totq)/2**16

```

I have also another problem, I seem not able to change correctly the frequency of the mixer.  
I sent to the ADC a signal generated at 100 kHz and set the mixer frequency to 100 kHz (I believe):

```auto
adc = rfdc.adc_tiles[0].blocks[0]
adc.MixerSettings["Freq"] = 0.1 # MHz
adc.UpdateEvent(xrfdc.EVENT_MIXER)

```

Doing the fft of the acquired signal I expect to see a peak at 0 Hz and one at 200 kHz, however the two peaks are much closer and not at zero. It seems that setting freq=0.5 the left peak goes to zero, but why would that be?

Maybe I am misunderstanding the space between samples?  
Since I am acquiring at 2.0 GSPS and doing a x8 decimation, I a thought the samples were spaced of 1/(2e9 / 8) s. Am I wrong?

Thanks in advance for the help and sorry for the long question.  
If more files / info are needed I will do my best to provide them (at the moment I could not embed more than a single file)
