cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
user01
Newbie
Newbie
215 Views
Registered: ‎04-05-2021

Issue with UARTLlite loopback application - SDK 14.7

Hello,

I am trying to design a auto test module to test UART channels on my custom board with Virtex 4 FPGA in it. The plan was to test it by simple loopback as TX and RX will be externally shorted. Aim is to send send the status of this test and move further in execution. While trying to do this in microblaze system,  I have added a UartLite Controller in the MicroBlaze system. and exported the design in SDK (using release 14.7)

The segment of code written for this is as follows:

{
       u8 sendbyte = 0xA5;  
       u8 recbyte;

     XUartLite_SendByte(0x00040000, sendbyte); // sending single byte

    recbyte=XUartLite_RecvByte(0x00040000);

           if(recbyte == sendbyte)
           {
            print("\n Loopback sucessful \n");
           }

         else
          {
          print("\n Loopback NOT sucessful \n");
          }
  }

In this case, If TX and RX pins are externally connected, I could see the status of test performed. When they aren't connected, program execution doesn't go beyond  XUartLite_RecvByte instruction, as it is blocking in nature, it waits for data to be received. But as application demands, I should be receiving some test status and execution should be continued further. Hence, I  tried modifying above segment of code as follows :

{
       u8 sendbyte = 0xA5; 
       u8 recbyte;

     XUartLite_SendByte(0x00040000, sendbyte);

    if( !XUartLite_IsReceiveEmpty(0x00040000) )  // 0x00040000 is Base Address - checking for data in RX fifo
        //TRUE if the receiver is empty, FALSE if there is data present.
    {
      recbyte=XUartLite_RecvByte(0x00040000);

           if(recbyte == sendbyte)
           {
            print("\n Loopback sucessful \n");
           }

         else
          {
          print("\n Loopback NOT sucessful \n");
          }
     }
    else
     {
       print("\n No data received \n");
     }
}

The issue is, every time, with this logic, I am getting "No data received" even if the pins are externally connected, not able to figure out why. Your help, insights will be highly appreciated.

 Can you suggest any other way to do this?

Thanks in advance!

 

Tags (5)
0 Kudos
0 Replies