UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
5,577 Views
Registered: ‎01-22-2015

PS and PL DDR access in linux

Hi All,

 

I'm accessing the PS DDR through HP ports in linux. I'm mapping the DDR address size using 'mmap'  and its working without any problem. The below code used for mapping the PS DDR in linux,

 

off_t dev_base1 = 0x20000000; //( PS DDR Address range 0x0000 0000 to 0x3FFF FFFF)

 

mapped_base1 = mmap(0, MAP_SIZE1, PROT_READ | PROT_WRITE, MAP_SHARED, memfd1, dev_base1 & ~MAP_MASK1);


if (mapped_base1 == (void *) -1)

{
printf("Can't map the memory1 to user space.\n");
exit(0);
}
printf("DDR mapped at address %p.\n", mapped_base1);

mapped_dev_base1 = mapped_base1 + (dev_base1 & MAP_MASK1);

 

 

Now in the same C- code I need to add the logic to map the PL DDR. I'm planing to do this as shown below to achieve this.

 

off_t  dev_base_PL = 0x80000000; //( PL DDR Address range 0x8000 0000 to 0xBFFF FFFF)

 

Then remaining steps will be the same as shown above for PS DDR. Will it work properly??

Now I have axi engine in PL and it has to fetch and write into PL DDR. I'm going to configure the start address to the axi dma engine as "0x80000006". So this is the PL DDR address and will it access the PL DDR ?

 

Please clear my doubts. Whether I'm trying to do correctly or not?

 

Thanks.

 

 

0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
5,573 Views
Registered: ‎08-01-2008

Re: PS and PL DDR access in linux

check these links
https://forums.xilinx.com/t5/Zynq-All-Programmable-SoC/Accessing-Linux-PS-DDR-memory-from-ZYNQ-via-ACP/td-p/444454

https://forums.xilinx.com/t5/Zynq-All-Programmable-SoC/How-to-transfer-data-from-DDR-to-PL-via-PS/td-p/543695
https://forums.xilinx.com/t5/Embedded-Processor-System-Design/Accessing-DDR-from-PL-on-Zynq/td-p/322173
Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
0 Kudos
Teacher muzaffer
Teacher
5,547 Views
Registered: ‎03-31-2012

Re: PS and PL DDR access in linux

PL axi master needs the physical address so the value of dev_base1 is what the axi master should use to access ddr from PL. For DDR access both PS and PL see the same physical address space.

Is dev_base_PL the address of the axi master's register space?
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Adventurer
Adventurer
5,468 Views
Registered: ‎01-22-2015

Re: PS and PL DDR access in linux

Hi  muzaffer,

 

The dev_base_PL is not the register space address. It's just the starting address of whole DDR address range so that we can access the DDR in linux i.e data write from SD card to DDR using logic in the linux C-code (file operation).

 

I have 5 AXI master interfaces (4-write masters and 1-read master) in the PL. Previously these all AXI masters connected to the HP ports to access the PS DDR, and it was working very well. 

 

 

Now, I changed the connection of these AXI masters to the MIG core in the PL to access DDR3 SODIMM memory (PL). For, this I have one interconnect (5s:1m) and this interconnect mater connected to the slave interface of MIG. Please see the image below contains the Address Editor from vivado.

 

I need to configure the starting address to all the AXI master to write/read from PL DDR. I have configured the address which are with in the range of 0x8000_0000 to 0xBFFF_FFFF. I did not do any change in the existing C-code which is running in the linux apart from the reg configs of address registers of these DMA engines.

 

These 4 AXI write masters are writing into the PL DDR but read is happening when these writes are done not concurrently i.e 

Decoder output are writing but display VDMA fetches the final frame which has done by decoder. decoder decoded around 2500 frames but VDMA fetches and displays 2500th frame only. so I'm suspecting read and write is not happening properly.

 

 

thanks,

 

Untitled.png
0 Kudos