UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer tarekeldeeb
Observer
7,683 Views
Registered: ‎01-05-2014

Interrupt-based XSpi slave causes stackoverflow

Hello,

 

For years I've been using AXI_SPI core with the provided driver for microblaze to send/rx commands and data to slave spi. AXI_SPI used was always in master, no problems arised.

 

Now I need to communicate a slave, I followed: 

c/Xilinx/14.4/ISE_DS/EDK/sw/XilinxProcessorIPLib/drivers/spi_v3_04_a/examples/xspi_slave_intr_example.c

 

Mainly those steps:

static XSpi SPI_IPC_Instance;
static XSpi_Config * SPI_IPC_ConfigPtr;
XSpi_Initialize(&SPI_IPC_Instance , XPAR_SPI_IPC_DEVICE_ID);
SPI_IPC_ConfigPtr = XSpi_LookupConfig(XPAR_SPI_IPC_DEVICE_ID);
ASSERT (SPI_IPC_ConfigPtr != NULL);
status = XSpi_CfgInitialize(&SPI_IPC_Instance, SPI_IPC_ConfigPtr,SPI_IPC_ConfigPtr->BaseAddress);
ASSERT( ( status == XST_SUCCESS ) );

/*Register Interrupts to FreeRTOS*/
status |= xPortInstallInterruptHandler( XPAR_INTERRUPT_CTRL_SPI_IPC_IP2INTC_IRPT_INTR,
XSpi_InterruptHandler, &SPI_IPC_Instance);
ASSERT( ( status == pdPASS ) );
vPortEnableInterrupt( XPAR_INTERRUPT_CTRL_SPI_IPC_IP2INTC_IRPT_INTR );
XSpi_SetStatusHandler(&SPI_IPC_Instance,&SPI_IPC_Instance,(XSpi_StatusHandler)SpiHandler);

/*Init buffers*/
//Bla..

status |= XSpi_SetOptions(&SPI_IPC_Instance, XSP_CLK_PHASE_1_OPTION | XSP_CLK_ACTIVE_LOW_OPTION);
status |= XSpi_Start(&SPI_IPC_Instance); //Enable interrupts as well
XSpi_IntrEnable(&SPI_IPC_Instance, XSP_INTR_TX_HALF_EMPTY_MASK);// removing this does not help.
 
//Start Receiving as a slave
status |= XSpi_Transfer(&SPI_IPC_Instance, ipc_tx_buff, ipc_rx_buff,4); //StackOverflow!!

Only if I changed the spi options to Master, the stack does NOT overflow!  

XSpi_SetOptions(&SPI_IPC_Instance,XSP_MASTER_OPTION); 

 For reference, I use driver spi_v3_04_a.

 

Any support will be appreciated.

0 Kudos
3 Replies
Scholar sampatd
Scholar
7,679 Views
Registered: ‎09-05-2011

Re: Interrupt-based XSpi slave causes stackoverflow

Is it possible for you to increase the stack?

 

You can specify the stack size in the linker script:

http://www.xilinx.com/support/documentation/sw_manuals/xilinx2015_2/SDK_Doc/SDK_references/sdk_u_linker_script_mod.html

0 Kudos
Observer tarekeldeeb
Observer
7,672 Views
Registered: ‎01-05-2014

Re: Interrupt-based XSpi slave causes stackoverflow

Thanks for the quick reply.

 

I increased the stack enormously to _STACK_SIZE=0x16000, same result.

 

I want to ensure that, just adding "XSP_MASTER_OPTION" before XSpi_Transfer(), does not cause the stack overflow. I think the driver is broken somewhere.

 

Regards,

 

0 Kudos
Visitor brown-jing
Visitor
7,607 Views
Registered: ‎11-04-2015

Re: Interrupt-based XSpi slave causes stackoverflow

Hi tarekel,

   Rencently I try to use a device added SPI core as a slave, but always failed. Can you show me your configuration of ports? Below attachments is mine.

   Thanks!

   For reference, I use driver spi_v2_00_b.

port.PNG
0 Kudos