How to write data on hp0 fpd port

<Pynq 2.6, ZCU104, Vivado 2020.1>
I am trying to use memory mapped interface of axi video mixer to transfer the overlay picture. How to write the image data through hp0 port.
Could this code work?

from pynq import MMIO
PL = MMIO(base_input_address, 100000)
input_registers = PL.array[(base_input_address//4):(base_input_address//4)+3*64*64]
input_registers[:] = logo.ravel()



1 Like

Hi @mizan,

Cathal wrote a tutorial showing how to use the AXI4 master interfaces with a HLS IP

I don’t think your code will work, because the AXI4 interface you want to use should initiate the transfers.


My first actual try was setting the address register value through axi lite interface and transferring the image. It is not working. That’s why I wanted to try previously stated code.

logo = allocate(shape=(64, 64, 3), dtype=np.uint8, cacheable=True)
logo[:]= cv2.imread('flip.png')

But it doesn’t have any impact, the image is not transferring (not showing on overlay)

Did you start the IP?

yes, the Ip is working fine. I can see the overlay region as well on image.

I also notice that the IP only has access to 16MB of the DDR memory. You should change this, so the IP can access the full DDR range.

It is likely that the logo.physical_address it is outside of the range that the IP can access.


Actually, it was on full 2g when I have tried the first code. for later code, i have changed it. I will try again.

Go for the 4GB. Also check the value of logo.physical_address to see if it is within range.

2G is full ddr for zcu104. I have updated the bitstream and tried. Still same output. No image.
Just to show the example image.

Just to make sure, i am trying this code:

My current project has 8 overlays and the project is working fine with 8 vdma which output streams go to the video mixer. But I don’t want to add so much code and vdmas for the project. That’s why I wanted to switch to memory-mapped interface. If there is any other way it could be done, it would be helpful to know.

No, this is the only way it can be done. You need to pass the pointer to memory and then start the IP.

What value are you getting for logo.physical_address?

I would also suggest you try to reproduce Cathal’s tutorial. Your IP seems to be more complex as it has streams as well. Once you have establish that this methodology works in your board, you can start debugging your IP.

Other things to consider, is 0x240 the address of the pointer? How does your register_map look like?


It is not my ip. This video mixer IP from xilinx. At register 0x240 is memory-mapped address for layer 1 overlay according to the product guide.

That might work for hls IP, but i needed it for this IP. The process he applied i already have it in the project. To put the address, and change data according in the buffer later on. If there is other changes i would have tried.

What value are you getting for logo.physical_address?

It shows an address and I can read the image as well from that address. (5FC84000). It is different every run.


It shows an address and I can read the image as well from that address. (5FC84000). It is different every run.

Yes, this is expected.

Are you enabling the layer in the Layer Enable (0x0040) Register?

I haven’t used this IP before. You may need to review the documentation carefully and write the appropriate value to the necessary registers


I am using it for quite a long time now, but have not used the memory-mapped interface. Yes, I enabled the overlay that’s why the overlay is seen in the picture. I am using this IP, for multiple layers for other projects and the settings are okay, I am quite sure about it. There is not much complexity in the register value for this IP. For memory mapped there is only two registers are responsible, where i am using the first one only as i am using RGB image.

Can you please share how the IP is configured?

i share the complete code here:

from pynq import Overlay, allocate
from import VideoMode
import cv2
from matplotlib import pyplot as plt
import time
import numpy as np
overlay = Overlay('/home/xilinx/jupyter_notebooks/v_mix_mm.bit')
test_image = allocate(shape=(1080, 1920, 3), dtype=np.uint8, cacheable=True)
logo = allocate(shape=(64, 64, 3), dtype=np.uint8, cacheable=True)

test_image[:]= cv2.imread('test.bmp')

frameMode=VideoMode(1920, 1080, 24)
vdma = overlay.axi_vdma_0
vdma.readchannel.mode= frameMode
vdma.writechannel.mode= frameMode


vmixer= overlay.v_mix_0
logo = allocate(shape=(64,64,3), dtype=np.uint8)
logo[:]= cv2.imread('flip.png')
for i in range(10):
    frame2 = vdma.readchannel.readframe()

the vivado design only consists of videomixer, vdma, interrupt controller ip.

Can you provide a screenshot of the IP configuration in Vivado?

You mean for video mixer only? or others also?

Video mixer only

given then :wink: