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: 
Contributor
Contributor
900 Views
Registered: ‎07-25-2011

Spi PS slave: receive an unknown number of byte in interrupt mode

Hi all,

we have a problem on setting up SPI PS as slave, with interrupt driven receiving.

We are working on a Zynq 7z007s in bare metal.

 

Starting from the examples provided into the SDK package we succeded in receiving a known number of data less than 128byte.

 

It seems that there’s no chance to handle data transfer:

  • without knowing how many bytes have to be transferred
  • exceeding the FIFO size (128B) for a single transaction

 

We would like to use XSpiPs_Transfer  function passing not the known data length as parameter, but the maximum data length.

The interrupt should be risen when the slave select is deasserted (so when the transaction is over).

In this interrupt we would like to know how many bytes have been received.

 

In attachment you can find a part of the code we use.

 

Thanks,

Andrea Albano
bdSound srl www.bdsound.com
  
0 Kudos
2 Replies
Highlighted
Scholar ericv
Scholar
866 Views
Registered: ‎04-13-2015

Re: Spi PS slave: receive an unknown number of byte in interrupt mode

@andrea.albano

 

Andrea,

you could try to set the threshold level (# frames in the RX FIFO) at which the interrupt is triggered.

That's the value set in the TX_thres_regN register (check TRM's Appendix B).

Changing it may solve your issue.

 

The SPI FIFO thresholds are a bit  of a challenge because they raise interrupts upon crossing the threshold.

The interrupts are not kept raised as long as the contents of the FIFO is below (TX) or above (RX) the threshold as most controllers do.

To make things even more difficult, there are no way to know the number of frames in the FIFO.

 

If you want to diverge from the BSP, you can get our SPI driver by requesting it from

www.code-time.com

It handles all these shortcomings in the interrupt handler and a demo is supplied for the Zedboard.

It should be easy for you to set the driver up to operate on your target platform.

 

 

 

 

 

 

0 Kudos
Contributor
Contributor
843 Views
Registered: ‎07-25-2011

Re: Spi PS slave: receive an unknown number of byte in interrupt mode

Hi @ericv,
thanks, we will take this advice in consideration if we will not be able to solve the problem.
Andrea Albano
bdSound srl www.bdsound.com
  
0 Kudos