cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rebelsequeira
Visitor
Visitor
766 Views
Registered: ‎09-30-2019

AXI Quad SPI issues

Jump to solution

I am trying to instantiate an AXI Quad SPI in the PL of the Ultrazed board. 

My constraints file is as below.

set_property PACKAGE_PIN AB7 [get_ports io0_t_0]
set_property PACKAGE_PIN AA7 [get_ports sck_t_0]
set_property PACKAGE_PIN AB8 [get_ports ss_t_0]
set_property PACKAGE_PIN Y7 [get_ports io1_t_0]
set_property BITSTREAM.GENERAL.UNCONSTRAINEDPINS Allow [current_design]

 

I noticed another thread with similar issues and I have followed everything he has done --> https://forums.xilinx.com/t5/Processor-System-Design/Coding-AXI-quad-SPI/td-p/742653

I see my chip select line go low on the scope. Although I do not see a clock pulse on the clock line. I am trying to understand what I am doing wrong? 

My code is as below. 

 

/***************************** Include Files *********************************/
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h" /* XPAR parameters */
#include "xspi.h"
#include "sleep.h"
//#include "psu_init.h"
/************************** Constant Definitions *****************************/


/*
* The following constants map to the XPAR parameters created in the
* xparameters.h file. They are defined here such that a user can easily
* change all the needed parameters in one place.
*/
#define SPI_DEVICE_ID XPAR_AXI_QUAD_SPI_0_DEVICE_ID

/*
* This is the size of the buffer to be transmitted/received in this example.
*/
#define BUFFER_SIZE 17


/**************************** Type Definitions *******************************/

/*
* The following data type is used to send and receive data on the SPI
* interface.
*/
typedef u8 DataBuffer[BUFFER_SIZE];


/***************** Macros (Inline Functions) Definitions *********************/


/************************** Function Prototypes ******************************/

int SpiPolledExample(XSpi *SpiInstancePtr, u16 SpiDeviceId);

/************************** Variable Definitions *****************************/

/*
* The instances to support the device drivers are global such that the
* are initialized to zero each time the program runs.
*/
static XSpi SpiInstance; /* The instance of the SPI device */

/*
* The following variables are used to read and write to the Spi device, they
* are global to avoid having large buffers on the stack.
*/
u8 ReadBuffer[BUFFER_SIZE];
u8 WriteBuffer[BUFFER_SIZE];


int main(void)
{
init_platform();
int Status;

/*
* Run the Spi Polled example.
*/
Status = SpiPolledExample(&SpiInstance, SPI_DEVICE_ID);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}

//return XST_SUCCESS;
cleanup_platform();
return 0;
}

/*****************************************************************************/
/**

*
******************************************************************************/
int SpiPolledExample(XSpi *SpiInstancePtr, u16 SpiDeviceId)
{
init_platform();
//psu_init() ;
int Status;
//u32 Count;
XSpi_Config *ConfigPtr; /* Pointer to Configuration data */

/*
* Initialize the SPI driver so that it is ready to use.
*/
ConfigPtr = XSpi_LookupConfig(SpiDeviceId);
if (ConfigPtr == NULL) {
return XST_DEVICE_NOT_FOUND;
}

Status = XSpi_CfgInitialize(SpiInstancePtr, ConfigPtr,
ConfigPtr->BaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}


Status = XSpi_SetOptions(SpiInstancePtr, XSP_MASTER_OPTION | XSP_MANUAL_SSELECT_OPTION);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}

XSpi_Start(SpiInstancePtr);
/*
* Disable Global interrupt to use polled mode operation
*/
XSpi_IntrGlobalDisable(SpiInstancePtr);
xil_printf("%d",XSpi_GetStatusReg(SpiInstancePtr));


u8 WriteBuffer[BUFFER_SIZE]={0xB3,0x03,0x1F,0x00,0x00,0x00,0xC0,0x53,0xA1,0x13,0x00,0x0A,0xCC,0xCC,0x31,0x8E,0x00};
// u8 ReadBuffer[BUFFER_SIZE]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
XSpi_SetSlaveSelect(SpiInstancePtr, 0x01);
/*
* Transmit the data.
*/
while(1)
{
XSpi_Transfer(SpiInstancePtr, WriteBuffer, NULL, BUFFER_SIZE);
}
/*
* Compare the data received with the data that was transmitted.
*/
/*for (Count = 0; Count < BUFFER_SIZE; Count++) {
xil_printf("\n read %d",ReadBuffer[Count]);
xil_printf("\n write %d",WriteBuffer[Count]);
if (WriteBuffer[Count] != ReadBuffer[Count]) {
print("fail");
return XST_FAILURE;
}
}*/
print("\n success");
return XST_SUCCESS;
}

2019-10-21 16_24_49-PMOD_QuadSPI - [C__Users_rebel.sequeira_Documents_dev_Ultrascale-Freertos_Vivado.png
0 Kudos
1 Solution

Accepted Solutions
rebelsequeira
Visitor
Visitor
680 Views
Registered: ‎09-30-2019

Turns out, i couldn't use the tri state pins. I used the input and output pins correctly and that seemed to fix the issue.

View solution in original post

1 Reply
rebelsequeira
Visitor
Visitor
681 Views
Registered: ‎09-30-2019

Turns out, i couldn't use the tri state pins. I used the input and output pins correctly and that seemed to fix the issue.

View solution in original post