09-03-2015 06:59 AM
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:
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!
For reference, I use driver spi_v3_04_a.
Any support will be appreciated.
09-03-2015 07:08 AM
Is it possible for you to increase the stack?
You can specify the stack size in the linker script:
09-03-2015 07:39 AM
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.
11-04-2015 05:13 PM
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.
For reference, I use driver spi_v2_00_b.