Serial Memory
Loading...
Searching...
No Matches
Serial Memory

General Description

In addition to the APIs for reading and writing to memory at runtime, this library also provides support for informing programming tools about the external memory so it can be written at the same time as internal memory.

QSPI configurator slave slot correlation with pins

In QSPI configurator Memory Parts are tied to a specific slave slot that is linked to the actual slave select pin mappings of that specific device. So selecting a memory configuration for slot 0 means that physically that external memory will be the connected to slave select 0 pin. This is important for kits that have hardwired connections to external memories where the memory configuration needs to be in the correct slot depending on what slave select pin is hardwired to it.

Serial Memory handling for Octal DDR

For external memories that are configured in Octal DDR mode, read/write operations at odd addresses and with length equal to 1 are not natively supported due to limitations in the protocol that requires an even address and/or even lengths. For this reason a special handling of these cases is present in mtb_serial_memory_read and mtb_serial_memory_write to allow the use of odd addresses in a transparent way for the user.

For mtb_serial_memory_read when selecting a read one byte at an odd address, the function will instead perform a read at the even address preceding the specified address and then discard the extra byte returning to the user only the data they requested.

For mtb_serial_memory_write the function needs to take into consideration all four possible combinations of even/odd addresses and lengths:

  • For even addresses, even lengths the function directly calls the PDL write function, this is the standard use case
  • For even addresses, length equal to one byte the function first reads the memory for 2 bytes and then creates a new write buffer copying the user's input buffer and making sure the last byte is not altered using the data it previously read WARNING: This will essentially write a byte past the intended one with its existing value that was previously read. Ensure that your memory can support this.
  • For even addresses, odd lengths greater than one the function will return an error as this is an unsupported use case
  • For odd addresses, even lengths the function will return an error as this is an unsupported use case
  • For odd addresses, length equal to one byte the function first reads the memory for 2 bytes starting at the even address preceding the specified address to and then creates a new write buffer copying the user's input buffer and making sure the first byte will not be altered using the data it previously read. WARNING: This will rewrite a location that has already been written (with its existing value). Ensure that your memory can support this.
  • For odd addresses, odd lengths greater than one the function will return an error as this is an unsupported use case.

This special handling needs to be enabled by setting the define _MTB_SERIAL_MEMORY_EMULATE_BYTE_ADDRESSABLE in the application Makefile:

DEFINES+=_MTB_SERIAL_MEMORY_EMULATE_BYTE_ADDRESSABLE
Note
The library does not check for Octal or DDR operation. When the define is set, the handling applies to every SPI memory, including memories that natively support byte access (for example Single SPI or Quad SPI SDR):
  • A read at an odd address is supported only with length equal to one byte, otherwise MTB_RSLT_SERIAL_MEMORY_ERR_UNSUPPORTED is returned
  • A write is supported only for an even address with an even length, or with length equal to one byte, otherwise MTB_RSLT_SERIAL_MEMORY_ERR_UNSUPPORTED is returned
  • A write of one byte always uses the two-byte read-modify-write sequence described above

HyperBus memories are not affected by this define.

This support can be enabled by defining MTB_SERIAL_MEMORY_ENABLE_XIP_PROGRAM while building the application. With this define in place, code will be generated in the .cy_sflash_user_data & .cy_toc_part2 sections. These sections must be provided by the linker script for the application. Once the application has been built, these locations can be read by programming tools (eg: Cypress Programmer, OpenOCD, pyOCD) to know that there is a memory device attached and how to program it.

Data Structures

struct  mtb_serial_memory_t
 Serial memory object. More...

Macros

#define MTB_SERIAL_MEMORY_THREAD_SAFE
 Enables thread-safety for use with multi-threaded RTOS environment.
#define CY_IP_MXSMIF
 The MXSMIF IP is available.
#define MTB_SERIAL_MEMORY_QUAD_ENABLE_TIMEOUT_US
 Timeout in microseconds for each poll of the memory ready status during the quad enable sequence of mtb_serial_memory_setup.
#define MTB_SERIAL_MEMORY_QUAD_ENABLE_MAX_ATTEMPTS
 Number of times the memory ready status and the QE bit are read back after the quad enable command has been sent.
#define MTB_SERIAL_MEMORY_VERSION_MAJOR   (3U)
 The major version of the serial memory asset.
#define MTB_RSLT_SERIAL_MEMORY_ERR_UNSUPPORTED    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 1))
 The function or operation is not supported on the target or the memory.
#define MTB_RSLT_SERIAL_MEMORY_ERR_BAD_PARAM    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 2))
 Parameters passed to a function are invalid.
#define MTB_RSLT_SERIAL_MEMORY_ERR_READ_BUSY    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 3))
 Reserved.
#define MTB_RSLT_SERIAL_MEMORY_ERR_OCTAL_ENABLE    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 4))
 Setting octal enabled failed.
#define MTB_RSLT_SERIAL_MEMORY_ERR_RX_CAPTURE    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 5))
 Setting rx capture mode failed.
#define MTB_RSLT_SERIAL_MEMORY_ERR_QUAD_ENABLE    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 6))
 Setting quad enabled failed: the QE bit did not read back as set.

Enumerations

enum  mtb_serial_memory_chip_select_t {
  MTB_SERIAL_MEMORY_CHIP_SELECT_0 = 1u ,
  MTB_SERIAL_MEMORY_CHIP_SELECT_1 = 1u << 1 ,
  MTB_SERIAL_MEMORY_CHIP_SELECT_2 = 1u << 2 ,
  MTB_SERIAL_MEMORY_CHIP_SELECT_3 = 1u << 3
}
 Serial Memory Chip Select Each chip select is represented by an enumeration that has the bit corresponding to the chip select number set. More...

Functions

cy_rslt_t mtb_serial_memory_setup (mtb_serial_memory_t *obj, mtb_serial_memory_chip_select_t smif_active_chip, SMIF_Type *base, const mtb_hal_clock_t *clock, cy_stc_smif_mem_context_t *mem_context, cy_stc_smif_mem_info_t *mem_info, const cy_stc_smif_block_config_t *block_config)
 Sets up the serial memory.
cy_rslt_t mtb_serial_memory_setup_nonsecure (mtb_serial_memory_t *obj, mtb_serial_memory_chip_select_t smif_active_chip, SMIF_Type *base, cy_stc_smif_mem_context_t *mem_context, cy_stc_smif_mem_info_t *mem_info)
 Sets up the serial memory on non-secure world if the peripheral is secure.
size_t mtb_serial_memory_get_size (mtb_serial_memory_t *obj)
 Returns the size of the serial memory in bytes.
size_t mtb_serial_memory_get_erase_size (mtb_serial_memory_t *obj, uint32_t addr)
 Returns the size of the erase sector to which the given address belongs.
size_t mtb_serial_memory_get_prog_size (mtb_serial_memory_t *obj, uint32_t addr)
 Returns the page size for programming of the memory.
__STATIC_INLINE uint32_t mtb_serial_memory_get_sector_start_address (mtb_serial_memory_t *obj, uint32_t addr)
 Utility function to calculate the starting address of an erase sector to which the given address belongs.
cy_rslt_t mtb_serial_memory_read (mtb_serial_memory_t *obj, uint32_t addr, size_t length, uint8_t *buf)
 Reads data from the serial memory.
cy_rslt_t mtb_serial_memory_write (mtb_serial_memory_t *obj, uint32_t addr, size_t length, const uint8_t *buf)
 Writes the data to the serial memory.
cy_rslt_t mtb_serial_memory_erase (mtb_serial_memory_t *obj, uint32_t addr, size_t length)
 Erases the serial memory, uses chip erase command when addr = 0 and length = flash_size otherwise uses sector erase command.
cy_rslt_t mtb_serial_memory_enable_xip (mtb_serial_memory_t *obj, bool enable)
 Enables Execute-in-Place (memory mapped) mode on the MCU.
cy_rslt_t mtb_serial_memory_set_active_chip (mtb_serial_memory_t *obj, mtb_serial_memory_chip_select_t chip_select)
 Sets the active memory device that the serial memory functions perform the operations on.
uint32_t mtb_serial_memory_get_chip_count (mtb_serial_memory_t *obj)
 Returns the number of memory devices successfully initialized.
uint32_t mtb_serial_memory_get_active_chip (mtb_serial_memory_t *obj)
 Returns the active chip select.
cy_rslt_t mtb_serial_memory_set_write_enable (mtb_serial_memory_t *obj, bool enable)
 Send the Write Enable or Write Disable command to the external memory.

Data Structure Documentation

◆ mtb_serial_memory_t

struct mtb_serial_memory_t
Data Fields
uint32_t smif_active_slot
SMIF_Type * base
const mtb_hal_clock_t * clock
uint32_t configured_csel
uint32_t chip_select
uint32_t status_flags
cy_stc_smif_mem_context_t * mem_context
cy_stc_smif_mem_info_t * mem_info
cy_mutex_t mutex

Macro Definition Documentation

◆ MTB_SERIAL_MEMORY_THREAD_SAFE

#define MTB_SERIAL_MEMORY_THREAD_SAFE

Enables thread-safety for use with multi-threaded RTOS environment.

When defined, mtb_serial_memory_read, mtb_serial_memory_write and mtb_serial_memory_erase take a mutex that belongs to the mtb_serial_memory_t object. The other functions (for example mtb_serial_memory_set_active_chip, mtb_serial_memory_enable_xip and mtb_serial_memory_set_write_enable) are not protected, the application must serialize calls to them and to the protected functions. Thread-safety is not provided between different objects or between CPU cores.

◆ MTB_SERIAL_MEMORY_QUAD_ENABLE_TIMEOUT_US

#define MTB_SERIAL_MEMORY_QUAD_ENABLE_TIMEOUT_US

Timeout in microseconds for each poll of the memory ready status during the quad enable sequence of mtb_serial_memory_setup.

Default: 5000. Define it in the application Makefile to override, for example DEFINES+=MTB_SERIAL_MEMORY_QUAD_ENABLE_TIMEOUT_US=1000000.

◆ MTB_SERIAL_MEMORY_QUAD_ENABLE_MAX_ATTEMPTS

#define MTB_SERIAL_MEMORY_QUAD_ENABLE_MAX_ATTEMPTS

Number of times the memory ready status and the QE bit are read back after the quad enable command has been sent.

Default: 3. The value must be at least 1: with 0 no readback is done and mtb_serial_memory_setup returns MTB_RSLT_SERIAL_MEMORY_ERR_QUAD_ENABLE whenever the QE bit had to be programmed. The quad enable command itself is sent only once, more attempts do not resend it. The sequence ends early when the PDL returns an error status. Define it in the application Makefile to override.

◆ MTB_RSLT_SERIAL_MEMORY_ERR_READ_BUSY

#define MTB_RSLT_SERIAL_MEMORY_ERR_READ_BUSY    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 3))

Reserved.

This release has no asynchronous read, and the library does not return this value. It is kept for compatibility with earlier versions: a previously initiated read operation is not yet complete.

◆ MTB_RSLT_SERIAL_MEMORY_ERR_QUAD_ENABLE

#define MTB_RSLT_SERIAL_MEMORY_ERR_QUAD_ENABLE    (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY, 6))

Setting quad enabled failed: the QE bit did not read back as set.

See the quad enable note in README.md about MTB_SERIAL_MEMORY_QUAD_ENABLE_TIMEOUT_US.

Enumeration Type Documentation

◆ mtb_serial_memory_chip_select_t

Serial Memory Chip Select Each chip select is represented by an enumeration that has the bit corresponding to the chip select number set.

Enumerator
MTB_SERIAL_MEMORY_CHIP_SELECT_0 

The SMIF chip select 0.

MTB_SERIAL_MEMORY_CHIP_SELECT_1 

The SMIF chip select 1.

MTB_SERIAL_MEMORY_CHIP_SELECT_2 

The SMIF chip select 2.

MTB_SERIAL_MEMORY_CHIP_SELECT_3 

The SMIF chip select 3.

Function Documentation

◆ mtb_serial_memory_setup()

cy_rslt_t mtb_serial_memory_setup ( mtb_serial_memory_t * obj,
mtb_serial_memory_chip_select_t smif_active_chip,
SMIF_Type * base,
const mtb_hal_clock_t * clock,
cy_stc_smif_mem_context_t * mem_context,
cy_stc_smif_mem_info_t * mem_info,
const cy_stc_smif_block_config_t * block_config )

Sets up the serial memory.

Note
The function will reset the memory controller when "Auto Detect SFDP" is chosen in the "Memory Part Number" section of the QSPI Configurator. However, if a specific part number is specified in the QSPI Configurator, the responsibility falls to the application to reset the memory controller using the Cy_SMIF_Reset_Memory() PDL function. This approach is adopted because the mtb_serial_memory_setup() function might be executed from the external memory itself, and resetting the memory controller could disrupt the communication with the memory. This function initializes the slots of the memory device in the SMIF configuration. It's security aware and is a wrapper around Cy_SMIF_MemNumInit, and gather all information about the memory size, erase and program size to be used in subsequent serial memory calls. It can either be called in a secure partition or in the non-secure partition if the peripheral itself is not secured.
The object must be zero-initialized before the first call (for example a global or static object, or one cleared with memset), because the function updates its fields with read-modify-write operations. Call the function once per object, calling it again on an object that has been set up is not supported. The object, mem_context and mem_info must remain valid as long as the library is used.
Octal memories (MXSMIF version 4 and later): the Octal enable command is sent only if the SMIF RX capture mode differs from the one the configuration requires. This function sets that capture mode before the check, so for a memory with an explicit part number the command is not sent. The memory must already be in Octal mode (SDR or DDR, as configured) when this function is called, for example because the boot path or the application switched it, or because the application executes from this memory (XIP). Otherwise the function still returns CY_RSLT_SUCCESS and the following operations fail, typically with CY_SMIF_EXCEED_TIMEOUT (0x00B20002). The PDL states that Cy_SMIF_MemOctalEnable() "must be executed before sending octal SPI commands to the memory device", so a memory that powers up in single SPI mode needs it from the application: start SMIF in normal SPI capture mode, call Cy_SMIF_MemNumInit(), Cy_SMIF_Enable(), Cy_SMIF_Reset_Memory(), Cy_SMIF_MemOctalEnable(), set the RX capture mode required by the configuration, and only then call this function. This is not needed for memories that power up in Octal mode, nor for Single, Dual and Quad SPI memories. The skip avoids a hang that can occur when SMIF is disabled and re-enabled while code executes from the same memory.
Parameters
objPointer to the mtb_serial_memory_t object to setup
smif_active_chipThe slave select line to configure as active
basePointer to the SMIF base address
clockPointer to the clock object
mem_contextPointer to the SMIF Device internal context data
mem_infoPointer to the SMIF memory info structure
block_configPointer to the SMIF block configuration structure
Returns
CY_RSLT_SUCCESS if the setup was successful, MTB_RSLT_SERIAL_MEMORY_ERR_BAD_PARAM if smif_active_chip is not configured in block_config (nothing is modified in this case), MTB_RSLT_SERIAL_MEMORY_ERR_UNSUPPORTED if a memory uses "Auto Detect SFDP" and the SMIF clock (HF clock frequency, divided by 2 for MXSMIF version 2 and later) exceeds 50 MHz, an error code otherwise.

◆ mtb_serial_memory_setup_nonsecure()

cy_rslt_t mtb_serial_memory_setup_nonsecure ( mtb_serial_memory_t * obj,
mtb_serial_memory_chip_select_t smif_active_chip,
SMIF_Type * base,
cy_stc_smif_mem_context_t * mem_context,
cy_stc_smif_mem_info_t * mem_info )

Sets up the serial memory on non-secure world if the peripheral is secure.

Note
This function is to be called from the non secure partition in trustzone devices (after the secure one has successfully called mtb_serial_memory_setup ) to set up the context and gather all information about the memory size, erase and program size to be used in subsequent serial memory calls.
Parameters
objPointer to the mtb_serial_memory_t object to setup
smif_active_chipThe slave select line to configure as active
basePointer to the SMIF base address
mem_contextPointer to the SMIF Device internal context data
mem_infoPointer to the SMIF memory info structure
Returns
CY_RSLT_SUCCESS if the setup was successful, an error code otherwise.

◆ mtb_serial_memory_get_size()

size_t mtb_serial_memory_get_size ( mtb_serial_memory_t * obj)

Returns the size of the serial memory in bytes.

Parameters
objPointer to the mtb_serial_memory_t object to obtain information from
Returns
Memory size in bytes.

◆ mtb_serial_memory_get_erase_size()

size_t mtb_serial_memory_get_erase_size ( mtb_serial_memory_t * obj,
uint32_t addr )

Returns the size of the erase sector to which the given address belongs.

Address is used only for a memory with hybrid sector size.

Parameters
objPointer to the mtb_serial_memory_t object to obtain information from.
addrAddress that belongs to the sector for which size is returned.
Returns
Erase sector size in bytes.

◆ mtb_serial_memory_get_prog_size()

size_t mtb_serial_memory_get_prog_size ( mtb_serial_memory_t * obj,
uint32_t addr )

Returns the page size for programming of the memory.

Parameters
objPointer to the mtb_serial_memory_t object to obtain information from.
addrNot used in this release, the same value is returned for every address.
Returns
Page size in bytes.

◆ mtb_serial_memory_get_sector_start_address()

__STATIC_INLINE uint32_t mtb_serial_memory_get_sector_start_address ( mtb_serial_memory_t * obj,
uint32_t addr )

Utility function to calculate the starting address of an erase sector to which the given address belongs.

The calculation assumes that the erase sector size is a power of two.

Parameters
objPointer to the mtb_serial_memory_t object to obtain information from.
addrAddress in the sector for which the starting address is returned.
Returns
Starting address of the sector

◆ mtb_serial_memory_read()

cy_rslt_t mtb_serial_memory_read ( mtb_serial_memory_t * obj,
uint32_t addr,
size_t length,
uint8_t * buf )

Reads data from the serial memory.

This is a blocking function. Returns error if (addr + length) exceeds the memory size. A read with length 0 returns an error. For SPI memories the read is done with the PDL MemNum read function, for HyperBus memories with the PDL HyperBus read function. If _MTB_SERIAL_MEMORY_EMULATE_BYTE_ADDRESSABLE is set the function can emulate byte addressable memories (intended for Octal DDR memories, but it applies to all SPI memories) and handle one byte reads even at odd addresses. With the define set, a read at an even address is passed to the PDL with any length, and a read at an odd address is supported only with length 1. See Serial Memory handling for Octal DDR.

Parameters
objPointer to the mtb_serial_memory_t object to obtain information from.
addrStarting address to read from
lengthNumber of data bytes to read
bufPointer to the buffer to store the data read from the memory
Returns
CY_RSLT_SUCCESS if the read was successful, an error code otherwise.

◆ mtb_serial_memory_write()

cy_rslt_t mtb_serial_memory_write ( mtb_serial_memory_t * obj,
uint32_t addr,
size_t length,
const uint8_t * buf )

Writes the data to the serial memory.

The program area must have been erased prior to calling this API using mtb_serial_memory_erase() This is a blocking function. Returns error if (addr + length) exceeds the memory size. A write with length 0 returns an error. For SPI memories the write is done with the PDL MemNum write function, for HyperBus memories with the PDL HyperBus write function. If _MTB_SERIAL_MEMORY_EMULATE_BYTE_ADDRESSABLE is set the function can emulate byte addressable memories (intended for Octal DDR memories, but it applies to all SPI memories) and handle one byte writes even at odd addresses. A one-byte write then programs two bytes, starting at the requested address rounded down to an even address. The other byte is kept by reading it first. See Serial Memory handling for Octal DDR.

Parameters
objPointer to the mtb_serial_memory_t object to write to.
addrStarting address to write to
lengthNumber of bytes to write
bufPointer to the buffer storing the data to be written
Returns
CY_RSLT_SUCCESS if the write was successful, an error code otherwise.

◆ mtb_serial_memory_erase()

cy_rslt_t mtb_serial_memory_erase ( mtb_serial_memory_t * obj,
uint32_t addr,
size_t length )

Erases the serial memory, uses chip erase command when addr = 0 and length = flash_size otherwise uses sector erase command.

This is a blocking function.

Note
addr and (addr + length) must be aligned to the erase sector size. For memories with hybrid sectors, each of the two addresses is checked against the sector size of the region it is located in, with the offset taken from the start of that region. An unaligned range is rejected with MTB_RSLT_SERIAL_MEMORY_ERR_BAD_PARAM and nothing is erased. The sector erase is done by the PDL function Cy_SMIF_MemNumEraseSector(), which would otherwise round addr down and (addr + length) up to sector boundaries and erase the whole rounded range, so data outside the requested range could be lost. A range that exceeds the memory size is not checked by the library, the PDL status CY_SMIF_BAD_PARAM is returned for it and nothing is erased.

Erase is supported only for SPI memories, for other memory types (for example HyperBus) MTB_RSLT_SERIAL_MEMORY_ERR_UNSUPPORTED is returned. Call mtb_serial_memory_get_size() to get the flash size and call mtb_serial_memory_get_erase_size() to get the size of an erase sector.

Parameters
objPointer to the mtb_serial_memory_t object to erase.
addrStarting address to begin erasing
lengthNumber of bytes to erase
Returns
CY_RSLT_SUCCESS if the erase was successful, MTB_RSLT_SERIAL_MEMORY_ERR_BAD_PARAM if the range is not aligned to the erase sectors, an error code otherwise.

◆ mtb_serial_memory_enable_xip()

cy_rslt_t mtb_serial_memory_enable_xip ( mtb_serial_memory_t * obj,
bool enable )

Enables Execute-in-Place (memory mapped) mode on the MCU.

This function does not send any command to the serial memory.

Parameters
objPointer to the mtb_serial_memory_t object to enable XIP on.
enabletrue: XIP mode is set, false: normal mode is set
Returns
CY_RSLT_SUCCESS if the operation was successful.

◆ mtb_serial_memory_set_active_chip()

cy_rslt_t mtb_serial_memory_set_active_chip ( mtb_serial_memory_t * obj,
mtb_serial_memory_chip_select_t chip_select )

Sets the active memory device that the serial memory functions perform the operations on.

Note
A successful mtb_serial_memory_setup is a precondition. If it was not done, the function does not return an error: the check is made with CY_ASSERT, which halts the application when assertions are enabled.
The memory information (size, erase size, program size, hybrid regions) of the selected memory is read again and replaces the information gathered by mtb_serial_memory_setup, so the query functions always describe the active chip. The memories can have different geometry.
Parameters
objPointer to the mtb_serial_memory_t object to set active chip for.
chip_selectThe chip select of the memory device to be set as active.
Returns
CY_RSLT_SUCCESS if the chip was set as active, MTB_RSLT_SERIAL_MEMORY_ERR_BAD_PARAM if the chip select is not configured in the SMIF block configuration passed to mtb_serial_memory_setup , a PDL SMIF status code if the memory information could not be read (the previous chip stays active in this case).

◆ mtb_serial_memory_get_chip_count()

uint32_t mtb_serial_memory_get_chip_count ( mtb_serial_memory_t * obj)

Returns the number of memory devices successfully initialized.

Parameters
objPointer to the mtb_serial_memory_t object to get chip count for.
Returns
Number of memory devices successfully initialized.

◆ mtb_serial_memory_get_active_chip()

uint32_t mtb_serial_memory_get_active_chip ( mtb_serial_memory_t * obj)

Returns the active chip select.

Parameters
objPointer to the mtb_serial_memory_t object to get the active chip for.
Returns
Returns the active memory chip.

◆ mtb_serial_memory_set_write_enable()

cy_rslt_t mtb_serial_memory_set_write_enable ( mtb_serial_memory_t * obj,
bool enable )

Send the Write Enable or Write Disable command to the external memory.

Parameters
objPointer to the mtb_serial_memory_t object to send write enable/disable command to.
enableif true the command to be sent is Write Enable, if false the command to be sent is Write Disable.
Returns
CY_RSLT_SUCCESS if the operation was successful, an error code otherwise.