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
147 Views
Registered: ‎09-16-2019

XSpi manually control chip select (SS) signal through C code (SDK)

Jump to solution

Hello,

I would like to manually control the slave select line for the Quad SPI peripheral at a certain point in my C code. In PG153 I have read that bit[7] of the SPICR register can be used to toggle the slave select. However, I do not see any examples on how to do this in C code. 

My Quad SPI is set up as follows in my C code:

 

/* normal mode AXI QUAD SPI Initialize */
	ConfigPtr_spi = XSpi_LookupConfig(XPAR_AXI_QUAD_SPI_0_DEVICE_ID);
	Status = XSpi_CfgInitialize(&Spi_AXI, ConfigPtr_spi, XPAR_AXI_QUAD_SPI_0_BASEADDR);
	Status = XSpi_SetOptions(&Spi_AXI, XSP_MASTER_OPTION  | XSP_MANUAL_SSELECT_OPTION |  XSP_CLK_PHASE_1_OPTION);
	XSpi_Start(&Spi_AXI);
	XSpi_SetSlaveSelect(&Spi_AXI, 0x01);
	XSpi_IntrGlobalDisable(&Spi_AXI);

I need to do this to meet the requirements for a device. It requires that after a read command is received, the chip select signal remains active until a certain number of bytes are read in without the chip select toggling. Using the  XSpi_Transfer() function, the chip select signal automatically toggles and I need to stop this from happening. 

 

Thank you 

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
73 Views
Registered: ‎04-09-2019

Re: XSpi manually control chip select (SS) signal through C code (SDK)

Jump to solution

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/spi/src/xspi.c

Line nummber 846 is used to deassert the CS once the transfer completed.

If you don`t want to deassert the CS please comment the same line and test.

Regards,

Venu

View solution in original post

0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
74 Views
Registered: ‎04-09-2019

Re: XSpi manually control chip select (SS) signal through C code (SDK)

Jump to solution

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/spi/src/xspi.c

Line nummber 846 is used to deassert the CS once the transfer completed.

If you don`t want to deassert the CS please comment the same line and test.

Regards,

Venu

View solution in original post

0 Kudos