Thanks to visit codestin.com
Credit goes to github.com

Skip to content

7omg/MR25HXXX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MR25HXXX

This library aims to support the following MRAM memory chips from Everspin Technologies for Arduino core:

Name Size Datasheet Tested
MR25H128 128 Kb link Yes (on Arduino Nano)
MR25H256 256 Kb link No
MR25H10 1 Mb link No
MR25H40 4 Mb link No

Examples

See examples/ folder.

Documentation

Classes

Available classes are:

  • MR25H128
  • MR25H256
  • MR25H10
  • MR25H40

The first two chips only need two bytes (uint16_t) to address all the memory on the chip. The last two require three bytes (uint32_t). The following documentation uses addr_t to describe the addressing datatype.

Memory Protection Modes

The MR25HXXX family supports four different memory protection modes:

Mode Info
MR25HXXX::ProtectionMode::PROT_NONE Every memory cell can be written
MR25HXXX::ProtectionMode::PROT_UQ Only the first 3/4 of memory can be written
MR25HXXX::ProtectionMode::PROT_UH Only the first 1/2 of memory can be written
MR25HXXX::ProtectionMode::PROT_ALL No memory cell can be written

Methods

Each class provides the following methods. Look into source code for more documentation.

Get total number of bytes in memory:

  • addr_t memorySize()

(Un-)Initialize the mram chip object:

  • void begin()
  • void end()

Methods for direct status register manipulation (not recommended to do manually):

  • StatusRegister readStatusRegister()
  • void writeStatusRegister(StatusRegister sr)
  • void enableWriteStatusRegister()
  • void disableWriteStatusRegister()
  • bool isStatusRegisterWritable(StatusRegister sr)
  • bool isStatusRegisterWritable()
  • bool isWriteEnabled()

Get/set memory protection mode:

  • ProtectionMode getProtectionMode(StatusRegister sr)
  • ProtectionMode getProtectionMode()
  • void setProtectionMode(ProtectionMode pmode)

Read/write methods:

  • void enableWrite(): does not need to be called explicitly before write operation, but saves a few cpu cycles
  • void disableWrite()
  • bool readBytes(uint8_t *dst, addr_t address, addr_t n)
  • bool writeBytes(addr_t address, uint8_t *src, addr_t n)

Power saving:

  • void sleep()
  • void wake()
  • bool isSleeping(): every command sent while sleeping will be ignored

Helper functions:

  • void eraseChip(uint8_t value = 0xff)
  • void eraseFullChip(uint8_t value = 0xff)

About

Library to communicate with the MR25HXXX family of MRAM chips from Everspin Technologies

Topics

Resources

License

Stars

Watchers

Forks

Languages