Suga koubou / at45db161d

Dependents:   AT45DB161D SPIFLASH_AT45DB n-bed_AT45DB161E AT45DB161D

Embed: (wiki syntax)

« Back to documentation index

ATD45DB161D Class Reference

at45db161d module More...

#include <at45db161d.h>

Data Structures

struct  ID
 ID structure This structure contains various informations about the dataflash chip being used. More...

Public Member Functions

 ATD45DB161D (PinName mosi, PinName miso, PinName sclk, PinName cs)
 CTOR.
 ~ATD45DB161D ()
 DTOR.
void Init ()
 Setup SPI and pinout.
uint8_t ReadStatusRegister ()
 Read status register.
void ReadManufacturerAndDeviceID (struct ATD45DB161D::ID *id)
 Read Manufacturer and Device ID.
void ReadMainMemoryPage (uint16_t page, uint16_t offset)
 A main memory page read allows the user to read data directly from any one of the 4096 pages in the main memory, bypassing both of the data buffers and leaving the contents of the buffers unchanged.
void ContinuousArrayRead (uint16_t page, uint16_t offset, uint8_t low)
 Sequentially read a continuous stream of data.
void BufferRead (uint8_t bufferNum, uint16_t offset, uint8_t low)
 Read the content of one of the SRAM data buffers (in low or high speed mode).
void BufferWrite (uint8_t bufferNum, uint16_t offset)
 Write data to one of the SRAM data buffers.
void BufferToPage (uint8_t bufferNum, uint16_t page, uint8_t erase)
 Transfer data from buffer 1 or 2 to main memory page.
void PageToBuffer (uint16_t page, uint8_t bufferNum)
 Transfer a page of data from main memory to buffer 1 or 2.
void PageErase (uint16_t page)
 Erase a page in the main memory array.
void BlockErase (uint16_t block)
 Erase a block of eight pages at one time.
void SectoreErase (uint8_t sector)
 Erase a sector in main memory.
void ChipErase ()
 Erase the entire chip memory.
void BeginPageWriteThroughBuffer (uint16_t page, uint16_t offset, uint8_t bufferNum)
 This a combination of Buffer Write and Buffer to Page with Built-in Erase.
void EndAndWait ()
 Perform a low-to-high transition on the CS pin and then poll the status register to check if the dataflash is busy.
int8_t ComparePageToBuffer (uint16_t page, uint8_t bufferNum)
 Compare a page of data in main memory to the data in buffer 1 or 2.
void DeepPowerDown ()
 Put the device into the lowest power consumption mode.
void ResumeFromDeepPowerDown ()
 Takes the device out of Deep Power-down mode.

Detailed Description

at45db161d module

Definition at line 131 of file at45db161d.h.


Constructor & Destructor Documentation

ATD45DB161D ( PinName  mosi,
PinName  miso,
PinName  sclk,
PinName  cs 
)

CTOR.

AT45DB161D module for arduino (C) Vincent SPI flash memory http://blog.blockos.org/?p=27.

bug fix by todotani http://todotani.cocolog-nifty.com/blog/2009/07/arduino-4cf4.html

Modified for mbed, 2011 Suga. CTOR

Definition at line 14 of file at45db161d.cpp.

~ATD45DB161D (  )

DTOR.

Definition at line 23 of file at45db161d.cpp.


Member Function Documentation

void BeginPageWriteThroughBuffer ( uint16_t  page,
uint16_t  offset,
uint8_t  bufferNum 
)

This a combination of Buffer Write and Buffer to Page with Built-in Erase.

Note:
You must call EndAndWait in order to start transfering data from buffer to page
Parameters:
pagePage where the content of the buffer will transfered
offsetStarting byte address within the buffer
bufferNumBuffer to use (1 or 2)
Warning:
UNTESTED

Definition at line 425 of file at45db161d.cpp.

void BlockErase ( uint16_t  block )

Erase a block of eight pages at one time.

Parameters:
blockIndex of the block to erase
Warning:
UNTESTED
Parameters:
blockIndex of the block to erase

Definition at line 320 of file at45db161d.cpp.

void BufferRead ( uint8_t  bufferNum,
uint16_t  offset,
uint8_t  low 
)

Read the content of one of the SRAM data buffers (in low or high speed mode).

Parameters:
bufferNumBuffer to read (1 or 2)
offsetStarting byte within the buffer
lowIf true the read operation will be performed in low speed mode (and in high speed mode if it's false).

Definition at line 158 of file at45db161d.cpp.

void BufferToPage ( uint8_t  bufferNum,
uint16_t  page,
uint8_t  erase 
)

Transfer data from buffer 1 or 2 to main memory page.

Parameters:
bufferNumBuffer to use (1 or 2)
pagePage where the content of the buffer will transfered
eraseIf set the page will be first erased before the buffer transfer.
Note:
If erase is equal to zero, the page must have been previously erased using one of the erase command (Page or Block Erase).

Definition at line 216 of file at45db161d.cpp.

void BufferWrite ( uint8_t  bufferNum,
uint16_t  offset 
)

Write data to one of the SRAM data buffers.

Any further call to spi_tranfer will return bytes contained in the data buffer until a low-to-high transition is detected on the CS pin. If the end of the data buffer is reached, the device will wrap around back to the beginning of the buffer.

Parameters:
bufferNumBuffer to read (1 or 2)
offsetStarting byte within the buffer

Definition at line 193 of file at45db161d.cpp.

void ChipErase (  )

Erase the entire chip memory.

Sectors proteced or locked down will not be erased.

Warning:
UNTESTED

Sectors proteced or locked down will not be erased.

Definition at line 397 of file at45db161d.cpp.

int8_t ComparePageToBuffer ( uint16_t  page,
uint8_t  bufferNum 
)

Compare a page of data in main memory to the data in buffer 1 or 2.

Parameters:
pagePage to test
bufferNumBuffer number
Returns:
  • 1 if the page and the buffer contains the same data
    • 0 else
Warning:
UNTESTED

Definition at line 466 of file at45db161d.cpp.

void ContinuousArrayRead ( uint16_t  page,
uint16_t  offset,
uint8_t  low 
)

Sequentially read a continuous stream of data.

Continuous Array Read.

Parameters:
pagePage of the main memory where the sequential read will start
offsetStarting byte address within the page
lowIf true the read operation will be performed in low speed mode (and in high speed mode if it's false).
Note:
The legacy mode is not currently supported
Warning:
UNTESTED

Sequentially read a continuous stream of data.

Parameters:
pagePage of the main memory where the sequential read will start
offsetStarting byte address within the page
lowIf true the read operation will be performed in low speed mode (and in high speed mode if it's false).
Note:
The legacy mode is not currently supported

Definition at line 134 of file at45db161d.cpp.

void DeepPowerDown (  )

Put the device into the lowest power consumption mode.

Once the device has entered the Deep Power-down mode, all instructions are ignored except the Resume from Deep Power-down command.

Warning:
UNTESTED

Definition at line 500 of file at45db161d.cpp.

void EndAndWait (  )

Perform a low-to-high transition on the CS pin and then poll the status register to check if the dataflash is busy.

Definition at line 444 of file at45db161d.cpp.

void Init (  )

Setup SPI and pinout.

Definition at line 27 of file at45db161d.cpp.

void PageErase ( uint16_t  page )

Erase a page in the main memory array.

Parameters:
pagePage to erase
Warning:
UNTESTED
Parameters:
pagePage to erase

Definition at line 289 of file at45db161d.cpp.

void PageToBuffer ( uint16_t  page,
uint8_t  bufferNum 
)

Transfer a page of data from main memory to buffer 1 or 2.

Parameters:
pageMain memory page to transfer
bufferBuffer (1 or 2) where the data will be written

Definition at line 257 of file at45db161d.cpp.

void ReadMainMemoryPage ( uint16_t  page,
uint16_t  offset 
)

A main memory page read allows the user to read data directly from any one of the 4096 pages in the main memory, bypassing both of the data buffers and leaving the contents of the buffers unchanged.

Main Memory Page Read.

Parameters:
pagePage of the main memory to read
offsetStarting byte address within the page

A main memory page read allows the user to read data directly from any one of the 4096 pages in the main memory, bypassing both of the data buffers and leaving the contents of the buffers unchanged.

Parameters:
pagePage of the main memory to read
offsetStarting byte address within the page

Definition at line 106 of file at45db161d.cpp.

void ReadManufacturerAndDeviceID ( struct ATD45DB161D::ID id )

Read Manufacturer and Device ID.

Note:
if id.extendedInfoLength is not equal to zero, successive calls to spi_transfer(0xff) will return the extended device information string bytes.
Parameters:
idPointer to the ID structure to initialize

Definition at line 77 of file at45db161d.cpp.

uint8_t ReadStatusRegister (  )

Read status register.

Returns:
The content of the status register

Definition at line 55 of file at45db161d.cpp.

void ResumeFromDeepPowerDown (  )

Takes the device out of Deep Power-down mode.

Warning:
UNTESTED

Definition at line 519 of file at45db161d.cpp.

void SectoreErase ( uint8_t  sector )

Erase a sector in main memory.

There are 16 sector on the at45db161d and only one can be erased at one time.

Parameters:
sectorSector to erase
Warning:
UNTESTED

There are 16 sector on the at45db161d and only one can be erased at one time.

Parameters:
sectorSector to erase (1-15)

Definition at line 351 of file at45db161d.cpp.