sqiflash  2.0.0.0
Main Page

SQI FLASH click

SQI FLASH click is based on the SST26VF064B, a 64 Mbit Serial Quad I/O flash device from Microchip. The chip utilizes 4-bit multiplexed I/O serial interface to boost the performance. The click is a very fast solid-state, non-volatile data storage medium, that can be electrically erased and reprogrammed.

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Aug 2021.
  • Type : SPI type

Software Support

We provide a library for the SqiFlash Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for SqiFlash Click driver.

Standard key functions :

Example key functions :

Example Description

This is an example that demonstrates the use of the SQI FLASH Click board.

The demo application is composed of two sections :

Application Init

SQI FLASH Driver Initialization, initializes the click by setting mikroBUS to approprieate logic levels, performing global block unlock and chip erase functions, reads manufacturer ID, memory type and device ID and logs it on USB UART terminal.

void application_init ( void )
{
log_cfg_t log_cfg;
sqiflash_cfg_t sqiflash_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
sqiflash_cfg_setup( &sqiflash_cfg );
SQIFLASH_MAP_MIKROBUS( sqiflash_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == sqiflash_init( &sqiflash, &sqiflash_cfg ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms( 300 );
Delay_ms( 400 );
sqiflash_chip_erase( &sqiflash );
Delay_ms( 300 );
log_printf( &logger, " Manufacturer ID: 0x%.2X\r\n", ( uint16_t ) device_manufac );
log_printf( &logger, " Memory Type: 0x%.2X\r\n", ( uint16_t ) device_type );
device_id = sqiflash_device_id( &sqiflash );
log_printf( &logger, " Device ID: 0x%.2X\r\n", ( uint16_t ) device_id );
log_info( &logger, " Application Task " );
}

Application Task

Writing data to click memory and displaying the read data via UART.

void application_task ( void )
{
log_printf( &logger, " Writing data to address: 0x%.6LX\r\n", address );
log_printf( &logger, " Written data: %s", wr_data );
log_printf( &logger, "\r\n Reading data from address: 0x%.6LX\r\n", address );
log_printf( &logger, " Read data: %s", rd_data );
log_printf( &logger, "-------------------------------------\r\n" );
Delay_ms( 2000 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SqiFlash

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.


rd_data
uint8_t rd_data[9]
Definition: main.c:34
sqiflash_device_type
uint8_t sqiflash_device_type(sqiflash_t *ctx)
SQI FLASH Device Type.
sqiflash_chip_erase
void sqiflash_chip_erase(sqiflash_t *ctx)
SQI FLASH Chip Erase.
sqiflash_t
SQI FLASH Click context object.
Definition: sqiflash.h:160
sqiflash_init
err_t sqiflash_init(sqiflash_t *ctx, sqiflash_cfg_t *cfg)
SQI FLASH initialization function.
application_task
void application_task(void)
Definition: main.c:79
sqiflash_global_block_unlock
void sqiflash_global_block_unlock(sqiflash_t *ctx)
SQI FLASH Global Block Unlock.
sqiflash_cfg_t
SQI FLASH Click configuration object.
Definition: sqiflash.h:177
sqiflash_write_generic
void sqiflash_write_generic(sqiflash_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
SQI FLASH Write.
sqiflash_cfg_setup
void sqiflash_cfg_setup(sqiflash_cfg_t *cfg)
SQI FLASH configuration object setup function.
sqiflash_device_manufac
uint8_t sqiflash_device_manufac(sqiflash_t *ctx)
SQI FLASH Device Manufacturer.
device_id
uint8_t device_id
Definition: main.c:31
sqiflash_read_generic
void sqiflash_read_generic(sqiflash_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
SQI FLASH Read.
SQIFLASH_MAP_MIKROBUS
#define SQIFLASH_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: sqiflash.h:144
sqiflash_device_id
uint8_t sqiflash_device_id(sqiflash_t *ctx)
SQI FLASH Device ID.
address
uint32_t address
Definition: main.c:35
application_init
void application_init(void)
Definition: main.c:37
device_manufac
uint8_t device_manufac
Definition: main.c:29
device_type
uint8_t device_type
Definition: main.c:30
wr_data
uint8_t wr_data[9]
Definition: main.c:33