cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
garengllc2
Observer
Observer
488 Views
Registered: ‎09-18-2020

AXI Quad SPI read clock stops

Jump to solution

I have microblaze hooked up to an AXI Quad SPI core.  I am doing a read of a chip's ID to verify that the connection is working, but I get 0x00 in return.  I've added an ILA to look at things, and I can see that the read request seems to be working OK, but the clock stops when I should be seeing a response, meaning that I don't clock out any data (hence the 0x0).  Why would the clock stop?

garengllc2_0-1607015898863.png

The gist of my approach to this portion of the code is:

//This piece is declared globally
//AXI-SPI instance and buffers
static XSpi PlSpiInstance;
u8 Spi_Wbuf[3];
u8 Spi_Rbuf[3];


//This piece is in main and passes
	Status = PlSpiInit();
	if (Status != XST_SUCCESS)
	{
		xil_printf("SPI failed to initialize\r\n");
		return XST_FAILURE;
	}
	else xil_printf("SPI Initialized\r\n");

////and further down in another function
	uint8_t temp = SPI_READ(0x00, 0x78, CS);
	xil_printf("ID is: %d\r\n",temp);


//PlSpiInit function
int PlSpiInit()
{
	XSpi_Config *PlSpiConfig;
	int Status;

	PlSpiConfig = XSpi_LookupConfig(AXI_SPI);
	if (NULL == PlSpiConfig) {
		return XST_FAILURE;
	}

	Status = XSpi_CfgInitialize(&PlSpiInstance, PlSpiConfig,
				       PlSpiConfig->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	Status = XSpi_SelfTest(&PlSpiInstance);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	XSpi_SetOptions(&PlSpiInstance, XSP_MASTER_OPTION | XSP_MANUAL_SSELECT_OPTION);

	XSpi_Start(&PlSpiInstance);

	XSpi_IntrGlobalDisable(&PlSpiInstance);

	return XST_SUCCESS;
}


//SPI_READ function
u8 SPI_READ(u8 addr1, u8 addr0, int CS)
{
	int Status = XST_SUCCESS;
	Spi_Wbuf[0] = 0x80|addr1; Spi_Wbuf[1] = addr0; Spi_Wbuf[2] = 0x00;

	Status = XSpi_SetSlaveSelect(&PlSpiInstance, CS);
	xil_printf("Status 0 is: %d\r\n",Status);
	Status = XSpi_Transfer(&PlSpiInstance, Spi_Wbuf, Spi_Rbuf, 3);
	xil_printf("Status 1 is: %d\r\n",Status);
	Status = XSpi_SetSlaveSelect(&PlSpiInstance, 0x0F);
	xil_printf("Status 2 is: %d\r\n",Status);

	return Spi_Rbuf[2];
}


Any idea why the clock is stopping?  I looked at the three status responses from the SPI_READ function and the first two are success and the third is barking about the 0xF, but that would be after the clock stops, so ignore that for now.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
garengllc2
Observer
Observer
214 Views
Registered: ‎09-18-2020

My issue ended up being that the Vadj on my eval board (which the FMC connecter was using) was disabled by default.  So ILA looked fine because the FPGA was functioning OK, the IO lines just weren't doing anything.

View solution in original post

3 Replies
warning_cao
Observer
Observer
463 Views
Registered: ‎06-06-2018

If you want to read three registers, you need to send three blank data (0x00) after sending the read command and the read address, so that there will be a clock on the bus and the rx_fifo can receive the data normally.

Snipaste_2020-12-04_09-34-11.png
warning_cao
Observer
Observer
461 Views
Registered: ‎06-06-2018
In addition, your code doesn't see the operation of sending the read command. It seems that you have a problem with the usage of the trafer function.
0 Kudos
garengllc2
Observer
Observer
215 Views
Registered: ‎09-18-2020

My issue ended up being that the Vadj on my eval board (which the FMC connecter was using) was disabled by default.  So ILA looked fine because the FPGA was functioning OK, the IO lines just weren't doing anything.

View solution in original post