初学者
10 分钟

使用CY14B101J和STM32L496AG确保数据完整性

保存,执行,持久:nvSRAM动力源

nvSRAM Click with Discovery kit with STM32L496AG MCU

已发布 7月 22, 2025

点击板

nvSRAM Click

开发板

Discovery kit with STM32L496AG MCU

编译器

NECTO Studio

微控制器单元

STM32L496AG

我们的nvSRAM解决方案可以保护您的关键数据,以闪电般的速度执行,并确保数据持久性,毫不妥协。

A

A

硬件概览

它是如何工作的?

nvSRAM Click基于CY14B101J,这是一款1M位nvSRAM,组织为128K个8位字,每个字的每个存储单元都具有非易失性元素,来自英飞凌。CY14B101J将SRAM和非易失性存储单元集成到单个nvSRAM单元中。在正常模式下,所有读写操作都直接从nvSRAM的SRAM部分进行。这提供了比EEPROM和Flash等非易失性存储技术更快的写入和读取访问速度。nvSRAM规定了非易失性单元的一百万次耐久循环,数据保持时间最少20年。在系统断电时,来自SRAM的数据通过标记为C2的电容器中储存的能量传输到其非易失性单元。在上电时,非易失性单元中的数据

会自动被召回到SRAM数组中,并提供给用户使用。在关机期间,只有当数据从SRAM单元传输到非易失性单元时,才会消耗耐久循环。nvSRAM Click使用标准I2C 2线接口与MCU通信,在标准模式下时钟频率可达100kHz,在快速模式下可达400kHz,在FastPlus模式下可达1MHz,在高速模式下可达3.4MHz。CY14B101J提供了零周期延迟写操作,具有无限的SRAM写入耐久性。此外,它还允许通过将标记为ADDR SEL的SMD跳线定位到标记为0和1的适当位置,选择其I2C从机地址的最低有效位(LSB)。该Click板的另一个功能代表可配

置的写保护功能,标记为WP,并路由到mikroBUS™插座的PWM引脚。WP引脚是一个主动高电平引脚,用于保护整个存储器和所有寄存器免受写入操作。必须将此引脚保持高电平以禁止所有写操作。当此引脚为高电平时,所有存储器和寄存器写入都被禁止,并且地址计数器不会递增。此Click板只能使用3.3V逻辑电压电平。在使用不同逻辑电平的MCU之前,必须对板进行适当的逻辑电压级转换。此外,它配备有包含功能和示例代码的库,可用作进一步开发的参考。

nvSRAM Click hardware overview image

功能概述

开发板

32L496GDISCOVERY Discovery 套件是一款功能全面的演示和开发平台,专为搭载 Arm® Cortex®-M4 内核的 STM32L496AG 微控制器设计。该套件适用于需要在高性能、先进图形处理和超低功耗之间取得平衡的应用,支持无缝原型开发,适用于各种嵌入式解决方案。STM32L496AG 采用创新的节能架构,集成

了扩展 RAM 和 Chrom-ART 图形加速器,在提升图形性能的同时保持低功耗,使其特别适用于音频处理、图形用户界面和实时数据采集等对能效要求较高的应用。为了简化开发流程,该开发板配备了板载 ST-LINK/V2-1 调试器/编程器,提供即插即用的调试和编程体验,使用户无需额外硬件即可轻松加载、调

试和测试应用程序。凭借低功耗特性、增强的内存能力以及内置调试工具,32L496GDISCOVERY 套件是开发先进嵌入式系统、实现高效能解决方案的理想选择。

Discovery kit with STM32L496AG MCU double side image

微控制器概述 

MCU卡片 / MCU

STM32L496AG Image

建筑

ARM Cortex-M4

MCU 内存 (KB)

1024

硅供应商

STMicroelectronics

引脚数

169

RAM (字节)

327680

使用的MCU引脚

mikroBUS™映射器

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 Protection
PA0
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB8
SCL
I2C Data
PB7
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

nvSRAM Click Schematic schematic

一步一步来

项目组装

Discovery kit with STM32H750XB MCU front image hardware assembly

从选择您的开发板和Click板™开始。以Discovery kit with STM32L496AG MCU作为您的开发板开始。

Discovery kit with STM32H750XB MCU front image hardware assembly
Thermo 21 Click front image hardware assembly
Prog-cut hardware assembly
Board mapper by product7 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
Discovery kit with STM32H750XB MCU NECTO MCU Selection Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto image step 11 hardware assembly

软件支持

库描述

该库包含 nvSRAM Click 驱动程序的 API。

关键功能:

  • nvsram_send_cmd - 该函数向CY14B101J2发送所需的命令

  • nvsram_memory_write - 该函数从目标17位内存地址开始写入顺序数据

  • nvsram_memory_read - 该函数从目标17位内存地址开始读取顺序数据

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * @file main.c
 * @brief nvSRAM Click example
 *
 * # Description
 * This is an example that demonstrates the use of the nvSRAM Click board.
 * In this example, we write and then read data from nvSRAM memory.
 * Results are being sent to the Usart Terminal where you can track their changes.
 * All data logs write on USB uart changes approximately for every 5 sec.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initialization driver enables - I2C, lock Serial Number write, disable Block Protection
 * and enable Memory Write, also write log.
 *
 * ## Application Task
 * Writing data to a memory address, then reading it back and logging it onto uart terminal.
 *
 * @author Stefan Ilic
 *
 */

#include "board.h"
#include "log.h"
#include "nvsram.h"

static nvsram_t nvsram;
static log_t logger;

char demo_data[ 9 ] = { 'm', 'i', 'k', 'r', 'o', 'E', 13 ,10 , 0 };
char read_data[ 9 ];
uint32_t mem_addr;

void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    nvsram_cfg_t nvsram_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 " );
    mem_addr = 1024;

    // Click initialization.
    nvsram_cfg_setup( &nvsram_cfg );
    NVSRAM_MAP_MIKROBUS( nvsram_cfg, MIKROBUS_1 );
    err_t init_flag = nvsram_init( &nvsram, &nvsram_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    log_printf( &logger,  "  Serial Number Lock   \r\n" );
    log_printf( &logger, " None Block Protection \r\n" );
    nvsram_reg_write( &nvsram, NVSRAM_MEM_CTL_REG, NVSRAM_SNL | NVSRAM_BP_NONE );
    Delay_ms ( 100 );
    log_printf( &logger, " Enable Memory Write \r\n" );
    nvsram_enable_memory_write( &nvsram, NVSRAM_WRITE_MEMORY_ENABLE );
    Delay_ms ( 100 );
    
    log_info( &logger, " Application Task \r\n" );
}

void application_task ( void ) {
    log_printf( &logger, "  Write data : %s \r\n", demo_data );
    nvsram_memory_write( &nvsram, mem_addr, &demo_data[ 0 ], 9 );
    log_printf( &logger, "- - - - - - - - - - - - \r\n" );
    Delay_ms ( 100 );

    nvsram_memory_read( &nvsram, mem_addr, &read_data[ 0 ], 9 );
    log_printf( &logger, "  Read data  : %s \r\n", read_data );
    log_printf( &logger, "----------------------- \r\n" );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    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

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。