Intermediate
30 min

Secure data integrity with CY15B104Q and STM32F413ZH

FRAM unveils the future of data handling!

FRAM 2 Click with Nucleo 144 with STM32F413ZH MCU

Published Feb 14, 2024

Click board™

FRAM 2 Click

Dev Board

Nucleo 144 with STM32F413ZH MCU

Compiler

NECTO Studio

MCU

STM32F413ZH

Utilize FRAM's non-volatile and fast-write characteristics to ensure data integrity and responsiveness in critical systems

A

A

Hardware Overview

How does it work?

FRAM 2 Click is based on the CY15B104Q, a 4 Mbit serial ferroelectric (FRAM) module from Infineon. It contains 4,194,304 bits of memory, organized in 524,288 byes. This means that the storage area contains 512 KB of address space. This memory IC is manufactured using ferroelectric technology, which has many advantages over the conventional technologies used for manufacturing EEPROM and FLASH memory modules. Ferroelectric technology is still being developed and perfected, but the advantages have already been demonstrated. This technology exploits the properties of ferroelectric materials to retain the electric field after exposure, the same way the ferromagnetic materials retain their magnetic field. This phenomenon is employed to polarize the FRAM cells and store the information. One area that still needs improvement is the thermal instability, especially at high temperatures. When the ferroelectric material reaches the Curie temperature, its properties are degraded. Therefore, the high temperature might damage the content of the FRAM module. This is illustrated by the data retention period: while working at 85˚C, the data retention period is reduced to 10 years. At 65˚C, the data retention period stretches to over 150 years. Still, combined with the endurance of 1014 read/write cycles at bus write speed, this type of memory still represents an ideal solution for applications with frequent writing to non-volatile memory locations. This Click board™ uses the SPI communication protocol, allowing fast serial clock rates. The device employs certain protection mechanisms to ensure reliable data transactions and avoid accidental writing to the memory array. The WEL bit must be set before

writing any data to the IC, which modifies registers or the array itself. This bit is cleared after or during every memory modification instruction. Therefore, every memory modification instruction must be prefixed with the Write Enable (WREN) instruction that sets this bit to 1. This mechanism ensures that only the intended write instruction will be executed. The host MCU initiates Communication with the device, which drives the chip select pin (#CS on the schematic) to a LOW logic level. This pin is routed to the mikroBUS™ CS pin. The next byte of information can be either command or data. Usually, the first byte is the instruction (command) followed by the memory address. Depending on the command sent, either the memory is written to or read from the specific memory address. The memory address on this device is 19-bit (0x00000 to 0x7FFFF), and therefore, it is sent by 3 bytes. Several instruction codes can be sent after the CS pin is driven to a LOW logic level. These include Write Enable, Write to the memory array, Read from the memory array, Write Status Register, Read Status Register, and so on. For a full list of commands and their detailed description, please refer to the datasheet of the CY15B104Q IC. When using the write-to-array instruction, it is possible to write the whole array while keeping the CS line to a LOW logic level, as the internal address pointer will increase with each received byte of data. Once the end of the array is reached (address 0x7FFFF), the internal pointer will roll over from the beginning (0x00000). An obvious advantage over the traditional EEPROM can be observed here: on a traditional EEPROM, the memory is organized in pages, usually 256 bytes long, which allows

buffering of the data because of the inherently slow write operation. The FRAM memory does not use pages because the memory is written faster than the SPI bus can deliver new information (the data is written at bus speed). Therefore, no buffering is required, and the whole array can be sequentially written. The CY15B104Q includes the write protection of the specific parts or the whole memory array. The write protection consists of two bits in the Status Register (B0, B1). The Write Status Register instruction can set or reset these bits. B0 and B1 bits control the write-protect status of the memory array (from one-quarter to full memory array protection). These bits are non-volatile, and their state is retained between the power cycles. The #WP pin is used to lock the Status Register. When this pin is driven to a LOW level, no further modifications to the Status register are possible, and the instructions used to change bits in this register (Write Enable and Write Status Register) are completely ignored. Driving this pin to a LOW state effectively acts as the hardware memory write-protect lock mechanism. The WPEN bit of the status register can completely turn off this pin: if the WPEN bit is cleared (0), this pin will not affect the CY15B104Q IC. The #WP pin is routed to the mikroBUS™ RST pin and labeled as WP. The FRAM 2 click allows hold of the communication in progress. If the #HOLD pin is driven to a LOW logic level on the LOW pulse of the serial clock signal (SCK), the communication will be paused but not aborted. Driving this pin to a HIGH logic level will resume the data transfer. This pin is routed to the mikroBUS™ PWM pin, labeled as HLD.

FRAM 2 Click top side image
FRAM 2 Click bottom side image

Features overview

Development board

Nucleo-144 with STM32F413ZH MCU board offers an accessible and adaptable avenue for users to explore new ideas and construct prototypes. It allows users to tailor their experience by selecting from a range of performance and power consumption features offered by the STM32 microcontroller. With compatible boards, the

internal or external SMPS dramatically decreases power usage in Run mode. Including the ST Zio connector, expanding ARDUINO Uno V3 connectivity, and ST morpho headers facilitate easy expansion of the Nucleo open development platform. The integrated ST-LINK debugger/programmer enhances convenience by

eliminating the need for a separate probe. Moreover, the board is accompanied by comprehensive free software libraries and examples within the STM32Cube MCU Package, further enhancing its utility and value.

Nucleo 144 with STM32F413ZH MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

1536

Silicon Vendor

STMicroelectronics

Pin count

144

RAM (Bytes)

327680

You complete me!

Accessories

Click Shield for Nucleo-144 comes equipped with four mikroBUS™ sockets, with one in the form of a Shuttle connector, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-144 board with no effort. This way, MIKROE allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. Featuring an ARM Cortex-M microcontroller, 144 pins, and Arduino™ compatibility, the STM32 Nucleo-144 board offers limitless possibilities for prototyping and creating diverse applications. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-144 board out of the box, with an additional USB cable connected to the USB mini port on the board. Simplify your project development with the integrated ST-Link debugger and unleash creativity using the extensive I/O options and expansion capabilities. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-144 board with our Click Shield for Nucleo-144, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Nucleo-144 accessories 1 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Write Protect
PA13
RST
SPI Chip Select
PA4
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Data Transfer Pause
PC6
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

Click board™ Schematic

FRAM 2 Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-144 accessories 1 image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo 144 with STM32F413ZH MCU as your development board.

Click Shield for Nucleo-144 accessories 1 image hardware assembly
Nucleo 144 with STM32F413ZH MCU front image hardware assembly
Barometer 13 Click front image hardware assembly
Prog-cut hardware assembly
Nucleo 144 with STM32F413ZH MCU 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
STM32F413ZH Nucleo 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 2 Click driver.

Key functions:

  • fram2_read - This function reads content from address and saves it to buffer

  • fram2_write - This function writes content from buffer to address

  • fram2_read_status - This function reads content of FRAM status register

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 
 * \brief FRAM2 Click example
 * 
 * # Description
 * This example performs write & read operation to certain register.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initiazlize device and enable write operation.
 * 
 * ## Application Task  
 * Write value 42 to register 0x10 and check if operation was done properly.
 * 
 * *note:* 
 * data_to_write variable is declared as const, so compiler may warn user 
 * about 'suspisuous pointer conversion'. Note it is the case only with this
 * code snippet but user has freedom to use driver functions as he wishes.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "fram2.h"
#include <string.h>

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

static fram2_t fram2;
static log_t logger;

static uint8_t data_to_write[ 3 ] = { '4', '2', 0 };
static uint8_t read_buf [ 32 ];
static uint32_t test_addr;

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

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

    fram2_cfg_setup( &cfg );
    FRAM2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    fram2_init( &fram2, &cfg );
    fram2_default_cfg ( &fram2 );
}

void application_task ( void )
{
    log_info( &logger, "Writing value 42 into register 0x10..." );  
    test_addr = 0x0010;  
    fram2_write( &fram2, test_addr, data_to_write, 3 );
    Delay_ms( 200 );

    log_info( &logger, "Reading from register 0x10..." );
    memset( read_buf, 0, 32 );
    Delay_ms( 500 );
    
    fram2_read( &fram2, test_addr, read_buf, 3 );
    log_printf ( &logger, "Read value: %s\r\n\n", read_buf );
    Delay_ms( 500 );
}

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.