Post Go back to editing

Quad SPI settings

Hello everyone,

      The above design is for Standard SPI in IP mode is set to Standard. We are able to see data,SCK & SS in ILA as showned in above image.

The above design is for Quad SPI in IP mode is set to Quad. We are not able to see data in ILA as showned in above image.

Vitis code 
#include <stdio.h>
//#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h" /* XPAR parameters */
#include "xspi.h"
#include "sleep.h"
//#include "ps7_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
//#define SPI_C_SPI_MODE 0
//#define DualSPI_C_SPI_MODE 1
//#define QSPI_C_SPI_MODE 2

/**************************** 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;
}

 In IP data sheet 

1.C_SPI_MODE = 0 for Standard SPI 

2. C_SPI_MODE = 1 for Dual SPI

3. C_SPI_MODE = 2 for Quad SPI

We have done settings as per data sheet but we are not getting any data in ILA for Quad mode pls suggest us is there any other settings for Quad mode.

Thread Notes

  • Thank you for your inquiry.  You have posted in the wrong area.  I will need more information to move your post to the correct forum where an engineer will see it.  Can you provide additional information? Thank you.

  •   what ADI device are you trying to talk to?

    -Travis

  • Hello below there is details of ADI device.

    I am trying to Configuration this IC AD3551RBCPZ16 by using Quad SPI Write Operation with Single Data Rate. With Streaming Mode by using QuadSPI inbuilt IP from xilinx and configuring in Vitis code. We are able to do by Standard SPI mode but for QuadSPI there is no output in ILA. We have done all the settings. Quad SPI in IP mode is set to Quad and in Xparameters.h C_SPI_MODE is default set to 2. QSPI Mode Enable pin no 31 Digital pulledup set to 1. A high level enables quad SPI interface mode.

  • This is my code for Quad SPI.

    #include <stdio.h>
    #include "xil_printf.h"
    #include "xparameters.h" /* XPAR parameters */
    #include "sleep.h"
    #include "xqspips.h"
    #include "main.h"


    #define QSPI_DEVICE_ID XPAR_AXI_QUAD_SPI_0_DEVICE_ID
    //#define QSPI_DEVICE_ID XPAR_XQSPIPS_0_DEVICE_ID

    //#include "ps7_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.
    */


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


    /**************************** 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 QspiPolledExample(XQspiPs *QspiInstancePtr, u16 QspiDeviceId);


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

    /*
    * The instances to support the device drivers are global such that the
    * are initialized to zero each time the program runs.
    */
    static XQspiPs QspiInstance; /* 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)
    {

    int Status;

    /*
    * Run the Spi Polled example.
    */
    Status = QspiPolledExample(&QspiInstance, QSPI_DEVICE_ID);
    if (Status != XST_SUCCESS) {
    return XST_FAILURE;
    }

    return 0;
    }

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

    *
    ******************************************************************************/
    int QspiPolledExample(XQspiPs *QspiInstancePtr, u16 QspiDeviceId)
    {

    int Status;
    u8 *BufferPtr;
    XQspiPs_Config *QspiConfig; /* Pointer to Configuration data */

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

    Status = XQspiPs_CfgInitialize(QspiInstancePtr, QspiConfig,
    QspiConfig->BaseAddress);
    if (Status != XST_SUCCESS) {
    return XST_FAILURE;
    }


    Status = XQspiPs_SetOptions(QspiInstancePtr, XQSPIPS_MANUAL_START_OPTION |
    XQSPIPS_FORCE_SSELECT_OPTION |
    XQSPIPS_HOLD_B_DRIVE_OPTION);
    if (Status != XST_SUCCESS) {
    return XST_FAILURE;
    }


    /* Set the prescaler for QSPI clock*/
    XQspiPs_SetClkPrescaler(QspiInstancePtr, XQSPIPS_CLK_PRESCALE_8);

    /* Assert the FLASH chip select.*/
    // XQspiPs_SetSlaveSelect(QspiInstancePtr);

    //XQspiPs_Start(QspiInstancePtr);
    /*
    * Disable Global interrupt to use polled mode operation
    */
    //XQspiPs_IntrGlobalDisable(QspiInstancePtr);
    //xil_printf("%d",XSpi_GetStatusReg(QspiInstancePtr));

    // u8 WriteBuffer[BUFFER_SIZE]={0x03,0x01};
    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};
    //XQspiPs_SetSlaveSelect(QspiInstancePtr);
    /*
    * Transmit the data.
    */
    while(1)
    {
    XQspiPs_PolledTransfer(QspiInstancePtr, WriteBuffer, NULL, 4);
    XQspiPs_SetSlaveSelect(QspiInstancePtr);

    }

    print("\n success");
    return XST_SUCCESS;
    }

    We are unable to see the data in the ILA for Quad SPI.

  • Hi  ,

    Moved this thread to Precision DACs community. Hi  , could you look into this query on AD3551R?

    Best regards,
    Marco

  • There are two caveats with streaming mode:

    - By default, the chip is configured in decrementing address direction. This means that the controller has to start writing from the highest address.

    - DAC data registers can only be written in decrementing direction: MSB then LSB. The controller must issue the address of the MSB followed by two or three data byes. Note that the datasheet uses the LSB address to reference multi-byte registers.

    If the DAC is to be updated continuously in streaming mode, the loop mode register has to be configured so that the address counter loops back to the appropriate address.