Beginner
10 min

Eliminate the fear of data loss with the combination of 47L16 and PIC32MZ2048EFM100

SRAM power, EEPROM persistence: Your data's best friend

EERAM 3.3V Click with Curiosity PIC32 MZ EF

Published Oct 26, 2023

Click board™

EERAM 3.3V Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Our SRAM memory with non-volatile EEPROM backup ensures your data is safe and ready when you need it

A

A

Hardware Overview

How does it work?

EERAM 3.3V Click is based on the 47L16, an I2C serial chip with 16 Kbit and EEPROM backup, from Microchip. The memory cells are organized into 2048 bytes, each 8bit wide. The data is read and written by the I2C serial communication bus, routed to the respective pins of the mikroBUS™ (SCL and SDA pins). To access the device, the first byte sent from the host MCU should be the I2C slave address. In most cases, the master I2C device will be the host MCU itself. The slave IC2 address depends on the state of the hardware address pins on the EERAM 3.3V click. These pins are routed to the onboard SMD jumpers, labeled as A1

and A2, so they can be pulled either to a HIGH or to a LOW logic level. Besides the address pins, the I2C slave address is determined by the section of the device that needs to be accessed. There are two sections, accessed by a different slave address: SRAM section and the CONTROL REGISTER section. The datasheet of the 47l16_3v3 contains more information on these addresses and how to access certain groups of registers. However, provided click library functions allow easy and transparent operation with the EERAM 3.3V click. The provided example application demonstrates the usage of these library functions, and it can be

used as a reference for future custom application development. The store to EEPROM/backup function will not be executed if the SDRAM content has not been changed since the last time it was written to EEPROM. This is tracked by the AN bit of the status register. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.

EERAM 3.3V Click top side image
EERAM 3.3V Click bottom side image

Features overview

Development board

Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand

functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,

which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.

Curiosity PIC32MZ EF double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
HW Store / Event Detect
RF13
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RPA14
SCL
I2C Data
RPA15
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

EERAM 3.3V Click Schematic schematic

Step by step

Project assembly

Curiosity PIC32MZ EF front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity PIC32 MZ EF as your development board.

Curiosity PIC32MZ EF front image hardware assembly
Thermo 28 Click front image hardware assembly
Prog-cut hardware assembly
Curiosity PIC32 MZ EF MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Curiosity PIC32 MZ EF MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for EERAM 3.3V Click driver.

Key functions:

  • eeram3v3_generic_write - This function writes a desired number of data bytes starting from the selected register by using I2C serial interface

  • eeram3v3_generic_read - This function reads a desired number of data bytes starting from the selected register by using I2C serial interface

  • eeram3v3_status_write - Status register contains settings for write protection and auto-store function. Use this function to configure them

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 EERAM3v3 Click example
 *
 * # Description
 * This example show using EERAM click to store the data to the SRAM ( static RAM ) memory.
 * The data is read and written by the I2C serial communication bus, and the memory cells 
 * are organized into 2048 bytes, each 8bit wide.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * EERAM driver nitialization.
 *
 * ## Application Task
 * Writing data to click memory and displaying the read data via UART. 
 * 
 * @author Jelena Milosavljevic
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "eeram3v3.h"

// ------------------------------------------------------------------ VARIABLES

static eeram3v3_t eeram3v3;
static log_t logger;

static char wr_data[ 20 ] = { 'M', 'i', 'k', 'r', 'o', 'E', 13, 10, 0 };
static char rd_data[ 20 ];

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void ) {
    log_cfg_t log_cfg;             /**< Logger config object. */
    eeram3v3_cfg_t eeram3v3_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.
    
    eeram3v3_cfg_setup( &eeram3v3_cfg );
    EERAM3V3_MAP_MIKROBUS( eeram3v3_cfg, MIKROBUS_1 );
    err_t init_flag = eeram3v3_init( &eeram3v3, &eeram3v3_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

void application_task ( void ){
    log_info( &logger, "Writing MikroE to  SRAM memory, from address 0x0150:" );
    eeram3v3_write( &eeram3v3, 0x0150, &wr_data, 9 );
    log_info( &logger, "Reading 9 bytes of SRAM memory, from address 0x0150:" );
    eeram3v3_read( &eeram3v3, 0x0150, &rd_data, 9 );
    log_info( &logger, "Data read: %s", rd_data );
    Delay_ms( 1000 );
}
void main ( void ) {
    application_init( );

    for ( ; ; ) {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.