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 creative1
Observer
110 Views
Registered: ‎04-05-2018

PS SPI Slave configuration issue on zynq7000

Hi,

I am trying to use PS PSI as a SLAVE, but due to some reason my code gets stuck at XSpiPs_PolledTransfer() API. It does not execute next line. But when i configured the same SPI as MASTER then it works properly, but doesnot work when i set it as a SLAVE.

The Options set for SPI SLAVE are as follows:

XSpiPs_SetOptions(&SpiTest,XSPIPS_CLK_PHASE_1_OPTION |XSPIPS_FORCE_SSELECT_OPTION);

XSpiPs_SetClkPrescaler(&SpiTestXSPIPS_CLK_PRESCALE_128);

Also i have one confusion, the API XSpiPs_PolledTransfer()  says it receive one byte for each byte of data transmission in MASTER Mode. Is the same true for SLAVE mode too? Then the MASTER and SLAVE both would be writing to the MOSI line at the same time. So is this right? How does SPI controller solve this conflict

Thank you.

 

0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
71 Views
Registered: ‎10-30-2017

Re: PS SPI Slave configuration issue on zynq7000

Hi @creative1 ,

The code that you are reffering is only applicable when SPI is in master mode. if SPI is configured in slave mode then it will hang if you use the same code. so the behavior is expected. Please use the below code when PS SPI is configured as Slave:

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/spi/examples/xspi_slave_polled_example.c

 

Best Regards,
Srikanth
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.

 

0 Kudos