Discover a solution that guarantees data retention for extended periods, offering peace of mind in critical scenarios and safeguarding valuable information against unforeseen events
A
A
Hardware Overview
How does it work?
EEPROM 4 Click is based on the AT25M02, an SPI serial EEPROM from Microchip, with a memory cell density of 2 Mbits. The EEPROM density is usually expressed in bits, so exactly 2,097,152 bits are organized in units or words of 8 bits, which gives 262,144 bytes of data memory. Furthermore, the EEPROM is organized into so-called pages. One page holds 256 bytes, and there are 1024 pages (1024 pages x 256 bytes = 262,144 bytes total). Having insight into how the memory cells are organized is important for write and erase operations. The SPI pins are routed to the mikroBUS™, making communication easy and straightforward. The SPI can be clocked as high as 5MHz, providing a fast throughput for the data transfer. A dedicated #HOLD pin is routed to the PWM pin of the mikroBUS™. When the communication with the click board™ is initiated by setting the CS pin to a LOW logic state, it is possible to pause the serial data transfer without
resetting the communication if the #HOLD pin (PWM pin on the mikroBUS™) is set to a LOW logic state. To resume the communication, setting this pin to a HIGH logic state while the SCK is still running is enough. Once the HOLD is initiated, the state of the SCK line is irrelevant, and any serial data input will be ignored. This pin is pulled HIGH by the onboard resistor. A dedicated #WP write protect pin puts the device into the hardware write protect mode. This pin is routed to the RST pin of the mikroBUS™. Hardware write-protect works with the Write Protect Enable (WPEN) bit of the Status Register. When this bit is set to 1, and the #WP pin is set to a LOW logic state, the device will ignore any attempt to write to the Status Register and the EEPROM memory regions selected by the Block Write Protect bits of the Status Register (BP0 and BP1). WRSR instruction is used to write to the Status Register (01h). Again, WREN instruction should be executed first before
attempting to write to Status Register. Once the WPEN bit is set to 1 and the RST has been pulled to a LOW logic state, setting the WPEN bit to 0 won’t turn off write protection as long as the #WP pin (RST) stays LOW. WPEN bit and the BP0 and BP1 bits are constructed as EEPROM cells, meaning that they are nonvolatile and will retain their states even after power is off. The #WP pin is pulled HIGH by the onboard resistor. As usual, the onboard SMD jumper labeled as VCCSEL is used to select the operating voltage between 3.3V and 5V. However, there’s the third position for this jumper, which sets the operating voltage to 1.8V. This is achieved thanks to the TC1015, a small 100 mA LDO from Microchip powered by the 5V rail. As always, MikroElektronika provides libraries that simplify and speed up working with this device. The provided application example demonstrates the functionality of the provided libraries and can be used as a reference point for own development.
Features overview
Development board
Fusion for STM32 v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 32-bit ARM® Cortex®-M based MCUs from STMicroelectronics, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. 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, Fusion for STM32 v8 provides a fluid and immersive working experience, allowing
access anywhere and under any circumstances at any time. Each part of the Fusion for STM32 v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it 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 HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for STM32 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
Type
8th Generation
Architecture
ARM Cortex-M4
MCU Memory (KB)
512
Silicon Vendor
STMicroelectronics
Pin count
144
RAM (Bytes)
131072
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
Software Support
Library Description
This library contains API for EEPROM 4 Click driver.
Key functions:
eeprom4_write_status_reg
- Status register write functioneeprom4_write_memory
- Memory array write functioneeprom4_read_memory
- Memory array read 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
* \brief Eeprom4 Click example
*
* # Description
* This click reads and writes memory.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes click driver and configures click that all memory block > is unprotected.
* Also configures that HOLD operation is disabled, and the memory and > status register are writable.
*
* ## Application Task
* Enables writting to memory array, writes data from buffer to memory,
* checks if the part is in a write cycle, and if is not reads data > > from memory array and stores data to buffer.
* Storaged data shows on USB UART.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "eeprom4.h"
// ------------------------------------------------------------------ VARIABLES
static eeprom4_t eeprom4;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
eeprom4_cfg_t cfg;
/**
* 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.
eeprom4_cfg_setup( &cfg );
EEPROM4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
eeprom4_init( &eeprom4, &cfg );
eeprom4_default_cfg( &eeprom4 );
}
void application_task ( )
{
uint8_t data_write[ 13 ] = { 'M', 'i', 'K', 'r', 'O', 'e', 0 };
uint8_t data_read[ 255 ] = { 0 };
uint8_t cnt;
uint8_t check_state;
eeprom4_send_command( &eeprom4, EEPROM4_SET_WRITE_ENABLE_LATCH_COMMAND );
eeprom4_write_memory( &eeprom4, EEPROM4_FIRST_MEMORY_LOCATION, data_write, 6 );
cnt = eeprom4_check_status_reg( &eeprom4, EEPROM4_READY_BIT );
check_state = eeprom4_send_command( &eeprom4, EEPROM4_LOW_POWER_WRITE_POLL_COMMAND );
while ( cnt | check_state )
{
cnt = eeprom4_check_status_reg( &eeprom4, EEPROM4_READY_BIT );
check_state = eeprom4_send_command( &eeprom4, EEPROM4_LOW_POWER_WRITE_POLL_COMMAND );
}
eeprom4_read_memory( &eeprom4, 0x00000000, data_read, 6 );
for ( cnt = 0; cnt < 6; cnt++ )
{
log_printf( &logger, " %c ", data_read[cnt] );
}
log_printf( &logger, "----- \r\n" );
Delay_ms( 2000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END