Intermediate
30 min

Instantly capture and preserve critical data when power is interrupted thanks to the FM24V10 and PIC32MZ1024EFH064

Ferroelectric random-access memory

FRAM 5 Click with PIC32MZ clicker

Published Mar 11, 2023

Click board™

FRAM 5 Click

Dev Board

PIC32MZ clicker

Compiler

NECTO Studio

MCU

PIC32MZ1024EFH064

Instantly capture and preserve critical data

A

A

Hardware Overview

How does it work?

FRAM 5 Click is based on the FM24V10, a 1Mbit ferroelectric random access memory (FRAM) logically organized as 131,072×8 bits and accessed using an industry-standard I2C interface from Infineon. The functional operation of the FRAM is similar to serial I2C EEPROM, where the significant difference between the FM24V10 and EEPROM represents the F-RAM's superior write performance, high endurance, and low power consumption. This Click board™ is ideal for nonvolatile memory applications requiring frequent or rapid writes, where example ranges from data collection to demanding industrial controls where the long write time of serial EEPROM can cause data loss. This Click board™ communicates with MCU using the standard

I2C 2-Wire interface, supporting operation with a clock frequency of up to 3.4MHz. Unlike serial EEPROM, the FM24V10 performs write operations at bus speed, where no write delays are incurred. It provides reliable data retention for 151 years while eliminating the complexities, overhead, and system-level reliability problems caused by EEPROM and other nonvolatile memories. It also supports 10 trillion (1014) read/write cycles or 100 million times more write cycles than EEPROM. Besides, the FM24V10 allows choosing its I2C slave address using the SMD jumpers labeled ADDR SEL. The selection can be made by positioning the SMD jumpers to an appropriate position marked as 1 or 0. An additional feature of this FRAM represents

the configurable Write Protection function labeled as WP routed on the PWM pin of the mikroBUS™ socket. The WP pin protects the entire memory and all registers from write operations and must be set to a high logic state to inhibit all the write operations. All memory and register write are prohibited when this pin is high, and the address counter is not incremented. This Click board™ can only be operated with a 3.3V logic voltage level. The board must perform appropriate logic voltage level 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.

FRAM 5 Click top side image
FRAM 5 Click lateral side image
FRAM 5 Click bottom side image

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.

PIC32MZ clicker double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

1024

Silicon Vendor

Microchip

Pin count

64

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
Write Protect
RB3
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RD10
SCL
I2C Data
RD9
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

FRAM 5 Click Schematic schematic

Step by step

Project assembly

PIC32MZ clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the PIC32MZ clicker as your development board.

PIC32MZ clicker front image hardware assembly
Thermo 26 Click front image hardware assembly
Prog-cut hardware assembly
Micro B Connector clicker - 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
Flip&Click PIC32MZ 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

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.

Software Support

Library Description

This library contains API for FRAM 5 Click driver.

Key functions:

  • fram5_check_communication This function checks the communication by reading and verifying the device ID.

  • fram5_memory_write This function writes a desired number of data bytes starting from the selected memory address.

  • fram5_memory_read This function reads a desired number of data bytes starting from the selected memory address.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief FRAM5 Click example
 *
 * # Description
 * This example demonstrates the use of FRAM 5 click board by writing specified data to
 * the memory and reading it back.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and checks the communication with the click board.
 *
 * ## Application Task
 * Writes a desired number of bytes to the memory and then verifies that it's written correctly
 * by reading from the same memory location and displaying the memory content on the USB UART.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "fram5.h"

static fram5_t fram5;
static log_t logger;

#define DEMO_TEXT_MESSAGE           "MikroE - FRAM 5 click board"
#define STARTING_ADDRESS            0x01234   

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    fram5_cfg_t fram5_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.
    fram5_cfg_setup( &fram5_cfg );
    FRAM5_MAP_MIKROBUS( fram5_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == fram5_init( &fram5, &fram5_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( FRAM5_ERROR == fram5_check_communication ( &fram5 ) )
    {
        log_error( &logger, " Check communication." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    uint8_t data_buf[ 128 ] = { 0 };
    if ( FRAM5_OK == fram5_memory_write ( &fram5, STARTING_ADDRESS, 
                                          DEMO_TEXT_MESSAGE, strlen ( DEMO_TEXT_MESSAGE ) ) )
    {
        log_printf ( &logger, "Data written to address 0x%.5lx: %s\r\n", ( uint32_t ) STARTING_ADDRESS, 
                                                                           ( char * ) DEMO_TEXT_MESSAGE );
    }
    if ( FRAM5_OK == fram5_memory_read ( &fram5, STARTING_ADDRESS, 
                                         data_buf, strlen ( DEMO_TEXT_MESSAGE ) ) )
    {
        log_printf ( &logger, "Data read from address  0x%.5lx: %s\r\n\n", ( uint32_t ) STARTING_ADDRESS, 
                                                                                        data_buf );
        Delay_ms ( 3000 );
    }
}

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.