Serial Memory

| Serial Memory

Serial Memory

## Overview

Provides functions for interacting with an external memory connected through its Single SPI/Dual SPI/Quad SPI/Octal SPI interface. The read operation can be performed in either blocking or non-blocking manner by calling the corresponding function while the write and erase operations are implemented as blocking functions. This library accepts the configuration generated using the QSPI Configurator tool. Note that PSoC™ 6 supports up to 4 memory slots on the same MemorySPI block.

## Features

- Supports asynchronous (non-blocking) read operation
- Implements thread-safety for use with multi-threaded RTOS environment using the abstraction-rtos library
- Accepts the configuration generated by the QSPI Configurator tool
- Supports Execute-in-Place (XIP) mode of operation
- Provides information about the external memory to the programming tool for it to be able to program the memory, for example, when user wants to place the code into the external memory for XIP operation.
- Allows for programming external memory if MTB_SERIAL_MEMORY_ENABLE_XIP_PROGRAM is defined when building the application. Note: This is not compatible with the PSoC™ 64 series of devices.

## Quick Start

1. Add #include "mtb_serial_memory.h"
2. Add `DEFINES=MTB_SERIAL_MEMORY_THREAD_SAFE` in the Makefile to enable thread-safety when used in a multi-threaded RTOS environment
3. Correctly initialize the SMIF driver via PDL calls. This is done by firstly calling Cy_SMIF_Init using the configurator structure generated by device configurator, then calling Cy_SMIF_SetDataSelect specifying how the data selection for the enabled chip select (this can be done several times for all enabled chip selects) and finally by calling Cy_SMIF_Enable.
4. Call mtb_serial_memory_setup passing in the needed information and specifying which chip select we want to set as active.

NOTE: If you delete the contents of the GeneratedSource directory inside the BSP, you must re-generate the memory configuration files cycfg_qspi_memslot.c/.h. To do this from inside the ModusToolbox™ IDE, open the QSPI Configurator tool from the Quick Panel and press Ctrl+S or click File > Save. If you open the tool outside the IDE, you need to first open the design.cyqspi file in the tool. To do this, click File > Import and then locate the file inside the BSP under config directory.

NOTE: For devices with no internal flash (eg:CAT1B device CYW20829), user needs to disable 'config data in flash' option in QSPI Configurator.

## Dependencies

- abstraction-rtos library if `DEFINES=MTB_SERIAL_MEMORY_THREAD_SAFE` is added in the Makefile

## More information

- API Reference Guide
- Cypress Semiconductor, an Infineon Technologies Company
- Infineon GitHub
- ModusToolbox™
- PSoC™ 6 Code Examples using ModusToolbox™ IDE
- ModusToolbox™ Software
- PSoC™ 6 Resources - KBA223067

© Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2019-2021.