Jump to content

Question

Posted

 

I have built a configuration around uBlaze processor which includes two separate SPI interfaces, one routed on the FMC connector and the other on the PMOD JA1. I have developed a code that works well with either SPI interface but, when I try to combine both of them together the system is crashing. I believe that my error has to do with the interrupt controller being initialized in both SPI instances but that's trivial to fix.

The interesting part is the following: When I use the PROG button and then upload the firmware both SPI interfaces get properly initialized and the crash happens once I try to do an SPI transfer. However, when I reset the board using the RESET button or try to re-upload the firmware without erasing the configuration first through the PROG button, the system fails at the first SPI initialization .

Similar to the examples for SPI I use the following code part to initialize the SPI system. 

In the case of the RESET fail, I noticed that the failure happens on the XSpi_LookupConfig(..) function which returns XST_DEVICE_IS_STARTED, and later on the XSpi_Stop(SpiPtr) returns XST_DEVICE_BUSY.

XSpi *SpiPtr;
SpiPtr = &m_spiInst;

XSpi_Config *ConfigPtr;
int Status;

ConfigPtr = XSpi_LookupConfig(m_deviceId);
if (ConfigPtr == NULL) {
  return XST_DEVICE_NOT_FOUND;
}

Status = XSpi_CfgInitialize(SpiPtr, ConfigPtr, ConfigPtr->BaseAddress);
if (Status == XST_DEVICE_IS_STARTED) {
  XSpi_Stop(SpiPtr);
  Status = XSpi_CfgInitialize(SpiPtr, ConfigPtr, ConfigPtr->BaseAddress);
}

if (Status != XST_SUCCESS) {
  return Status;
}

I can fix the initial bug and get my code running properly, but I cannot understand why the 2nd crash is happening and I really want to figure it out.

Is it possible that some of the AXI devices do not reset properly after a hardware reset? Any input or pointers would be really helpful since I am running out of ideas.

uBlaze_2xSPI.jpg

3 answers to this question

Recommended Posts

  • 0
Posted

Seems that replacing the XSpi_Stop(SpiPtr) with  XSpi_Reset(SpiPtr) solves the problem I have after resetting the board. But I don't understand why I need to reset the interface right after the board went through a hardware reset

  • 0
Posted

Easiest thing to do is write your own drivers. The Xilinx drivers are overcomplicated and buggy. Read the data sheet for the IP and use XilIn/Out calls to set/read registers over the AXIlite interface. If you then have trouble with the SPI IP, write your own. SPI is easy.

  • 0
Posted

@zeroC,

Don't forget that the FPGA uses the SPI chip for configuration.  As a result, by the time your FPGA logic gets access to it there's been a lot of accesses and/or configuration that have already taken place.

Dan

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...