Can write, can't read with OPB_SPI 1.00e

Hello, I have a ComBlock 1200 (comblock.com) FPGA board with a Analog Devices AD9860 MxFE interface. I'm trying to get the SPI interface up and running to configure it.

Right now, I can write to any register. I've tested this by writing ramping levels to the aux DACs and watching the output on a scope. I also have the entire SPI bus on a scope, and everything looks good.

The problem is reads. Everything reads back 0. I've looked at the MISO signal on a scope, and it's there, and properly aligned. I've brought it out from the FPGA on a separate test point to verify that I didn't mess up the UCF - the signal is making it into the device. I even looked in FPGA editor, and the signal is getting all the way to the opb_spi block.

Note, I am using the manual select option. The MxFE doesn't like the SS line going high between bytes, so I have to wrap each transfer with a slaveselect call. This is the jist of what I'm doing:

Status = XSpi_SetOptions( &MxFE_SPI, XSP_MANUAL_SSELECT_OPTION | XSP_MASTER_OPTION); Status = XSpi_Start( &MxFE_SPI ); if( Status != XST_SUCCESS ){ xil_printf("->Error! Failed to configure MxFE SPI Interrupts.\n \r"); return XST_FAILURE; }

Status = XSpi_SetSlaveSelect( &MxFE_SPI, 0x1 ); Status = XSpi_Transfer( &MxFE_SPI, SPI_TxBuffer, SPI_RxBuffer, 2 ); if( Status != XST_SUCCESS ){ xil_printf("Whoops! SPI Failure.\n\r"); return XST_FAILURE; } Status = XSpi_SetSlaveSelect( &MxFE_SPI, 0x0 );

Note, both SPI_TxBuffer and SPI_RxBuffer are the same length as the FIFO depth, but most transfers are only 2 bytes (address & data). ADC reads (if they worked) would be three bytes (1 Address, 2 Data) When I try to raed, the entire SPI_RxBuffer is empty. (all values the same as their initialized values)

Also, the ISR does appear to be working. (Writes work fine, and I can see the interrupt signal on the scope)

What could I be doing wrong?

Reply to
radarman
Loading thread data ...

Problem solved. What I'm doing wrong is not waiting long enough. I didn't realize at first that the XSPI transfer function is non-blocking.

-Seth

Reply to
radarman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.