Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
M25P32 Class Reference

Nol.A library for M25P32 Micron 32Mb Serial NOR Flash Memory. More...

#include <M25P32.hpp>

Inheritance diagram for M25P32:
Storage

Public Member Functions

 M25P32 (uint8_t pinChipSelect, SPI &)
 Bind the active-low chip-select GPIO and SPI bus.
void begin ()
 Initialize chip select, read device information, disable writes, and enter sleep.
uint64_t length ()
 Return the exposed capacity in bytes (0x3F0000), excluding the backup sector.
uint8_t read (uint64_t addr)
 Read one byte at the byte address.
error_t read (void *dst, uint64_t addr, uint32_t len)
 Read bytes into caller-provided storage.
error_t write (uint64_t addr, uint8_t value)
 Write a byte using the sector backup/erase procedure.
error_t write (const uint8_t *buf, uint64_t addr, uint32_t len)
 Rewrite affected sectors via the reserved backup sector.

Detailed Description

Nol.A library for M25P32 Micron 32Mb Serial NOR Flash Memory.

Author
Jongsoo Jeong (CoXlab)
Date
2016. 10. 11.

Blocking SPI NOR flash Storage implementation. Call begin() first. The last 64 KiB sector is reserved for write backup; operations can wait indefinitely for the device to finish programming or erasing.

Member Function Documentation

◆ begin()

void M25P32::begin ( )
virtual

Initialize chip select, read device information, disable writes, and enter sleep.

Implements Storage.

◆ length()

uint64_t M25P32::length ( )
virtual

Return the exposed capacity in bytes (0x3F0000), excluding the backup sector.

Implements Storage.

◆ read() [1/2]

uint8_t M25P32::read ( uint64_t addr)
virtual

Read one byte at the byte address.

Returns
Read value, or 0xFF on invalid address (also a valid stored value).

Implements Storage.

◆ read() [2/2]

error_t M25P32::read ( void * dst,
uint64_t addr,
uint32_t len )
virtual

Read bytes into caller-provided storage.

Parameters
dstWritable buffer of at least len bytes.
addrStarting byte address; keep the entire range within length().
lenNonzero byte count.
Returns
ERROR_INVALID_ARGS for an invalid start or zero length, otherwise ERROR_SUCCESS.

Implements Storage.

◆ write() [1/2]

error_t M25P32::write ( const uint8_t * buf,
uint64_t addr,
uint32_t len )
virtual

Rewrite affected sectors via the reserved backup sector.

Parameters
bufSource buffer containing at least len bytes.
addrStarting byte address; keep the entire range within length().
lenNonzero byte count.
Returns
ERROR_INVALID_ARGS for an invalid start or zero length; otherwise ERROR_FAIL even after programming, matching the current implementation.

Implements Storage.

◆ write() [2/2]

error_t M25P32::write ( uint64_t addr,
uint8_t value )
virtual

Write a byte using the sector backup/erase procedure.

Parameters
addrTarget byte address below length().
valueByte to store.
Returns
ERROR_INVALID_ARGS for an invalid address; otherwise ERROR_FAIL even after programming, matching the current implementation.

Implements Storage.


The documentation for this class was generated from the following file: