UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

M24LR64E Class

Module: m24lr64e

The M24LR64E NFC tag is an 8KB electrically erasable programmable read-only memory (EEPROM) that can be written to or read from using I2C and NFC-equipped devices.
The user mode (default) allows read and write access to all 8KB of space, provided the sector security status (SSS) allows it. The root mode allows modification of the SSS data and other information, provided the proper password is submitted. The default password for a new tag is 0x00000000. See the datasheet for more details.
The Seeed Studio* wiki page for this device includes a link to an Android* application that can be used to also read and write the device via NFC, as well as set NFC passwords, which cannot be done via I2C.
m24lr64e.jpg

Methods

M24LR64E

(
  • bus
  • mode
)
Number

M24LR64E constructor

Parameters:

  • bus Number

    I2C bus to use

  • mode AccessMode

    Access mode (user or root) to use

Returns:

Number:

submitPasswd

(
  • passwd
)
Boolean

Submits an I2C access password

Parameters:

  • passwd Number

    4-byte access password

Returns:

Boolean:

writePasswd

(
  • passwd
)
Boolean

Writes a new I2C password

Parameters:

  • passwd Number

    4-byte access password

Returns:

Boolean:

sectorProtectConfig

(
  • sectorNumber
  • protectEnable
  • accessRight
  • passwd
)

Sets a protection bit for a sector. Must be in the root mode

Parameters:

  • sectorNumber Number

    Sector whose protection you are modifying

  • protectEnable Boolean

    True if you are enabling protection

  • accessRight SectorAccessRight

    Access rights to set

  • passwd SectorSelectPassWd

    Password number to enable, if any

clearSectorProtect

()

Clears sector protection bits. Must be in the root mode.

sectorWriteLockBit

(
  • sectorNumber
  • sockEnable
)

Sets or clears a sector security status lock bit for a sector. Must be in the root mode.

Parameters:

  • sectorNumber Number

    Sector whose SSS you want to modify

  • sockEnable Boolean

    True to set the bit, false to clear it

getDSFID

() Number

Returns a data storage family identifier (DSFID) Must be in the root mode.

Returns:

Number:

DSFID

getAFI

() Number

Returns an application family identifier (AFI) Must be in the root mode.

Returns:

Number:

AFI

getUID

() Uint8_t *

Returns a unique ID. Must be in the root mode. Maintained to preserve compatibility with older code.

Returns:

Uint8_t *:

buf Buffer to hold the UID. Must be UID_LENGTH bytes.

getMemorySize

() Number

Returns the memory size Must be in the root mode.

Returns:

Number:

Amount of memory present

clearMemory

()

Sets all memory to 0, if permissions allow

writeByte

(
  • address
  • data
)
Mraa::Result

Writes a byte to the EEPROM

Parameters:

  • address Number

    Address to write to

  • data Number

    Data to write

Returns:

Mraa::Result:

writeBytes

(
  • address
  • buffer
  • len
)
Mraa::Result

Writes bytes to the EEPROM

Parameters:

  • address Number

    Address to write to

  • buffer Uint8_t *

    Data to write

  • len Number

    Length of the data buffer

Returns:

Mraa::Result:

readByte

(
  • address
)
Number

Reads a byte from the EEPROM

Parameters:

  • address Number

    Address to read from

Returns:

Number:

data Value read

readBytes

(
  • address
  • buffer
  • len
)
Number

Reads multiple bytes from the EEPROM

Parameters:

  • address Number

    Address to read from

  • buffer Uint8_t *

    Buffer to store data

  • len Number

    Number of bytes to read

Returns:

Number:

Properties

I2C_PASSWORD_ADDR

Enum M24LR64E_ADDR_T

RF_PASSWORD_1_ADDR

Enum M24LR64E_ADDR_T

RF_PASSWORD_2_ADDR

Enum M24LR64E_ADDR_T

RF_PASSWORD_3_ADDR

Enum M24LR64E_ADDR_T

DSFID_ADDR

Enum M24LR64E_ADDR_T

AFI_ADDR

Enum M24LR64E_ADDR_T

RESV_ADDR

Enum M24LR64E_ADDR_T

CONFIG_ADDR

Enum M24LR64E_ADDR_T

UID_ADDR

Enum M24LR64E_ADDR_T

MEM_SIZE_ADDR

Enum M24LR64E_ADDR_T

IC_REF_ADDR

Enum M24LR64E_ADDR_T

PROG_COMP_ENERGY_HARVEST_ADDR

Enum M24LR64E_ADDR_T

USER_MODE

Enum AccessMode

ROOT_MODE

Enum AccessMode

Access_1110

Enum SectorAccessRight

Access_1111

Enum SectorAccessRight

Access_1100

Enum SectorAccessRight

Access_0111

Enum SectorAccessRight

noPasswd

Enum SectorSelectPassWd

passwd_1

Enum SectorSelectPassWd

passwd_2

Enum SectorSelectPassWd

passwd_3

Enum SectorSelectPassWd