flash11 2.1.0.0
Flash 11 Click Driver

API for configuring and manipulating Flash 11 Click driver. More...

Topics

 Flash 11 command opcode list.
 List of command opcode of Flash 11 Click driver.
 
 Flash 11 Registers Settings
 Settings for registers of Flash 11 Click driver.
 
 Flash 11 MikroBUS Map
 MikroBUS pin mapping of Flash 11 Click driver.
 

Functions

void flash11_cfg_setup (flash11_cfg_t *cfg)
 Flash 11 configuration object setup function.
 
err_t flash11_init (flash11_t *ctx, flash11_cfg_t *cfg)
 Flash 11 initialization function.
 
err_t flash11_default_cfg (flash11_t *ctx)
 Flash 11 default configuration function.
 
err_t flash11_generic_write (flash11_t *ctx, uint8_t opcode, uint8_t *data_in, uint8_t len)
 Flash 11 data writing function.
 
err_t flash11_generic_read (flash11_t *ctx, uint8_t opcode, uint8_t *data_out, uint8_t len)
 Flash 11 data reading function.
 
err_t flash11_set_cmd (flash11_t *ctx, uint8_t opcode)
 Flash 11 set the command function.
 
err_t flash11_write_cmd_addr_data (flash11_t *ctx, uint8_t opcode, uint32_t mem_addr, uint8_t *data_in, uint32_t len)
 Flash 11 write command adress data function.
 
err_t flash11_read_cmd_addr_data (flash11_t *ctx, uint8_t opcode, uint32_t mem_addr, uint8_t *data_out, uint32_t len)
 Flash 11 read command adress data function.
 
err_t flash11_sw_reset (flash11_t *ctx)
 Flash 11 sw reset function.
 
err_t flash11_memory_write (flash11_t *ctx, uint32_t mem_addr, uint8_t *data_in, uint32_t len)
 Flash 11 memory write function.
 
err_t flash11_memory_read (flash11_t *ctx, uint32_t mem_addr, uint8_t *data_out, uint32_t len)
 Flash 11 memory read function.
 
err_t flash11_write_enable (flash11_t *ctx)
 Flash 11 write enable function.
 
err_t flash11_write_disable (flash11_t *ctx)
 Flash 11 write disable function.
 
err_t flash11_block_erase (flash11_t *ctx, uint8_t cmd_block_erase, uint32_t mem_addr)
 Flash 11 block erase function.
 
err_t flash11_chip_erase (flash11_t *ctx)
 Flash 11 chip erase function.
 
err_t flash11_set_status (flash11_t *ctx, uint8_t status_reg, uint8_t status)
 Flash 11 set status function.
 
err_t flash11_get_status (flash11_t *ctx, uint8_t status_reg, uint8_t *status)
 Flash 11 gets the status function.
 
err_t flash11_get_device_id (flash11_t *ctx, uint8_t *device_id)
 Flash 11 gets the device ID function.
 
void flash11_hw_write_protect (flash11_t *ctx, uint8_t en_wp)
 Flash 11 hardware write protect function.
 
void flash11_en_hold (flash11_t *ctx, uint8_t en_hold)
 Flash 11 enable hold function.
 

Detailed Description

API for configuring and manipulating Flash 11 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ flash11_block_erase()

err_t flash11_block_erase ( flash11_t * ctx,
uint8_t cmd_block_erase,
uint32_t mem_addr )

Flash 11 block erase function.

This function erases the desired amount of memory starting from the selected memory address of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]cmd_block_erase: Block erase command
  • 0x20 (FLASH11_CMD_BLOCK_ERASE_4KB) - Erase a block of 4 kbytes,
  • 0x52 (FLASH11_CMD_BLOCK_ERASE_32KB) - Erase a block of 32 kbytes,
  • 0xD8 (FLASH11_CMD_BLOCK_ERASE_64KB) - Erase a block of 64 kbytes.
[in]mem_addr: Flash memory address.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_cfg_setup()

void flash11_cfg_setup ( flash11_cfg_t * cfg)

Flash 11 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See flash11_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ flash11_chip_erase()

err_t flash11_chip_erase ( flash11_t * ctx)

Flash 11 chip erase function.

This function erases the entire memory array of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_default_cfg()

err_t flash11_default_cfg ( flash11_t * ctx)

Flash 11 default configuration function.

This function executes a default configuration of Flash 11 click board.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ flash11_en_hold()

void flash11_en_hold ( flash11_t * ctx,
uint8_t en_hold )

Flash 11 enable hold function.

This function is used for pausing communication of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]en_hold
  • 0 (FLASH11_HOLD_ENABLE) - Enable pausing communication,
  • 1 (FLASH11_HOLD_DISABLE) - Disable pausing communication.
Returns
Nothing.
Note
None.

◆ flash11_generic_read()

err_t flash11_generic_read ( flash11_t * ctx,
uint8_t opcode,
uint8_t * data_out,
uint8_t len )

Flash 11 data reading function.

This function reads a desired number of data bytes of the selected 8-bit opcode by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]opcode: Command opcode.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_generic_write()

err_t flash11_generic_write ( flash11_t * ctx,
uint8_t opcode,
uint8_t * data_in,
uint8_t len )

Flash 11 data writing function.

This function writes a desired number of data bytes of the selected 8-bit opcode by using SPI serial interface.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]opcode: Command opcode.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_get_device_id()

err_t flash11_get_device_id ( flash11_t * ctx,
uint8_t * device_id )

Flash 11 gets the device ID function.

This function reads a Manufacturer ID of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]status_reg: Read status register command.
[out]status: Status data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_get_status()

err_t flash11_get_status ( flash11_t * ctx,
uint8_t status_reg,
uint8_t * status )

Flash 11 gets the status function.

This function reads data from the desired status register of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]status_reg: Read status register command.
[out]status: Status data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_hw_write_protect()

void flash11_hw_write_protect ( flash11_t * ctx,
uint8_t en_wp )

Flash 11 hardware write protect function.

This function is used for write-protection of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]en_wp
  • 0 (FLASH11_WRITE_PROTECT_ENABLE) - Enable write-protection,
  • 1 (FLASH11_WRITE_PROTECT_DISABLE) - Disable write-protection.
Returns
Nothing.
Note
None.

◆ flash11_init()

err_t flash11_init ( flash11_t * ctx,
flash11_cfg_t * cfg )

Flash 11 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See flash11_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_memory_read()

err_t flash11_memory_read ( flash11_t * ctx,
uint32_t mem_addr,
uint8_t * data_out,
uint32_t len )

Flash 11 memory read function.

This function reads a desired number of data bytes starting from the selected memory address of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]mem_addr: Flash memory address (0x000000-0x3FFFFF).
[in]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_memory_write()

err_t flash11_memory_write ( flash11_t * ctx,
uint32_t mem_addr,
uint8_t * data_in,
uint32_t len )

Flash 11 memory write function.

This function writes a desired number of data bytes starting from the selected memory address of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]mem_addr: Flash memory address (0x000000-0x3FFFFF).
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_read_cmd_addr_data()

err_t flash11_read_cmd_addr_data ( flash11_t * ctx,
uint8_t opcode,
uint32_t mem_addr,
uint8_t * data_out,
uint32_t len )

Flash 11 read command adress data function.

This function writes a desired number of data bytes starting from a desired address of the selected command of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]opcode: Command opcode.
[in]mem_addr: Flash memory address (0x000000-0x3FFFFF).
[in]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_set_cmd()

err_t flash11_set_cmd ( flash11_t * ctx,
uint8_t opcode )

Flash 11 set the command function.

This function writes the desired command of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]opcode: Command opcode.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_set_status()

err_t flash11_set_status ( flash11_t * ctx,
uint8_t status_reg,
uint8_t status )

Flash 11 set status function.

This function writes data to the desired status register of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]status_reg: Write status register command.
[in]status: Status data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_sw_reset()

err_t flash11_sw_reset ( flash11_t * ctx)

Flash 11 sw reset function.

This function performs the software reset of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_write_cmd_addr_data()

err_t flash11_write_cmd_addr_data ( flash11_t * ctx,
uint8_t opcode,
uint32_t mem_addr,
uint8_t * data_in,
uint32_t len )

Flash 11 write command adress data function.

This function writes a desired number of data bytes starting from a desired address of the selected command of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
[in]opcode: Command opcode.
[in]mem_addr: Flash memory address (0x000000-0x3FFFFF).
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_write_disable()

err_t flash11_write_disable ( flash11_t * ctx)

Flash 11 write disable function.

This function disables memory write-protect and sets the write disable command of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ flash11_write_enable()

err_t flash11_write_enable ( flash11_t * ctx)

Flash 11 write enable function.

This function write protects the entire memory and sets the write enable command of the AT25SF321B, 32-Mbit SPI Serial Flash Memory with Dual I/O and Quad I/O Support on the Flash 11 Click board™.

Parameters
[in]ctx: Click context object. See flash11_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.