cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
7,810 Views
Registered: ‎12-12-2013

Full PL configuration using PCAP

Jump to solution

Hello,

 

I am trying to fully program the PL using PCAP, the bitstream being stored into DDR (loaded with xmd).

However, when the code below is executed, everything looks fine (no errors), but the PL is not configured, the DONE led is off.

If there is a previously loaded bitstream on the board, it continues to work as before, which makes me think that the PCAP configuration process is not working properly for one reason or another.

 

XDcfg *XDcfg_Initialize(u16 DeviceId)
{
	XDcfg *Instance = malloc(sizeof *Instance);
	XDcfg_Config *Config = XDcfg_LookupConfig(DeviceId);
	XDcfg_CfgInitialize(Instance, Config, Config->BaseAddr);

	XDcfg_SetLockRegister(Instance, XDCFG_UNLOCK_DATA);

	// Enable and select PCAP interface for partial reconfiguration
	XDcfg_EnablePCAP(Instance);

	//Setting control register for PCAP mode
	XDcfg_SetControlRegister(Instance, XDCFG_CTRL_PCAP_MODE_MASK);

	return Instance;
}


int XDcfg_TransferBitfile(XDcfg *Instance, u32 StartAddress, u32 WordLength)
{
	int Status;
	volatile u32 IntrStsReg = 0;

	// Clear DMA and PCAP Done Interrupts
	XDcfg_IntrClear(Instance, (XDCFG_IXR_DMA_DONE_MASK | XDCFG_IXR_D_P_DONE_MASK));

	// Transfer bitstream from DDR into fabric in non secure mode
	Status = XDcfg_Transfer(Instance, (u32 *) StartAddress, WordLength, (u32 *) XDCFG_DMA_INVALID_ADDRESS, 0, XDCFG_NON_SECURE_PCAP_WRITE);
	if (Status != XST_SUCCESS)
		return Status;

	// Poll DMA Done Interrupt
	while ((IntrStsReg & XDCFG_IXR_DMA_DONE_MASK) != XDCFG_IXR_DMA_DONE_MASK)
		IntrStsReg = XDcfg_IntrGetStatus(Instance);

	// Poll PCAP Done Interrupt
	while ((IntrStsReg & XDCFG_IXR_D_P_DONE_MASK) != XDCFG_IXR_D_P_DONE_MASK)
		IntrStsReg = XDcfg_IntrGetStatus(Instance);

	return XST_SUCCESS;
}

int main()
{
    init_platform();

    print("Entering main...\n\r");

    // Initialize Device Configuration Interface
    XDcfg_0 = XDcfg_Initialize(XPAR_XDCFG_0_DEVICE_ID);

    // Transfer Bitfile using DEVCFG/PCAP
    int Status = XDcfg_TransferBitfile(XDcfg_0, ADDRESS, (BITFILE_LEN >> 2));
    if (Status != XST_SUCCESS) {
    	xil_printf("ERROR : FPGA configuration failed!\n\r\n\r");
    	exit(EXIT_FAILURE);
    }

    print("Exiting main...\n\r");
    return 0;
}

 

Any helping hints would be very appreciated.

Thanks

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Visitor
Visitor
9,971 Views
Registered: ‎12-12-2013

Re: Full PL configuration using PCAP

Jump to solution

I found the problem, when the bitstream is downloaded into DDR using xmd, it is needed to first put the processor into reset using:

XMD% rst -processor

 After doing this, the bitstream is loaded correctly in the C application.

View solution in original post

0 Kudos
8 Replies
Highlighted
Visitor
Visitor
9,972 Views
Registered: ‎12-12-2013

Re: Full PL configuration using PCAP

Jump to solution

I found the problem, when the bitstream is downloaded into DDR using xmd, it is needed to first put the processor into reset using:

XMD% rst -processor

 After doing this, the bitstream is loaded correctly in the C application.

View solution in original post

0 Kudos
Highlighted
Observer
Observer
7,650 Views
Registered: ‎05-25-2012

Re: Full PL configuration using PCAP

Jump to solution

facing the same problem..at first wrote the same function in a program and dumped it in qspi..now booted zynq in qspi mode and open xmd..then downlaod .bin in DDR but when dump is done..I loose control from serial port (usb-uart) again i have to press con in xmd then the PL get configured but again another .bit can't be loaded in DDR..

 

I have to .bit file for PL. I need my PS hall run will configure PL with this two .bit dynamically when needed? can anyone share the steps

0 Kudos
Highlighted
Adventurer
Adventurer
3,327 Views
Registered: ‎02-04-2016

Re: Full PL configuration using PCAP

Jump to solution

Hey,

I am getting segmentation fault when i do initialisation of xdevcfg driver. 

When i do  lookupconfig first, there is no problem.

 

XDcfg_Config *Config = XDcfg_LookupConfig(XPAR_XDCFG_0_DEVICE_ID);

But when I pass the base address and configuration pointer to initialisation function , I get the segmentation fault on zedboard . 

 

 

XDcfg_CfgInitialize(XDcfg_0, Config, Config->BaseAddr);

I have included the corresponding header file too.

 

 

#include <xdevcfg.h>

I have made node of xdevcfg in linux running on zedboard using 

 

mknod /dev/xdevcfg c 259 0 > /dev/null

 Can someone atleast do a random guess what the problem is? I thought I can access the xdevcfg driver functions from the user application by just adding the header file . Am I wrong?

I am a beginner at linux device drivers. Please help. Thanks in advance.

0 Kudos
Highlighted
Adventurer
Adventurer
3,313 Views
Registered: ‎02-04-2016

Re: Full PL configuration using PCAP

Jump to solution

What is the function init_platform() function you have called?

0 Kudos
Highlighted
Observer
Observer
2,868 Views
Registered: ‎03-16-2017

Re: Full PL configuration using PCAP

Jump to solution

hii all,

 

am also facing the same issue but am succesfully loaded the bitstream and stored in to flash,after configuring the PL though PCAP the GPIO writing was hanging.so anyone got the same issue please be need full.

 

thanks and regards

 

0 Kudos
Highlighted
Visitor
Visitor
2,102 Views
Registered: ‎09-03-2017

Re: Full PL configuration using PCAP

Jump to solution

hey @octavianmm,

 

I am also interested in using PCAP to configure PL from Linux on Zedboard. Can you share your C code with me? I have searched on the Internet and tried with some C code, but it had many errors and warnings when compiling.

Thank you very much.

0 Kudos
Highlighted
586 Views
Registered: ‎01-22-2019

Re: Full PL configuration using PCAP

Jump to solution

@gouthampare you sure XDcfg_0 is a pointer to an instance struct of type XDcfg? The Init function populates the instance, so it must have direct access to it...

0 Kudos
585 Views
Registered: ‎01-22-2019

Re: Full PL configuration using PCAP

Jump to solution

 

Make sure you have no JTAG cable open in Vivado. Apparently, it takes hold of PCAP and every transfer will simply not happen, without any errors. For us, closing any open server under the hardware manager solves the issues we had with PCAP not finishing.

 

vivado_hw_man.png
0 Kudos