flash7  2.0.0.0
Main Page

Flash 7 click

Flash 7 Click is a compact add-on board that contains a high-performance memory solution. This board features the GD25LQ16C, a high-performance 16Mbit SPI NOR Flash Memory solution with advanced security features from GigaDevice Semiconductor.

click Product page


Click library

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

Software Support

We provide a library for the Flash7 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 Flash7 Click driver.

Standard key functions :

Example key functions :

Example Description

This is an example that demonstrates the use of the Flash 7 click board.

The demo application is composed of two sections :

Application Init

Initialization driver enables SPI, disables write protect and hold, performs whole chip erase, targets the memory address at "4096" for page program starting point and writes data which is also displayed on the log.

void application_init ( void ) {
log_cfg_t log_cfg;
flash7_cfg_t flash7_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
flash7_cfg_setup( &flash7_cfg );
FLASH7_MAP_MIKROBUS( flash7_cfg, MIKROBUS_1 );
err_t init_flag = flash7_init( &flash7, &flash7_cfg );
if ( SPI_MASTER_ERROR == init_flag ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
flash7_default_cfg ( &flash7 );
log_printf( &logger, " ----------------------- \r\n" );
log_printf( &logger, " Chip Erase \r\n" );
flash7_chip_erase( &flash7 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
memory_addr = 4096;
log_printf( &logger, " ----------------------- \r\n" );
log_printf( &logger, " Write data : %s ", demo_data );
log_printf( &logger, " ----------------------- \r\n" );
flash7_page_program( &flash7, memory_addr, demo_data, 9 );
Delay_ms ( 100 );
log_info( &logger, " Application Task " );
log_printf( &logger, " ----------------------- \r\n" );
}

Application Task

In this example, the data is read from the targeted memory address. The results are being sent to the Usart Terminal. This task repeats every 5 sec.

void application_task ( void ) {
flash7_read_memory( &flash7, memory_addr, rx_data, 9 );
log_printf( &logger, " Read data : %s ", rx_data );
log_printf( &logger, " ----------------------- \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}

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.Flash7

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.


flash7_chip_erase
void flash7_chip_erase(flash7_t *ctx)
Chip erase function.
flash7_cfg_setup
void flash7_cfg_setup(flash7_cfg_t *cfg)
Flash 7 configuration object setup function.
FLASH7_MAP_MIKROBUS
#define FLASH7_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: flash7.h:187
application_task
void application_task(void)
Definition: main.c:89
flash7_cfg_t
Flash 7 Click configuration object.
Definition: flash7.h:220
flash7_read_memory
void flash7_read_memory(flash7_t *ctx, uint32_t mem_addr, uint8_t *p_rx_data, uint16_t n_bytes)
Read memory function.
flash7_init
err_t flash7_init(flash7_t *ctx, flash7_cfg_t *cfg)
Flash 7 initialization function.
flash7_t
Flash 7 Click context object.
Definition: flash7.h:203
flash7_default_cfg
err_t flash7_default_cfg(flash7_t *ctx)
Flash 7 default configuration function.
flash7_page_program
uint8_t flash7_page_program(flash7_t *ctx, uint32_t mem_addr, uint8_t *p_tx_data, uint16_t n_bytes)
Page program function.
application_init
void application_init(void)
Definition: main.c:37
flash7_send_command
void flash7_send_command(flash7_t *ctx, uint8_t cmd)
Send command function.