Flash 8 click
<PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU>
[click Product page](<CLICK_PRODUCT_PAGE_LINK>)
Click library
- Author : Nenad Filipovic
- Date : May 2021.
- Type : SPI type
Software Support
We provide a library for the Flash8 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 Flash8 Click driver.
Standard key functions :
flash8_cfg_setup
Config Object Initialization function.
flash8_init
Initialization function.
flash8_default_cfg
Click Default Configuration function.
Example key functions :
flash8_write_memory
Flash 8 write memory function. FLASH8_RETVAL
flash8_write_memory (
flash8_t *ctx, uint32_t row_address, uint16_t column_address, uint8_t *data_in, uint16_t len, uint8_t *feature_status_out );
flash8_read_memory
Flash 8 read memory function. FLASH8_RETVAL
flash8_read_memory (
flash8_t *ctx, uint32_t row_address, uint16_t column_address, uint8_t *data_out, uint16_t len, uint8_t *feature_status_out );
flash8_read_id
Flash 8 read ID function. FLASH8_RETVAL
flash8_read_id (
flash8_t *ctx, uint8_t *manufacture_id, uint8_t *device_id, uint8_t *organization_id );
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 ).
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( init_flag == SPI_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
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", manufacture_id );
log_printf( &logger, " Device ID : 0x%.2X\r\n", device_id );
log_printf( &logger, " Organization ID : 0x%.2X\r\n", organization_id );
log_printf( &logger, "--------------------------\r\n" );
Delay_ms( 100 );
log_printf( &logger, "\tProgram Fail \r\n" );
} else {
log_printf( &logger, "\tProgram Pass \r\n" );
}
log_printf( &logger, "--------------------------\r\n" );
Delay_ms( 1000 );
Delay_ms( 100 );
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" );
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" );
log_printf( &logger, "\tBusy state.\r\n" );
Delay_ms( 100 );
}
log_printf( &logger, "\tReady state.\r\n" );
}
log_printf( &logger, "--------------------------\r\n" );
Delay_ms( 1000 );
}
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.
log_printf( &logger, " Read data : %s", rx_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.Flash8
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.