Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

" _4FM_OpenDevice

_4FM_error_t _4FM_CALL _4FM_OpenDevice (_4FM_DeviceContext * ctx, const char *type, int devno);

Parameters:

ctx: the device context to operate on.
type: the type name of the device to open.
devno: the device number to open for the device specified by type.


_4FM_error_t _4FM_CALL _4FM_ReceiveData(_4FM_DeviceContext *ctx, void *buffer, unsigned long count);

Receive data from a 4FM family

Parameters:

ctx: the device context to operate on.
buffer : pointer to memory where to store data
count: number of bytes to receive


_4FM_error_t _4FM_CALL _4FM_SendData(_4FM_DeviceContext *ctx, void *buffer, unsigned long count);

Receive data from a 4FM family

Parameters:

ctx: the device context to operate on.
buffer : pointer to memory where to send data
count: number of bytes to send

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top