Highly reliable memory solution
A
A
Hardware Overview
How does it work?
Flash 8 Click is based on the GD5F2GQ5UEYIGR, a highly reliable serial Flash memory solution offering flexibility designed for use in various consumer applications from GigaDevice Semiconductor. It comes with a density of 2Gb based on an industry-standard NAND Flash memory core, representing an attractive alternative to SPI-NOR and standard parallel NAND Flash with advanced features. Organized as 256Mx8, the GD5F2GQ5UEYIGR has advanced security features (8K-Byte OTP region). It specifies a minimum of 100.000 endurance cycles with data retention of a minimum of 10 years, allowing it to handle unlimited reads/writes to the memory. This Click board™ communicates with MCU through an industry-standard SPI interface (Dual and QSPI compatible) that enables high clock speed,
supporting the two most common SPI modes, SPI Mode 0 and 3, with a maximum frequency of 104MHz. It is programmed/read in page-based operations and erased in block-based operations. Data is transferred to/from the NAND Flash memory array, page by page, to a data register and a cache register which is closest to I/O control circuits, acting as a data buffer for the I/O data (enable page and random data READ/WRITE and copy back operations). In addition to the SPI communication, this Click board™ also has two additional pins used for Write Protection and HOLD function routed to the RST and PWM pins of the mikroBUS™ socket. The configurable Write Protection, marked as WP and routed on the RST pin of the mikroBUS™ socket, prevents the block lock bits from being overwritten and must be held
low to inhibit all the write operations to registers. When this pin is low, also by setting the appropriate bits, all memory and register write are prohibited, and the address counter is not incremented. On the other hand, the HOLD pin labeled as HLD and routed to the PWM pin of the mikroBUS™ socket stops any serial communications with the device. Still, it doesn’t stop the operation of reading programming or erasing in progress. This Click board™ can only be operated from a 3.3V logic voltage level. Therefore, the board must perform appropriate logic voltage conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
![Flash 8 Click top side image](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1edb2fa0-b073-6238-9d97-0242ac120004/01-flash-8-click-front.png)
![Flash 8 Click lateral side image](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1edb2fa1-802e-6e00-b92f-0242ac120004/02-flash-8-click-side.png)
![Flash 8 Click bottom side image](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1edb2fa2-51ca-60ea-8535-0242ac120004/03-flash-8-click-back.png)
Features overview
Development board
EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
![default](https://dbp-cdn.mikroe.com/catalog/mcus/resources/PIC18LF26K42.jpeg)
Architecture
PIC
MCU Memory (KB)
64
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
4096
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
![Flash 8 Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee790ae-adb3-63b0-9a02-0242ac120009/schematic.webp)
Step by step
Project assembly
Track your results in real time
Application Output
After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.
![UART Application Output Step 1](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703a-40a0-6b58-88de-02420a00029a/UART-AO-Step-1.jpg)
Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.
![UART Application Output Step 2](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703a-eb29-62fa-ba91-02420a00029a/UART-AO-Step-2.jpg)
In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".
![UART Application Output Step 3](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703b-7543-6fbc-9c69-0242ac120003/UART-AO-Step-3.jpg)
The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
![UART Application Output Step 4](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703c-068c-66a4-a4fc-0242ac120003/UART-AO-Step-4.jpg)
Software Support
Library Description
This library contains API for Flash 8 Click driver.
Key functions:
flash8_write_memory
Flash 8 write memory function.flash8_read_memory
Flash 8 read memory function.flash8_read_id
Flash 8 read ID function.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief Flash8 Click example
*
* # Description
* This library contains API for Flash 8 Click driver.
* The library using SPI serial interface.
* The library also includes a function for write and read memory
* as well as write protection control functions.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization of SPI module and log UART.
* After driver initialization and default setting,
* involves disabling write protection and hold,
* the app writes demo_data string ( mikroE ) starting
* from the selected row_address of the 123 ( 0x0000007B )
* and column_address of the 456 ( 0x01C8 ).
*
* ## Application Task
* This is an example that shows the use of a Flash 8 Click board™.
* The app reads a data string, which we have previously written to memory,
* starting from the selected row_address of the 123 ( 0x0000007B )
* and column_address of the 456 ( 0x01C8 ).
* Results are being sent to the Usart Terminal where you can track their changes.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "flash8.h"
static flash8_t flash8;
static log_t logger;
static uint8_t manufacture_id;
static uint8_t device_id;
static uint8_t organization_id;
static uint8_t feature_status_out;
static uint8_t demo_data[ 9 ] = { 'M', 'i', 'k', 'r', 'o', 'E', 13 ,10 , 0 };
static uint8_t rx_data[ 9 ] = { 0 };
static feature_cfg_t feature_data;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
flash8_cfg_t flash8_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
flash8_cfg_setup( &flash8_cfg );
FLASH8_MAP_MIKROBUS( flash8_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == flash8_init( &flash8, &flash8_cfg ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
flash8_default_cfg ( &flash8 );
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
flash8_read_id( &flash8, &manufacture_id, &device_id, &organization_id );
log_printf( &logger, "--------------------------\r\n" );
log_printf( &logger, " Manufacture ID : 0x%.2X\r\n", ( uint16_t) manufacture_id );
log_printf( &logger, " Device ID : 0x%.2X\r\n", ( uint16_t) device_id );
log_printf( &logger, " Organization ID : 0x%.2X\r\n", ( uint16_t) organization_id );
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 100 );
flash8_sw_reset( &flash8, &feature_status_out );
if ( feature_status_out & FLASH8_GET_PRG_F_PROGRAM_FAIL )
{
log_printf( &logger, "\tProgram Fail \r\n" );
}
else
{
log_printf( &logger, "\tProgram Pass \r\n" );
}
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 1000 );
feature_data.brwd = FLASH8_SET_BRWD_ENABLE;
feature_data.bl = FLASH8_SET_BL_ALL_UNLOCKED;
feature_data.idr_e = FLASH8_SET_IDR_E_NORMAL_OPERATION;
feature_data.ecc_e = FLASH8_SET_ECC_E_INTERNAL_ECC_ENABLE;
feature_data.prt_e = FLASH8_SET_PRT_E_NORMAL_OPERATION;
feature_data.hse = FLASH8_SET_HSE_HIGH_SPEED_MODE_ENABLE;
feature_data.hold_d = FLASH8_SET_HOLD_D_HOLD_IS_ENABLED;
feature_data.wel = FLASH8_SET_WEL_WRITE_ENABLE;
flash8_set_config_feature( &flash8, feature_data );
Delay_ms ( 100 );
flash8_block_erase( &flash8, 123, &feature_status_out );
if ( feature_status_out & FLASH8_GET_ERS_F_ERASE_FAIL )
{
log_printf( &logger, "\tErase Fail \r\n" );
}
else
{
log_printf( &logger, "\tErase Pass \r\n" );
}
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 1000 );
log_printf( &logger, " Write data : %s", demo_data );
log_printf( &logger, "--------------------------\r\n" );
log_printf( &logger, " Write status:\r\n" );
flash8_write_memory( &flash8, 123, 456, &demo_data[ 0 ], 9, &feature_status_out );
if ( feature_status_out & FLASH8_GET_OIP_BUSY_STATE )
{
log_printf( &logger, " Operation is in progress.\r\n" );
}
else
{
log_printf( &logger, " Operation is not in progress.\r\n" );
}
log_printf( &logger, "- - - - - - - - - - - - -\r\n" );
Delay_ms ( 1000 );
log_printf( &logger, " Check data ready...\r\n" );
while ( FLASH8_GET_OIP_READY_STATE != feature_status_out )
{
flash8_get_feature( &flash8, FLASH8_FEATURE_C0, &feature_status_out );
log_printf( &logger, "\tBusy state.\r\n" );
Delay_ms ( 100 );
}
if ( FLASH8_GET_OIP_READY_STATE == feature_status_out )
{
log_printf( &logger, "\tReady state.\r\n" );
}
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 100 );
}
void application_task ( void )
{
flash8_read_memory( &flash8, 123, 456, &rx_data[ 0 ], 9, &feature_status_out );
log_printf( &logger, " Read data : %s", rx_data );
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END