cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sha@hys
Explorer
Explorer
6,497 Views
Registered: ‎05-31-2015

SPI XSpi_SelfTest returning XST_REGISTER_ERROR

Hi ,

 

 I have configured microblaze in spartan 6 XC6SLX45 using xilinx XPS. Now I am using sdk to program master SPI (xps_spi 2.02)in microblaze that drive external slave. I checked the loopback mode working using self test. But the return status is XST_REGISTER_ERROR. Why would this happen and how would I solve it?? My code is :

 

#include <stdio.h>
#include "platform.h"
#include "xparameters.h"
#include <xspi.h>
#include <xspi_l.h>

#define SPI_DEVICE_ID XPAR_XPS_SPI_0_DEVICE_ID
#define SPI_SELECT 0x01


int SpiSelfTestExample(u16 DeviceId);

XSpi Spi;
int i=0;
void print(char *str);

int main()
{
init_platform();

while(i<10)
{
print("Hello World\n\r");
i++;

}

int Status;


Status = SpiSelfTestExample(SPI_DEVICE_ID);

return 0;
}

int SpiSelfTestExample(u16 DeviceId)
{
print("Entered the function");

int Status;
XSpi_Config *ConfigPtr; /* Pointer to Configuration data */

/*
* Initialize the SPI driver so that it is ready to use.
*/
ConfigPtr = XSpi_LookupConfig(DeviceId);
if (ConfigPtr == NULL) {
return XST_DEVICE_NOT_FOUND;
print("\nDevice not found");
}
else
print("\nThe device found");

Status = XSpi_CfgInitialize(&Spi, ConfigPtr,
ConfigPtr->BaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
print("\nDevice not configured");

}
else
print("\nDevice configured");

/*
* Perform a self-test to ensure that the hardware was built correctly
*/
Status = XSpi_SetOptions(&Spi, XSP_MASTER_OPTION);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
print("\nSPI not set as master");
}
else
{print("\nSPI set as master");}

Status = XSpi_SelfTest (&Spi);
if (Status == XST_SUCCESS)
print("\nSucess");
else if(Status == XST_REGISTER_ERROR)
print("\nRegister did not read or write properly");
else if(Status == XST_LOOPBACK_ERROR)
print("\nError in loopback");
else
print("\nAtleast function has returned");

return 0;


}

 

 

I have mapped SPI pins to gpio pins in FPGA. Please mention why this error occurs and how can I solve it. Thanks in advance.

0 Kudos
0 Replies