Interfacing problem with PCIe data receive

Status
Not open for further replies.

syedshan

Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Activity points
5,134
Dear all,

Since I am using 3rd party fpga hardware(which utilizes xilinx V6 FPGA) for my design with PCIe communication.

They have defined their own API and dlls through which we can communicate with the program.
To receive and send data the statement they have defined are as follows as defined in their manual.


Now problem is as follows. When I tried a sample program of adder made in VHDL and operate through Visual C++ accordingly it works fine when : I first send data through _4FM_SendData and then receive the result through _4FM_ReceiveData

But When I only operate the _4FM_ReceiveData it should at least get some garbage value, but I am unable to recieve any data. Infact it says unable to communicate through the device.

Is there any idea fellows can share why and how the computer and the hardware commincate each other.
I have posted below the major parts of the code.

Code:
        // DMA ( Direct Memory Access ) implementation requires 4k aligned buffers in the memory.
	// we allocate both buffers.
	dma_buffer_in = (char *)_aligned_malloc(_MEMORY_SIZE, 4096);
	dma_buffer_out = (char *)_aligned_malloc(_MEMORY_SIZE, 4096);

	// We initialize the buffer with 0
	memset(dma_buffer_out, 0x00, _MEMORY_SIZE);

....
....

        // Send the data to the hardware using direct memory address operations
	api_status = _4FM_SendData(&dev_ctx, dma_buffer_out, _MEMORY_SIZE);
	if(api_status!=_4FM_OK) {
		printf("Could not send random data to the hardware device...\n");
		exit_handler(dma_buffer_in, dma_buffer_out, &dev_ctx);
	}

	// Receive the data from the hardware using direct memory address operations
	api_status = _4FM_ReceiveData(&dev_ctx, dma_buffer_in, _MEMORY_SIZE);
	if(api_status!=_4FM_OK) {
		printf("Could not receive random data from the hardware device...\n");
		exit_handler(dma_buffer_in, dma_buffer_out, &dev_ctx);
	}

Waiting for the reply.

Bests,
Shan
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…