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.
Features overview
Development board
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping 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
Architecture
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
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