Intermediate
30 min

Achieve best-in-class non-volatile memory with long data retention using MR25H256 and MK64FN1M0VDC12

Dive into the world of MRAM

MRAM Click with Clicker 2 for Kinetis

Published Sep 13, 2023

Click board™

MRAM Click

Dev Board

Clicker 2 for Kinetis

Compiler

NECTO Studio

MCU

MK64FN1M0VDC12

Trust MRAM as your data's guardian. Our solution offers persistent memory with rapid read and write capabilities, ensuring data integrity and fast access for applications where reliability is paramount.

A

A

Hardware Overview

How does it work?

MRAM Click is based on the MR25H256, a 256 kilobits serial SPI MRAM memory module from Everspin company. This module contains 262,144 bits of memory that can be randomly accessed. The pinout of the used memory module is the same as most commonly used EEPROM modules so that it can directly replace it. The usual SPI lines - SO, SI, SCK and #CS pins from the MR25H256 IC are routed to the mikroBUS™ SPI port (MISO, MOSI, SCK and CS pins). Besides the SPI serial bus, there are two more pins routed to the mikroBUS™. The #HOLD pin of the MR25H256 IC is routed to the INT pin of the mikroBUS™ and it is used to hold the data transfer. When this pin is pulled to a LOW logic level, all data transfer operations are suspended. However, this function is enabled only when the device is already addressed with the CS pin pulled to a LOW level.

This allows to pause the data transfer and resume it later without the need to first address it via the CS pin, reducing the output latency that way. While the data transfer is paused, the SO pin will switch to a high impedance mode (HIGH Z) and will remain inactive. The SCK pulses are completely ignored. The #HOLD pin of the MR25H256 IC is pulled to a HIGH logic level by an onboard pull-up resistor. The #WP pin of the MR25H256 IC is routed to the INT pin of the mikroBUS™ and it is used to prevent writes to the status register, acting as a hardware write protect pin. It is routed to the RST pin of the mikroBUS™. The logical organization of the moduke, such as read and write commands and the status register of the MR25H256 IC are the same as with most commonly used EEPROM modules, such as the one used in EEPROM 4 Click. That allows this

memory module, as well as MRAM click to replace the existing EEPROM module with not too much additional work. The provided libraries offer all the functions needed to work with the MRAM click. Their usage is demonstrated in the included example application which can be used as a reference for further development. The device should wait for the system voltage to become stable before the writing is attempted. 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.

MRAM Click top side image
MRAM Click bottom side image

Features overview

Development board

Clicker 2 for Kinetis 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 ARM Cortex-M4F microcontroller, the MK64FN1M0VDC12 from NXP Semiconductors, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a JTAG programmer connector, and two 26-pin headers for interfacing with external electronics. Its compact design with clear and easily recognizable silkscreen markings allows you to build gadgets with unique functionalities and

features quickly. Each part of the Clicker 2 for Kinetis development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Clicker 2 for Kinetis programming method, using a USB HID mikroBootloader or an external mikroProg connector for Kinetis programmer, the Clicker 2 board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Micro-B cable, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or

using a Li-Polymer battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several user-configurable buttons and LED indicators. Clicker 2 for Kinetis 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.

Clicker 2 for Kinetis dimensions image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

NXP

Pin count

121

RAM (Bytes)

262144

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Write Protect
PB11
RST
SPI Chip Select
PC4
CS
SPI Clock
PC5
SCK
SPI Data OUT
PC7
MISO
SPI Data IN
PC6
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Data Transfer Pause
PB13
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

MRAM Click Schematic schematic

Step by step

Project assembly

Clicker 2 for PIC32MZ front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Clicker 2 for Kinetis as your development board.

Clicker 2 for PIC32MZ front image hardware assembly
Buck 22 Click front image hardware assembly
Prog-cut hardware assembly
Micro B Connector Clicker 2 - 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 via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for MRAM Click driver.

Key functions:

  • mram_write_data_bytes - Function writes n bytes of data from the buffer

  • mram_read_data_bytes - Function reads n bytes of data and saves it in buffer

  • mram_enable_write_protect - Function enables or disables write protect.

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 MRAM Click example
 * 
 * # Description
 * This example writes and reads from the Mram Click and displays it on the terminal.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes click driver.
 * 
 * ## Application Task  
 * Writes 10 bytes of buffer data in memory with start address 0x0001. Then reads
 * 10 bytes from memory with start address 0x0001 and shows result on USB UART.
 * 
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "mram.h"

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

static mram_t mram;
static log_t logger;

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

void application_init ( void )
{
    log_cfg_t log_cfg;
    mram_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.

    mram_cfg_setup( &cfg );
    MRAM_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    mram_init( &mram, &cfg );
    mram_default_cfg( &mram );
    
}

void application_task ( void )
{
    uint8_t number_bytes_write;
    uint8_t number_bytes_read;
    uint16_t i;
    uint8_t data_write[ 10 ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    uint8_t data_read[ 20 ] = { 0 };
    
    number_bytes_write = 10;
    number_bytes_read = 10;

    log_printf( &logger, " Data written!\r\n" );
    mram_write_data_bytes ( &mram, 0x0001, data_write, number_bytes_write );
    
    log_printf( &logger, " Read data:\r\n" );
    mram_read_data_bytes ( &mram, 0x0001, data_read, number_bytes_read );
    
    for ( i = 0; i < number_bytes_read; i++ )
    {
        log_printf( &logger, "%d ", ( uint16_t )data_read[ i ] );
    }
    
    log_printf( &logger, "\n" );

    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

// ------------------------------------------------------------------------ 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.