Jump to content
  • 0

How to sent data buffer?


ESV

Question

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 will give 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);
}
}
cleanup_platform();
return XST_SUCCESS;
}

Vivado.png

Output.png

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Hi @ESV,

I do not have a ov0706.  Do you have the OV0706's datasheet?  I would suggest to first make sure that you have correctly configured the camera. Most of the IC i have worked with require you to initialize and configure the IC before using it. Do you have example code that you have been working from? Please link datasheet and potential code you have.

thank you,

Jon

Link to comment
Share on other sites

Hello Jon,

Thanks for quickly response. I think camera is already configured, aside of configuration actually I used tx and rx pin only in OV0706.  Attached below is camera configuration and also the sample photo taken using OV0706Commtool.

 

Best regards,

ESV

Configure.png

Taken photo.png

Link to comment
Share on other sites

Hello Jon,

I just wanna share my setup to you attached photo below is my camera setup to zedboard I used rs485(half_duflex setup) between camera and zedboard from yellow camera wire connected to rs485(B input pin) and green wire from camera connected to rs485(A input pin). kindly check my setup if it's correct or not and please give some advice to solve my problem.

Thanks and God bless you!

ESV 

deviceSetup.png

pmodrs485_halfduplex.png

Link to comment
Share on other sites

Hello @jpeyron,

Thanks to the link you shared, I'll check that as my reference.

By the way. sorry for the reply. actually the objective of  my task is to send hexa command from board to the camera and camera give back acknowledgement to board that data is already received. 

thanks!

ESV

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...