cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
marlapraveen
Visitor
Visitor
651 Views
Registered: ‎07-15-2019

uartps loopback failing

Hi, I'm trying to loop back UART recived data and send it back.

But some bytes ar missed.

the c code is:

/******************************************************************************
*
* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/

/*
* helloworld.c: simple test application
*
* This application configures UART 16550 to baud rate 9600.
* PS7 UART (Zynq) is not initialized by this application, since
* bootrom/bsp configures it to baud rate 115200
*
* ------------------------------------------------
* | UART TYPE BAUD RATE |
* ------------------------------------------------
* uartns550 9600
* uartlite Configurable only in HW design
* ps7_uart 115200 (configured by bootrom/bsp)
*/

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xuartps.h"

#define NUM_OF_BYTE 1

XUartPs_Config *Config_0;
XUartPs Uart_PS_0;
XUartPs_Config *Config_1;
XUartPs Uart_PS_1;

int main()
{
init_platform();
int Status;
// int Status1;
u8 BufferPtr_tx[1]={0};
/*************************
* UART 1 initialization *
*************************/
Config_0 = XUartPs_LookupConfig(XPAR_XUARTPS_0_DEVICE_ID);
if (NULL == Config_0) {
return XST_FAILURE;
}
Status = XUartPs_CfgInitialize(&Uart_PS_0, Config_0, Config_0->BaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}

while(1){
Status = 0;
Status+=XUartPs_Recv(&Uart_PS_0, BufferPtr_tx, (NUM_OF_BYTE ));
if(Status>0)
{
XUartPs_Send(&Uart_PS_0, BufferPtr_tx, (NUM_OF_BYTE ));
}
}

cleanup_platform();
return 0;
}

 

the output and input text documents:

 

0 Kudos
7 Replies
venui
Moderator
Moderator
587 Views
Registered: ‎04-09-2019

Can you compare the data which you are receiving from the Uart in the logic itself, to understand the problem.

Regards,

Venu

 

 

0 Kudos
marlapraveen
Visitor
Visitor
564 Views
Registered: ‎07-15-2019

how to compare the data as its in megabytes. Is there any api for that.

0 Kudos
marlapraveen
Visitor
Visitor
561 Views
Registered: ‎07-15-2019

This time i'm adding 3 screen shots, look in to it and let me know why.

Capture2.PNG
Capture1.PNG
Capture.PNG
0 Kudos
venui
Moderator
Moderator
552 Views
Registered: ‎04-09-2019

Hi Praveen,

I already verified it and then only i suggested you to verify in the controller.

Step 1: Since you are sending a to z always keep the same in the code in an Array.

Step 2: Send the same pattren from the console and receive it in controller.

Step 3:compare the same what you are sending from the terminal with the internal data in the Array.

 

Regards,

Venu

0 Kudos
marlapraveen
Visitor
Visitor
530 Views
Registered: ‎07-15-2019

yes at that point its fine. all bytes but adding more logic between send to receive api data miss is more.
0 Kudos
venui
Moderator
Moderator
519 Views
Registered: ‎04-09-2019

Since we have a common FIFO for transmission and reception, are you stopping sending data from terminal to processor before read data from FIFO by processor (or) sending the data from the processor to terminal? So you should send the data from the terminal once sending the data from processor to terminal is completed.

marlapraveen
Visitor
Visitor
509 Views
Registered: ‎07-15-2019

Is there a way to control way to send data from terminal to PS.
0 Kudos