cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
5,432 Views
Registered: ‎09-16-2014

SPI Interrupt not occuring

Jump to solution

Hi,

I'm not entirely sure, if this is the right section or it belongs to Intellectual Property Core section, if so, please move the topic.

This is my first project developing a microblaze based embedded system with EDK so far.

First of all here is my design:

The hardware component is a Xilinx Virtex 4 XC4VF20.
I'm using the XPS SPI IP-Core V2.02a in EDK and the spi v3_06_a driver in SDK. To be percise, I'm using two instances each: two IP Cores in EDK, xps_spi_0 and xps_spi_1 and in SDK the corresponding XSpi spiOut; XSpi spiIn; This design was chosen because the FPGA receives commands from a PC and also sends commands to other peripherals and therefore has to act as a slave and master.

The implemented C code is based on the interrupt examples included with the spi v3_06_a driver for SDK.

In the main() function the program waits for incomming commands and when they occur proceeds with other operations.

So here is my problem:

I'm currently sending SPI commands to the FPGA, but the necessary interrupt won't occur.

First I set a global variable to TRUE wich should be reset in the ISR. Then I call the Transfer function and wait until the ISR reseted TransferInProgress. See Code below: (//... means that there is code for other things)

 

 

TransferInProgress = TRUE;	//Set global var

ret = XSpi_Transfer(&spiIn,&txSpiC.dez,&rxSpiC.dez,1); //tx and rx buffers are unions, .dez is a u8 value.

//...

while (TransferInProgress);

//following lines for debugging only!
setLED(bZERO);
while(1);

Unfortunately the program waits forever. I can tell that because when the transfer would be finished I set the LEDs to zero and stop for debugging purposes.


My ISR looks like this:

 

 

void SpiHandlerIn(void *CallBackRef, int StatusEvent, unsigned int ByteCount)
{
	TransferInProgress = FALSE;

	if (StatusEvent != XST_SPI_TRANSFER_DONE) {
		/*
		 * Indicate the transfer on the SPI bus is no longer in
		 * progress.
		 */
		setLED(bTHREE);
		txSpiC.dez=255;
	}
}

Maybe there's something wrong with the initialisation? Here's my code, keep in mind, I have two instances:

 

// Connect instance 0
stat = XIntc_Connect(&InterruptController,XPAR_INTC_0_SPI_0_VEC_ID,(XInterruptHandler)XSpi_InterruptHandler,(void *)&spiOut);

//...

// Connect instance 1
stat = XIntc_Connect(&InterruptController,XPAR_INTC_0_SPI_1_VEC_ID,(XInterruptHandler)XSpi_InterruptHandler,(void *)&spiIn);

//...

XIntc_Start(&InterruptController, XIN_REAL_MODE);

/...

XIntc_Enable(&InterruptController, XPAR_INTC_0_SPI_0_VEC_ID);

XIntc_Enable(&InterruptController, XPAR_INTC_0_SPI_1_VEC_ID);

XSpi_SetStatusHandler(&spiOut,&spiOut,(XSpi_StatusHandler) SpiHandlerOut);

XSpi_SetStatusHandler(&spiIn,&spiIn,(XSpi_StatusHandler) SpiHandlerIn);

// Start SPI Instances
XSpi_Start(&spiOut);
XSpi_Start(&spiIn);

//...

microblaze_enable_interrupts();

 

Every help is highly appreciated!

 

Best regards

Stephan

0 Kudos
Reply
1 Solution

Accepted Solutions
Visitor
Visitor
9,027 Views
Registered: ‎09-16-2014

I figured it out. It was a stupid mistake, the Slave Select line was routed to the wrong Pin =D

View solution in original post

0 Kudos
Reply
2 Replies
Visitor
Visitor
9,028 Views
Registered: ‎09-16-2014

I figured it out. It was a stupid mistake, the Slave Select line was routed to the wrong Pin =D

View solution in original post

0 Kudos
Reply
519 Views
Registered: ‎09-26-2018

Hi,

I am working in EDK for the first time. Virtex 5 is the hardware used. XPS Serial Peripheral Interface (SPI) (v2.02a) is the SPI IP in edk. The connections are made for output direction, because spi in fpga is master. one master and one slave configuration is done. the problem is the driver software what i have written is not what i see in the simulation.

I tried connecting to tristate pins in the edk, it was not helpful.

Could you please help me out in solving the problem.

i have attached simulation screen shot also.

Thankyou,

Shreeranjani

 

spi_edk.PNG
Screenshot (17).png
0 Kudos
Reply