qspips: xqspips_dual_flash_stack_lqspi_example.c File Reference

| qspips Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xqspips_dual_flash_stack_lqspi_example.c File Reference

## Overview

This file contains a design example using the QSPI driver (XQspiPs) in Linear QSPI mode, with two serial Flash devices in stacked mode.

One flash s accessed at a time on a common bus by using separate selects. This example writes to the two flash memories in QSPI mode and reads the data back from the flash memories, in Linear QSPI mode. It is recommended to use Manual CS + Auto start for best performance.

The hardware which this example runs on, must have a serial Flash (Numonyx N25Q, Winbond W25Q, Spansion S25FL, ISSI IS25WP) for it to run. This example has been tested with the Numonyx Serial Flash (N25Q128) and IS25WP series flash parts.

Note

None.

     MODIFICATION HISTORY:

     Ver   Who Date     Changes

     2.02a hk  05/07/13 First release
           ms  04/05/17 Modified Comment lines in functions to
                        recognize it as documentation block and modified
                        filename tag to include the file in doxygen examples.
     3.5    tjs 07/16/18 Added support for low density ISSI flash parts.
                         Added FlashQuadEnable API to enable quad mode in flash.
                         Added FlashReadID API to read and identify the flash.

## Functions
void | FlashErase (XQspiPs *QspiPtr, u32 Address, u32 ByteCount)
| This function erases the sectors in the serial Flash connected to the QSPI interface. More...
void | FlashWrite (XQspiPs *QspiPtr, u32 Address, u32 ByteCount, u8 Command)
| This function writes to the serial Flash connected to the QSPI interface. More...
int | FlashReadID (void)
| This function reads serial FLASH ID connected to the SPI interface. More...
void | FlashQuadEnable (XQspiPs *QspiPtr)
| This function enables quad mode in the serial flash connected to the SPI interface. More...
int | DualStackExample (XQspiPs *QspiInstancePtr, u16 QspiDeviceId)
| The purpose of this function is to illustrate how to use the XQspiPs device driver with two Flash devices in Stacked mode. More...
int | main (void)
| Main function to call the QSPI Dual Stack example. More...

## Function Documentation

int DualStackExample | ( | XQspiPs * | QspiInstancePtr,
|  | u16 | QspiDeviceId
| ) |  |

The purpose of this function is to illustrate how to use the XQspiPs device driver with two Flash devices in Stacked mode.

This function writes data to the serial Flash in QSPI mode and reads data in Linear QSPI mode.

Parameters

  None. |

Returns
  XST_SUCCESS if successful, else XST_FAILURE.

Note
  None.

References XQspiPs_Config::BaseAddress, XQspiPs_Config::ConnectionMode, FlashErase(), FlashQuadEnable(), FlashReadID(), FlashWrite(), XQspiPs_CfgInitialize(), XQSPIPS_CLK_PRESCALE_8, XQSPIPS_FORCE_SSELECT_OPTION, XQSPIPS_HOLD_B_DRIVE_OPTION, XQspiPs_LookupConfig(), XQSPIPS_LQSPI_MODE_OPTION, XQspiPs_LqspiRead(), XQSPIPS_MANUAL_START_OPTION, XQspiPs_SelfTest(), XQspiPs_SetClkPrescaler(), XQspiPs_SetLqspiConfigReg, XQspiPs_SetOptions(), and XQspiPs_SetSlaveSelect().

Referenced by main().

void FlashErase | ( | XQspiPs * | QspiPtr,
|  | u32 | Address,
|  | u32 | ByteCount
| ) |  |

This function erases the sectors in the serial Flash connected to the QSPI interface.

Parameters

  QspiPtr | is a pointer to the QSPI driver component to use.
  Address | contains the address of the first sector which needs to be erased.
  ByteCount | contains the total size to be erased.

Returns
  None.

Note
  None.

void FlashQuadEnable | ( | XQspiPs * | QspiPtr | ) |

This function enables quad mode in the serial flash connected to the SPI interface.

Parameters

  QspiPtr | is a pointer to the QSPI driver component to use.

Returns
  None.

Note
  None.

int FlashReadID | ( | void |  | ) |

This function reads serial FLASH ID connected to the SPI interface.

Parameters

  None. |

Returns
  XST_SUCCESS if read id, otherwise XST_FAILURE.

Note
  None.

void FlashWrite | ( | XQspiPs * | QspiPtr,
|  | u32 | Address,
|  | u32 | ByteCount,
|  | u8 | Command
| ) |  |

This function writes to the serial Flash connected to the QSPI interface.

All the data put into the buffer must be in the same page of the device with page boundaries being on 256 byte boundaries.

Parameters

  QspiPtr | is a pointer to the QSPI driver component to use.
  Address | contains the address to write data to in the Flash.
  ByteCount | contains the number of bytes to write.
  Command | is the command used to write data to the flash. QSPI device supports only Page Program command to write data to the flash.

Returns
  None.

Note
  None.

int main | ( | void |  | ) |

Main function to call the QSPI Dual Stack example.

Parameters

  None |

Returns
  XST_SUCCESS if successful, otherwise XST_FAILURE.

Note
  None

References DualStackExample().