MRAM 3 click
MRAM 3 Click is a compact add-on board representing a magneto-resistive random-access memory solution. This board features the AS3001204, 1Mb high-performance serial SPI MRAM memory organized as 128K words of 8 bits each from Avalanche Technology. The MRAM technology is analog to Flash technology with SRAM compatible read/write timings (Persistent SRAM, P-SRAM), where data is always non-volatile. It also has a hardware write-protection feature and performs read and write operations with data retention for one million years and a write endurance of 1014 cycles.
click Product page
Click library
- Author : Stefan Filipovic
- Date : May 2022.
- Type : SPI type
Software Support
We provide a library for the MRAM 3 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for MRAM 3 Click driver.
Standard key functions :
mram3_cfg_setup
Config Object Initialization function.
void mram3_cfg_setup(mram3_cfg_t *cfg)
MRAM 3 configuration object setup function.
MRAM 3 Click configuration object.
Definition mram3.h:293
mram3_init
Initialization function.
err_t mram3_init(mram3_t *ctx, mram3_cfg_t *cfg)
MRAM 3 initialization function.
MRAM 3 Click context object.
Definition mram3.h:276
mram3_default_cfg
Click Default Configuration function.
err_t mram3_default_cfg(mram3_t *ctx)
MRAM 3 default configuration function.
Example key functions :
mram3_memory_write
This function writes a desired number of data bytes starting from the selected memory address.
err_t mram3_memory_write(mram3_t *ctx, uint32_t address, uint8_t *data_in, uint32_t len)
MRAM 3 memory write function.
mram3_memory_read
This function reads a desired number of data bytes starting from the selected memory address.
err_t mram3_memory_read(mram3_t *ctx, uint32_t address, uint8_t *data_out, uint32_t len)
MRAM 3 memory read function.
mram3_aug_memory_write
This function writes a desired number of data bytes starting from the selected augmented memory address.
err_t mram3_aug_memory_write(mram3_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len)
MRAM 3 aug memory write function.
Example Description
This example demonstrates the use of MRAM 3 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 performs the click default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR ==
mram3_init( &mram3, &mram3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define MRAM3_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition mram3.h:260
void application_init(void)
Definition main.c:33
@ MRAM3_ERROR
Definition mram3.h:318
Application Task
Writes a desired number of bytes to the memory and then verifies if it is written correctly by reading from the same memory location and displaying the memory content on the USB UART.
{
uint8_t data_buf[ 128 ] = { 0 };
data_buf, sizeof ( data_buf ) ) )
{
log_printf ( &logger,
"Data written to address 0x%.5LX: %s\r\n", ( uint32_t )
STARTING_ADDRESS,
data_buf );
}
memset ( data_buf, 0, sizeof ( data_buf ) );
data_buf, sizeof ( data_buf ) ) )
{
log_printf ( &logger,
"Data read from address 0x%.5LX: %s\r\n", ( uint32_t )
STARTING_ADDRESS,
data_buf );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
data_buf, sizeof ( data_buf ) ) )
{
log_printf ( &logger,
"Data written to address 0x%.5LX: %s\r\n", ( uint32_t )
STARTING_ADDRESS,
data_buf );
}
memset ( data_buf, 0, sizeof ( data_buf ) );
data_buf, sizeof ( data_buf ) ) )
{
log_printf ( &logger,
"Data read from address 0x%.5LX: %s\r\n\n", ( uint32_t )
STARTING_ADDRESS,
data_buf );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
void application_task(void)
Definition main.c:69
#define DEMO_TEXT_MESSAGE_2
Definition main.c:30
#define DEMO_TEXT_MESSAGE_1
Definition main.c:29
#define STARTING_ADDRESS
Definition main.c:31
@ MRAM3_OK
Definition mram3.h:317
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.MRAM3
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.