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: 
Visitor densarmiento
Visitor
1,090 Views
Registered: ‎02-01-2017

How to sent buffer data?

Hello Expert,

 

Good day!


I am a newbie in hardware design(FPGA). right now we're interfacing between camera(OV0706) and zedboard using pmod RS485 as bridge. We created successfully the block design in vivado and generated bitstream file for SDK environment as input. Upon running in SDK environment. My objective is to sent a hexadecimal command and camera give a acknowledgement if the data sent is already receive.


Your response is highly appreciated!

Thank you and Godbless!

 

Best regards,
EV

 

Here's my code below;

 

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xstatus.h"
#include "ps7_init.h"
#include "xscugic.h"
#include "xparameters.h"
#include "xuartlite.h"

#define TEST_BUFFER_SIZE_SEND 5
#define TEST_BUFFER_SIZE_RECV 500
u8 SendBuffer[TEST_BUFFER_SIZE_SEND] = {56, 00, 36, 01, 00}; /* Buffer for Transmit Command */
u8 RecvBuffer[TEST_BUFFER_SIZE_RECV]; /* Buffer for Receiving Data */
XUartLite UartLite; /* Instance of the UartLite Device */
int UartLitePolledExample(u32 DeviceId)
{
int Status;
/*
* Initialize the UartLite driver so that it is ready to use.
*/
Status = XUartLite_Initialize(&UartLite, DeviceId);
if (Status != XST_SUCCESS) {
xil_printf("UARTLITE DRIVER FAILED");
return XST_FAILURE;
}
/*
* Perform a self-test to ensure that the hardware was built correctly.
*/
Status = XUartLite_SelfTest(&UartLite);
if (Status != XST_SUCCESS) {
xil_printf("SELF TEST FAILED");
return XST_FAILURE;
}
return XST_SUCCESS;
}
int main()
{
unsigned char Sent_Count;
unsigned int ReceivedCount = 0;
int sentloop = 0;
int index;
int i;
init_platform(); //INITIALIZE
ps7_post_config(); //ENABLE TO PL
UartLitePolledExample(XPAR_UARTLITE_0_DEVICE_ID); //ENABLE UARTLITE
xil_printf("Start Looping....\n");
for(index = 0; index < TEST_BUFFER_SIZE_SEND; index++){
SendBuffer[index] = SendBuffer[index];
xil_printf("Send ......[%d] = %u\n" ,sentloop,SendBuffer[index]);
sentloop++;
Sent_Count = XUartLite_Send(&UartLite,SendBuffer,TEST_BUFFER_SIZE_SEND);
xil_printf("Send Count... %u\n", Sent_Count);
}
if (Sent_Count != TEST_BUFFER_SIZE_SEND){
xil_printf("Sent Failed!");
return XST_FAILURE;
}
while(1) {
ReceivedCount = XUartLite_Recv(&UartLite,RecvBuffer,TEST_BUFFER_SIZE_RECV);
xil_printf("Received count %x\n", ReceivedCount);

for(i=0; i < ReceivedCount; i++)
{
xil_printf("Received Buffer[%d] = %x\n" ,ReceivedCount,RecvBuffer[i]);
}
}
cleanup_platform();
return XST_SUCCESS;
}

Vivado.png
Output.png
0 Kudos
2 Replies
Highlighted
Participant glennparaiso
Participant
1,034 Views
Registered: ‎10-11-2016

Re: How to sent buffer data?

Hi @Dhen,

I am also encountered the same problem, hoping that the more experience FPGA users in this forum can give us some enlightment on how to solve the issue.

Thanks.

Best regards,
glenn

0 Kudos
Visitor densarmiento
Visitor
989 Views
Registered: ‎02-01-2017

Re: How to sent buffer data?

Hello Expert, 

 

     Please! give me some of your expert advice with regards to my issues stated above.

 

 

Thank you and God bless!

0 Kudos