Intermediate
30 min

Achieve the perfect balance of speed, efficiency, and data density with MB85AS8MT and PIC32MZ2048EFM100

Say goodbye to lag with ReRAM's lightning-fast speed

ReRAM 2 Click with Curiosity PIC32 MZ EF

Published Oct 18, 2023

Click board™

ReRAM 2 Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Enhance your data storage capabilities with ReRAM, the innovative solution that's redefining how we store and access information

A

A

Hardware Overview

How does it work?

ReRAM 2 Click is based on the MB85AS8MT, a highly reliable 8Mbit resistive random-access memory (ReRAM) organized as 1,048,576 words of 8 bits from Fujitsu Semiconductor. It uses the resistance-variable memory process and silicon-gate CMOS process technologies to form nonvolatile memory cells. The MB85AS8MT specifies 1.000.000 endurance cycles with data retention of a minimum of 10 years, which gives the MB85AS8MT the capability to handle unlimited reads/writes to the memory. One prominent feature of the MB85AS8MT is an extremely small average current, despite its large density, for reading operations of 0.15mA at an operating frequency of 5MHz, which is only 5% of

large-density EEPROM devices. This feature enables minimal power consumption when in applications with frequent data-read operations. Besides higher write endurance, it has faster write speeds than EEPROM and flash memory, while its electric specifications, such as commands and timings, are compatible with EEPROM products. The ReRAM 2 Click communicates with MCU through a standard SPI interface that enables high clock speeds up to 10MHz, supporting the two most common SPI modes, SPI Mode 0 and 3. An additional feature of this Click board™ 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 low logic state to inhibit all the write operations. All memory and register write are prohibited when this pin is low, and the address counter is not incremented. Besides, the ReRAM 2 Click also has an additional HOLD pin, routed to the RST pin of the mikroBUS™ socket labeled as HO, to interrupt a serial operation without aborting it. 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.

ReRAM 2 Click top side image
ReRAM 2 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
Data Transfer Pause
RA9
RST
SPI Chip Select
RPD4
CS
SPI Clock
RPD1
SCK
SPI Data OUT
RPD14
MISO
SPI Data IN
RPD3
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Write Protection
RPE8
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

ReRAM 2 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 ReRAM 2 Click driver.

Key functions:

  • reram2_read_device_id - ReRAM 2 read device ID function.

  • reram2_write_memory - ReRAM 2 write memory function.

  • reram2_read_memory - ReRAM 2 read memory 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 ReRAM2 Click example
 *
 * # Description
 * This library contains API for ReRAM 2 Click driver.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes SPI driver and log UART.
 * After driver initialization the app set default settings, 
 * performs device wake-up, check Device ID,
 * set Write Enable Latch command and write demo_data string ( mikroE ), 
 * starting from the selected memory_addr ( 1234 ).
 *
 * ## Application Task
 * This is an example that demonstrates the use of the ReRAM 2 Click board™.
 * In this example, we read and display a data string, which we have previously written to memory, 
 * starting from the selected memory_addr ( 1234 ).
 * Results are being sent to the Usart Terminal where you can track their changes.
 *
 * @author Nenad Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "reram2.h"

static reram2_t reram2;
static log_t logger;
static char demo_data[ 9 ] = { 'm', 'i', 'k', 'r', 'o', 'E', 13 ,10 , 0 };
static uint32_t memory_addr;

void application_init ( void )
{
    log_cfg_t log_cfg;        /**< Logger config object. */
    reram2_cfg_t reram2_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.
    reram2_cfg_setup( &reram2_cfg );
    RERAM2_MAP_MIKROBUS( reram2_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == reram2_init( &reram2, &reram2_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( RERAM2_ERROR == reram2_default_cfg ( &reram2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    reram2_wake_up( &reram2 );
    Delay_ms( 100 );
    
    if ( RERAM2_ERROR == reram2_check_device_id( &reram2 ) )
    {
        log_error( &logger, " Communication Error. " );
        log_info( &logger, " Please, run program again... " );
        for( ; ; );
    }

    reram2_send_command( &reram2, RERAM2_CMD_WREN );
    Delay_ms( 100 );
    
    log_info( &logger, " Application Task " );
    
    memory_addr = 1234;   
    log_printf( &logger, "\r\n  Write data : %s", demo_data );
    reram2_write_memory( &reram2, memory_addr, &demo_data[ 0 ], 9 );
    log_printf( &logger, "-----------------------\r\n" );
    Delay_ms( 1000 );
}

void application_task ( void )
{
    static char rx_data[ 9 ] = { 0 };
    
    reram2_read_memory( &reram2, memory_addr, &rx_data[ 0 ], 9 );
    log_printf( &logger, "  Read data  : %s", rx_data ); 
    log_printf( &logger, "-----------------------\r\n" );
    Delay_ms( 2000 );
}

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.