Read ADC raw data from custom overlay

I use PYNQ Z2 board.
I build custom overlay (not BASE OVERLAY) with xADC block inside.
How I can read the ADC value on pin A0, A1 (Adruino Analog pins) on Jupyter notebook (like the base overlay in the picture)?
Thank you.

1 Like

You need to load your overlay first.

from pynq import overlay
ol =Overlay(“your bit file”)

For more information , please read the doc

Thank you Xyin. I already load my custom overlay, but I dont know how to get the raw adc value.

1 Like

I do not know if there is an official xADC ip support in PYNQ library…
I use AXI Interface with MMIO to get the raw data.

In FPGA, use AXI to send the xADC value, and in PYNQ, use MMIO lib to get the AXI value, like this:

from pynq import Overlay
ol=Overlay('XXXX.bit') #load your own Overlay
from pynq import MMIO #Access AXI with MMIO
AXIbus_addr = ol.ip_dict['axi_bus']['phys_addr']  #you may need to change this to your own AXI IP
AXIbus_addrange = 128 #Address range
AXI_mmio = MMIO(AXIbus_addr, AXIbus_addrange) # Create MMIO object*4, 4) #3*4 is the offset address, set to your own address offset, 4 is read lenth

Thank you so much Xyin.
I will try it.

Dear Xyin,

I try to run this on my Jupyter notebook, but the value does not change.
I do not know whether I need to add some more IP blocks my design in Vivado? What block I need to add?
Could you help me more information.
Thank you so much.

Hello,I have the same question as you!!!
Have u solved the problem?
Or do u have any information that may be useful to solve this kind of problem?
Thanks a lot!