I am a beginner using PYNQ-Z2. I want to transfer data between ddr and bram, so I tried to follow this example. But when I tried to use mmio to read the bram, the kernel will die.
from pynq import Overlay
from pynq import allocate
import numpy as np
ol = Overlay("./pl_ddr.bit")
CTRL_REG=0x00
SA_REG=0x18
DA_REG=0x20
BTT_REG=0x28
cdma=ol.axi_cdma_0.mmio
sys_in1 = 0x00000000 # zynq's addr
from pynq import MMIO
sys = MMIO(sys_in1,0x14)
bram = MMIO(0xC0000000,0x14)
sys.write(0x0,1)
cdma.write(CTRL_REG,0x04)
cdma.write(SA_REG,0x00000000)
cdma.write(DA_REG,0xC0000000)
cdma.write(BTT_REG,0x4)
print(sys.read(0x0000))
print(bram.read(0x0000)) #kernel will die
cdma.write(CTRL_REG,0x04)
cdma.write(SA_REG,0xC0000000)
cdma.write(DA_REG,0x00000004)
cdma.write(BTT_REG,0x4)
print(sys.read(0x0004))
And I expect the last result should be 1, but it is a random data. So the access to BRAM is definitely failing.
Here is my block design, thanks for helping.