Sample SPI drivers for a number of the Adesto Technologies flash devices.
Functions | Variables
standardflash.h File Reference

Detailed Description

Declarations of Standardflash functions.

Definition in file standardflash.h.

#include "cmd_defs.h"
#include "spi_driver.h"
#include "helper_functions.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void standardflashWaitOnReady ()
 : Wait while Read/Busy Status bit in SRB is 1 (device is busy). This is accomplished by reading the first status register and delaying while the BSY bit is 1. More...
 
void standardflashSetQEBit ()
 : Sets the QE bit in status register byte 2. Does not modify any other bits. This is accomplished by first reading both bytes, performing a write enable, then writing the status register data back in with the QE bit set.
More...
 
void standardflashClearQEBit ()
 : Clears the QE bit in status register byte 2. Does not modify any other bits. This is accomplished by first reading both bytes, performing a write enable, then writing the status register data back in with the QE bit cleared.
More...
 
void standardflashWriteEnable ()
 OPCODE: 0x06
Sends opcode to enable writing. More...
 
void standardflashWriteDisable ()
 OPCODE: 0x04
Sends opcode to disable writing. More...
 
void standardflashReadArrayLowFreq (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
 OPCODE: 0x03
Reads rxNumBytes starting from location 'address' and stores the data in the byte array rxBuffer. This command reads from a page in main memory at a lower frequency than other commands as specified in the datasheet. More...
 
void standardflashReadArrayHighFreq (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
 OPCODE: 0x0B
Reads rxNumBytes starting from location 'address' and stores the data in the byte array rxBuffer. This command reads from a page in main memory at a higher frequency than other commands as specified in the datasheet. More...
 
void standardflashBytePageProgram (uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
 OPCODE: 0x02
Programs 'txNumBytes' bytes of data starting at the address indicated by address. More...
 
void standardflashBlockErase4K (uint32_t address)
 OPCODE: 0x20
Erases a block of data (4 KBytes) starting from page address 'address.'. More...
 
void standardflashBlockErase32K (uint32_t address)
 OPCODE: 0x52
Erases a block of data (4 KBytes) starting from page address 'address.'. More...
 
void standardflashBlockErase64K (uint32_t address)
 OPCODE: 0xD8
Erases a block of data (4 KBytes) starting from page address 'address.'. More...
 
void standardflashChipErase1 ()
 OPCODE: 0x60
Erases the entire chip by setting all bits. standardflashChipErase2() is functionally equivalent. More...
 
void standardflashChipErase2 ()
 OPCODE: 0xC7
Erases the entire chip by setting all bits. standardflashChipErase1() is functionally equivalent. More...
 
void standardflashDPD ()
 OPCODE: 0xB9 Put the device into deep power down mode. Call dataflashResumeFromDPD() to wake up, or perform a hardware reset dataflashHardwareReset(). More...
 
void standardflashResumeFromDPD ()
 OPCODE: 0xAB
Wake the device from deep power down mode. See dataflashDPD(). More...
 
void standardflashReadID (uint8_t *rxBuffer)
 OPCODE: 0x90
Legace Command: Reads the manufacturer ID and stores the data in rxBuffer. More...
 
void standardflashReadMID (uint8_t *rxBuffer)
 OPCODE: 0x9F
Reads the manufacturer ID and stores the data in rxBuffer. More...
 
void standardflashWriteSR (uint8_t *txBuffer, uint8_t txNumBytes)
 OPCODE: 0x01
Writes the value in data to the status register byte 1, or bytes 1 and 2. At least 1 byte needs to be written. More...
 
void standardflashWriteSRB1 (uint8_t regVal)
 
void standardflashWriteSRB2 (uint8_t regVal)
 
void standardflashWriteEnableVolatileSR ()
 OPCODE: 0x50
Sends opcode to enable writing for the volatile status register. More...
 
uint8_t standardflashReadSRB1 ()
 OPCODE: 0x05
Reads the value in the device status register (byte 1). More...
 
uint8_t standardflashReadSRB2 ()
 OPCODE: 0x35
Reads the value in the device status register (byte 2). More...
 
void standardflashDualOutputRead (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
 OPCODE: 0x3B
Reads 'txNumBytes' bytes of data in Dual Output Mode starting at 'address' using both SI and SO as inputs to master. More...
 
void standardflashDualIORead (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes, uint8_t readMode, uint8_t modeByteValue)
 OPCODE: 0xBB
Reads 'txNumBytes' bytes of data in Dual IO Mode starting at 'address' using both SI and SO as inputs to master. Depending on the readMode parameter the user can eliminate the need to send the opcode over if a continuous read is being performed. See the comments for readMode. More...
 
void standardflashQuadOutputRead (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
 OPCODE: 0x6B
Reads 'txNumBytes' bytes of data in Quad Output Mode starting at 'address' using SI, SO, WPb, and HOLDb as inputs to master. More...
 
void standardflashQuadIORead (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes, uint8_t readMode, uint8_t modeByteValue)
 OPCODE: 0xEB
Reads 'txNumBytes' bytes of data in Quad IO Mode starting at 'address' using SI, SO, WPb, and HOLDb as inputs to master. Depending on the readMode parameter the user can eliminate the need to send the opcode over if a continuous read is being performed. See the comments for readMode. More...
 
void standardflashContinuousReadModeDualReset ()
 OPCODE: 0xFFFF
Resets the dual continuous read mode that was entered with standardflashDualIORead() when readMode 2 was used. Data from and to the device will be in standard SPI after using this command. More...
 
void standardflashContinuousReadModeQuadReset ()
 OPCODE: 0xFF
Resets the quad continuous read mode that was entered with standardflashQuadIORead() when readMode 2 was used. Data from and to the device will be in standard SPI after using this command. More...
 
void standardflashEraseSecurityRegister (uint32_t address)
 OPCODE: 0x44
Sends opcode to erase the security registers. More...
 
void standardflashProgramSecurityRegisters (uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
 OPCODE: 0x42
Programs the security registers with the contents of txBuffer. More...
 
void standardflashReadSecurityRegisters (uint32_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
 OPCODE: 0x48
Reads the contents of the security registers and stores it in the rxBuffer. More...
 
void standardflashResumeFromDPDReadID (uint8_t *rxBuffer)
 OPCODE: 0xAB
Wake the device from deep power down mode and read the 1 byte ID. See standardflashDPD(). More...
 
void standardflashQuadPageProgram (uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes, uint8_t mode)
 OPCODE: 0x33
Programs 'txNumBytes' bytes of data starting at the address indicated by address using Quad IO. More...
 
void standardflashEraseProgramSuspend ()
 OPCODE: 0x75
Suspends an erase or program mid operation. More...
 
void standardflashEraseProgramResume ()
 OPCODE: 0x7A
Resumes a previously suspended erase or program. More...
 
void standardflashEnableQPI ()
 OPCODE: 0x38
Switches the device from SPI mode to QPI mode, and sets a variable to quad mode. More...
 
void standardflashDisableQPI ()
 OPCODE: 0xFF
Switches the device from QPI mode to SPI mode, and sets a variable to spi mode. More...
 
void standardflashEnableReset ()
 OPCODE: 0x66
Enable software reset of the flash device. More...
 
void standardflashReset ()
 OPCODE: 0x99
Software reset the flash device. More...
 
void standardflashEnterSecureOTP ()
 OPCODE: 0xB1
Enter secured OTP region. More...
 
void standardflashExitSecuredOTP ()
 OPCODE: 0xC1
Exit secured OTP region. More...
 
void standardflashReadSR (uint8_t *rxBuffer)
 OPCODE: 0x05
Reads the value in the device status register (byte 1 and 2). More...
 
void standardflashDualInputBytePageProgram (uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
 OPCODE: 0xA2
Programs 'txNumBytes' bytes of data starting at the address indicated by address using both the MISO and MOSI lines is inputs to the device. More...
 
void standardflashProgramEraseSuspend ()
 OPCODE: 0xB0
Suspends an erase or program mid operation. More...
 
void standardflashProgramEraseResume ()
 OPCODE: 0xD0
Resumes a previously suspended erase or program. More...
 
void standardflashProtectSector (uint32_t address)
 OPCODE: 0x36 Protects a sector containing the address address. More...
 
void standardflashUnprotectSector (uint32_t address)
 OPCODE: 0x39
Un-protects a sector containing the address address. More...
 
uint8_t standardflashReadSectorProtectionReg (uint32_t address)
 OPCODE: 0x3C
Reads the sector protection register for address address. More...
 
void standardflashFreezeLockdownState ()
 OPCODE: 0x34
Freezes the current state of the sector lockdown registers. More...
 
uint8_t standardflashReadLockdownReg (uint32_t address)
 OPCODE: 0x35
Reads the sector lockdown register for address address. More...
 
void standardflashProgramOTPReg (uint32_t address, uint8_t *txBuffer, uint32_t txNumBytes)
 OPCODE: 0x9B
Programs 'txNumBytes' bytes of data to the OTP register starting at the address indicated by address. More...
 

Variables

uint8_t txStandardflashInternalBuffer [MAXIMUM_TX_BYTES]
 

Function Documentation

◆ standardflashBlockErase32K()

void standardflashBlockErase32K ( uint32_t  address)

OPCODE: 0x52
Erases a block of data (4 KBytes) starting from page address 'address.'.

Parameters
addressThe 3 byte page address at which the block erase will start.
Return values
void

Definition at line 254 of file standardflash.c.

◆ standardflashBlockErase4K()

void standardflashBlockErase4K ( uint32_t  address)

OPCODE: 0x20
Erases a block of data (4 KBytes) starting from page address 'address.'.

Parameters
addressThe 3 byte page address at which the block erase will start.
Return values
void

Definition at line 241 of file standardflash.c.

◆ standardflashBlockErase64K()

void standardflashBlockErase64K ( uint32_t  address)

OPCODE: 0xD8
Erases a block of data (4 KBytes) starting from page address 'address.'.

Parameters
addressThe 3 byte page address at which the block erase will start.
Return values
void

Definition at line 267 of file standardflash.c.

◆ standardflashBytePageProgram()

void standardflashBytePageProgram ( uint32_t  address,
uint8_t *  txBuffer,
uint32_t  txNumBytes 
)

OPCODE: 0x02
Programs 'txNumBytes' bytes of data starting at the address indicated by address.

Parameters
addressThe 3 bytes address indicating the first location to be written to.
txBufferPointer to the tx bytes that will be stored in memory. Must have a minimum of txNumBytes elements.
txNumBytesNumber of bytes to be written to the device. txBuffer must have a minimum of this many elements.
Return values
void

Definition at line 220 of file standardflash.c.

◆ standardflashChipErase1()

void standardflashChipErase1 ( )

OPCODE: 0x60
Erases the entire chip by setting all bits. standardflashChipErase2() is functionally equivalent.

Return values
void

Definition at line 280 of file standardflash.c.

◆ standardflashChipErase2()

void standardflashChipErase2 ( )

OPCODE: 0xC7
Erases the entire chip by setting all bits. standardflashChipErase1() is functionally equivalent.

Return values
void

Definition at line 293 of file standardflash.c.

◆ standardflashClearQEBit()

void standardflashClearQEBit ( )

: Clears the QE bit in status register byte 2. Does not modify any other bits. This is accomplished by first reading both bytes, performing a write enable, then writing the status register data back in with the QE bit cleared.

This is a 'derived' command which uses multiple single commands to accomplish a set task.

Return values
void

Definition at line 135 of file standardflash.c.

◆ standardflashContinuousReadModeDualReset()

void standardflashContinuousReadModeDualReset ( )

OPCODE: 0xFFFF
Resets the dual continuous read mode that was entered with standardflashDualIORead() when readMode 2 was used. Data from and to the device will be in standard SPI after using this command.

Return values
void

Definition at line 635 of file standardflash.c.

◆ standardflashContinuousReadModeQuadReset()

void standardflashContinuousReadModeQuadReset ( )

OPCODE: 0xFF
Resets the quad continuous read mode that was entered with standardflashQuadIORead() when readMode 2 was used. Data from and to the device will be in standard SPI after using this command.

Return values
void

Definition at line 646 of file standardflash.c.

◆ standardflashDisableQPI()

void standardflashDisableQPI ( )

OPCODE: 0xFF
Switches the device from QPI mode to SPI mode, and sets a variable to spi mode.

Warning
Must call standardflashClearQEBit() afterwards to reset the QE bit!
Return values
void

Definition at line 796 of file standardflash.c.

◆ standardflashDPD()

void standardflashDPD ( )

OPCODE: 0xB9 Put the device into deep power down mode. Call dataflashResumeFromDPD() to wake up, or perform a hardware reset dataflashHardwareReset().

Return values
void

Definition at line 306 of file standardflash.c.

◆ standardflashDualInputBytePageProgram()

void standardflashDualInputBytePageProgram ( uint32_t  address,
uint8_t *  txBuffer,
uint32_t  txNumBytes 
)

OPCODE: 0xA2
Programs 'txNumBytes' bytes of data starting at the address indicated by address using both the MISO and MOSI lines is inputs to the device.

Parameters
addressThe 3 bytes address indicating the first location to be written to.
txBufferPointer to the tx bytes that will be stored in memory. Must have a minimum of txNumBytes elements.
txNumBytesNumber of bytes to be written to the device. txBuffer must have a minimum of this many elements.
Return values
void

Definition at line 883 of file standardflash.c.

◆ standardflashDualIORead()

void standardflashDualIORead ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes,
uint8_t  readMode,
uint8_t  modeByteValue 
)

OPCODE: 0xBB
Reads 'txNumBytes' bytes of data in Dual IO Mode starting at 'address' using both SI and SO as inputs to master. Depending on the readMode parameter the user can eliminate the need to send the opcode over if a continuous read is being performed. See the comments for readMode.

Parameters
addressAddress starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
readModeThe read mode which selects between 4 different modes.
  • 0: M5/4 =/= 10b Do not perform a continuous read. This results in a one-off dual read.
  • 1: M5/4 = 10b Start a continuous dual read. This removes the need for an opcode the next time dual read is issued.
  • 2: M5/4 = 10b Continue dual read. When this is used, the opcode is not sent in the transfer.
  • 3: M5/4 =/= 10b End dual read. This command stops the continuous dual read mode, but does not send an opcode.
modeByteValueThis value should be set to the M7-0 byte listed in the datasheet for a continuous operation. The overhead of setting up the opcode, address, and mode byte is taken care of, but different devices within the same family will use a different mode value.
Please note, this is taken care of in the sample code when defining which part is being used. See main() in standardflash.c.
Return values
void

Definition at line 501 of file standardflash.c.

◆ standardflashDualOutputRead()

void standardflashDualOutputRead ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes 
)

OPCODE: 0x3B
Reads 'txNumBytes' bytes of data in Dual Output Mode starting at 'address' using both SI and SO as inputs to master.

Parameters
addressAddress starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
Return values
void

Definition at line 491 of file standardflash.c.

◆ standardflashEnableQPI()

void standardflashEnableQPI ( )

OPCODE: 0x38
Switches the device from SPI mode to QPI mode, and sets a variable to quad mode.

Warning
Must first call standardflashSetQEBit() to set the QE bit!
Return values
void

Definition at line 784 of file standardflash.c.

◆ standardflashEnableReset()

void standardflashEnableReset ( )

OPCODE: 0x66
Enable software reset of the flash device.

Warning
must follow this by standardflashReset() in order to software reset the device.
Return values
void

Definition at line 808 of file standardflash.c.

◆ standardflashEnterSecureOTP()

void standardflashEnterSecureOTP ( )

OPCODE: 0xB1
Enter secured OTP region.

Return values
void

Definition at line 834 of file standardflash.c.

◆ standardflashEraseProgramResume()

void standardflashEraseProgramResume ( )

OPCODE: 0x7A
Resumes a previously suspended erase or program.

Return values
void

Definition at line 758 of file standardflash.c.

◆ standardflashEraseProgramSuspend()

void standardflashEraseProgramSuspend ( )

OPCODE: 0x75
Suspends an erase or program mid operation.

Return values
void

Definition at line 745 of file standardflash.c.

◆ standardflashEraseSecurityRegister()

void standardflashEraseSecurityRegister ( uint32_t  address)

OPCODE: 0x44
Sends opcode to erase the security registers.

Return values
void

Definition at line 659 of file standardflash.c.

◆ standardflashExitSecuredOTP()

void standardflashExitSecuredOTP ( )

OPCODE: 0xC1
Exit secured OTP region.

Return values
void

Definition at line 847 of file standardflash.c.

◆ standardflashFreezeLockdownState()

void standardflashFreezeLockdownState ( )

OPCODE: 0x34
Freezes the current state of the sector lockdown registers.

Warning
This operation is permanent, and disables the functionality to change the lockdown registers.
Return values
void

Definition at line 952 of file standardflash.c.

◆ standardflashProgramEraseResume()

void standardflashProgramEraseResume ( )

OPCODE: 0xD0
Resumes a previously suspended erase or program.

Return values
void

Definition at line 911 of file standardflash.c.

◆ standardflashProgramEraseSuspend()

void standardflashProgramEraseSuspend ( )

OPCODE: 0xB0
Suspends an erase or program mid operation.

Return values
void

Definition at line 901 of file standardflash.c.

◆ standardflashProgramOTPReg()

void standardflashProgramOTPReg ( uint32_t  address,
uint8_t *  txBuffer,
uint32_t  txNumBytes 
)

OPCODE: 0x9B
Programs 'txNumBytes' bytes of data to the OTP register starting at the address indicated by address.

Warning
This is a one time operation, and special rules apply. Read the datasheet.
Parameters
addressThe 3 bytes address indicating the first location to be written to.
txBufferPointer to the tx bytes that will be stored in memory. Must have a minimum of txNumBytes elements.
txNumBytesNumber of bytes to be written to the device. txBuffer must have a minimum of this many elements.
Return values
void

Definition at line 975 of file standardflash.c.

◆ standardflashProgramSecurityRegisters()

void standardflashProgramSecurityRegisters ( uint32_t  address,
uint8_t *  txBuffer,
uint32_t  txNumBytes 
)

OPCODE: 0x42
Programs the security registers with the contents of txBuffer.

Parameters
addressAddress starting from which the data in txBuffer will be stored within the security register.
txBufferPointer to the tx bytes that will be stored in memory. Must have a minimum of txNumBytes elements.
txNumBytesNumber of bytes to be written to the device. txBuffer must have a minimum of this many elements.
Return values
void

Definition at line 669 of file standardflash.c.

◆ standardflashProtectSector()

void standardflashProtectSector ( uint32_t  address)

OPCODE: 0x36 Protects a sector containing the address address.

Return values
void

Definition at line 921 of file standardflash.c.

◆ standardflashQuadIORead()

void standardflashQuadIORead ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes,
uint8_t  readMode,
uint8_t  modeByteValue 
)

OPCODE: 0xEB
Reads 'txNumBytes' bytes of data in Quad IO Mode starting at 'address' using SI, SO, WPb, and HOLDb as inputs to master. Depending on the readMode parameter the user can eliminate the need to send the opcode over if a continuous read is being performed. See the comments for readMode.

Parameters
addressAddress starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
readModeThe read mode which selects between 4 different modes.
  • 0: M5/4 =/= 10b Do not perform a continuous read. This results in a one-off quad read.
  • 1: M5/4 = 10b Start a continuous quad read. This removes the need for an opcode the next time
  • 2: M5/4 = 10b Continue quad read. When this is used, the opcode is not sent in the transfer.
  • 3: M5/4 =/= 10b End quad read. This command stops the continuous quad read mode, but does not send an opcode.
modeByteValueThis value should be set to the M7-0 byte listed in the datasheet for a continuous operation. The overhead of setting up the opcode, address, and mode byte is taken care of, but different devices within the same family will use a different mode value.
Please note, this is taken care of in the sample code when defining which part is being used. See main() in standardflash.c.
Return values
void

Definition at line 570 of file standardflash.c.

◆ standardflashQuadOutputRead()

void standardflashQuadOutputRead ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes 
)

OPCODE: 0x6B
Reads 'txNumBytes' bytes of data in Quad Output Mode starting at 'address' using SI, SO, WPb, and HOLDb as inputs to master.

Parameters
addressAddress starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
Return values
void

Definition at line 560 of file standardflash.c.

◆ standardflashQuadPageProgram()

void standardflashQuadPageProgram ( uint32_t  address,
uint8_t *  txBuffer,
uint32_t  txNumBytes,
uint8_t  mode 
)

OPCODE: 0x33
Programs 'txNumBytes' bytes of data starting at the address indicated by address using Quad IO.

Parameters
addressThe 3 bytes address indicating the first location to be written to.
txBufferPointer to the tx bytes that will be stored in memory. Must have a minimum of txNumBytes elements.
txNumBytesNumber of bytes to be written to the device. txBuffer must have a minimum of this many elements.
modeDetermines which mode to use when sending data over. If mode is 0, the command will use SPI mode at detailed in the datasheet. If mode is 1, Quad mode will be used as detailed in the datasheet.
Return values
void

Definition at line 710 of file standardflash.c.

◆ standardflashReadArrayHighFreq()

void standardflashReadArrayHighFreq ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes 
)

OPCODE: 0x0B
Reads rxNumBytes starting from location 'address' and stores the data in the byte array rxBuffer. This command reads from a page in main memory at a higher frequency than other commands as specified in the datasheet.

Parameters
address3 byte address starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
Return values
void

Definition at line 207 of file standardflash.c.

◆ standardflashReadArrayLowFreq()

void standardflashReadArrayLowFreq ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes 
)

OPCODE: 0x03
Reads rxNumBytes starting from location 'address' and stores the data in the byte array rxBuffer. This command reads from a page in main memory at a lower frequency than other commands as specified in the datasheet.

Parameters
address3 byte address starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
Return values
void

Definition at line 197 of file standardflash.c.

◆ standardflashReadID()

void standardflashReadID ( uint8_t *  rxBuffer)

OPCODE: 0x90
Legace Command: Reads the manufacturer ID and stores the data in rxBuffer.

Parameters
rxBufferPointer to a byte array in which the data will be stored. Minimum of 2 bytes required.
Return values
void

Definition at line 332 of file standardflash.c.

◆ standardflashReadLockdownReg()

uint8_t standardflashReadLockdownReg ( uint32_t  address)

OPCODE: 0x35
Reads the sector lockdown register for address address.

Return values
Thebyte indicating whether or not the sector is locked-down.
0xFF indicates the sector is locked-down, 0x00 indicates the sector is not locked-down.

Definition at line 963 of file standardflash.c.

◆ standardflashReadMID()

void standardflashReadMID ( uint8_t *  rxBuffer)

OPCODE: 0x9F
Reads the manufacturer ID and stores the data in rxBuffer.

Parameters
rxBufferPointer to a byte array in which the data will be stored.
Return values
void

Definition at line 345 of file standardflash.c.

◆ standardflashReadSectorProtectionReg()

uint8_t standardflashReadSectorProtectionReg ( uint32_t  address)

OPCODE: 0x3C
Reads the sector protection register for address address.

Return values
Thebyte indicating whether or not the sector is protected.
0xFF indicates the sector is protected, 0x00 indicates the sector is unprotected.

Definition at line 940 of file standardflash.c.

◆ standardflashReadSecurityRegisters()

void standardflashReadSecurityRegisters ( uint32_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes 
)

OPCODE: 0x48
Reads the contents of the security registers and stores it in the rxBuffer.

Parameters
addressAddress starting from which the data in the status register will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
Return values
void

Definition at line 687 of file standardflash.c.

◆ standardflashReadSR()

void standardflashReadSR ( uint8_t *  rxBuffer)

OPCODE: 0x05
Reads the value in the device status register (byte 1 and 2).

Return values
void

Definition at line 870 of file standardflash.c.

◆ standardflashReadSRB1()

uint8_t standardflashReadSRB1 ( )

OPCODE: 0x05
Reads the value in the device status register (byte 1).

Return values
Bytestored in the status register.

Definition at line 461 of file standardflash.c.

◆ standardflashReadSRB2()

uint8_t standardflashReadSRB2 ( )

OPCODE: 0x35
Reads the value in the device status register (byte 2).

Return values
Bytestored in the status register.

Definition at line 476 of file standardflash.c.

◆ standardflashReset()

void standardflashReset ( )

OPCODE: 0x99
Software reset the flash device.

Warning
Must have first issued standardflashEnableReset() in order to perform a software reset.
Return values
void

Definition at line 821 of file standardflash.c.

◆ standardflashResumeFromDPD()

void standardflashResumeFromDPD ( )

OPCODE: 0xAB
Wake the device from deep power down mode. See dataflashDPD().

Return values
void

Definition at line 319 of file standardflash.c.

◆ standardflashResumeFromDPDReadID()

void standardflashResumeFromDPDReadID ( uint8_t *  rxBuffer)

OPCODE: 0xAB
Wake the device from deep power down mode and read the 1 byte ID. See standardflashDPD().

Parameters
rxBufferA byte array in which the device ID (single byte) will be stored.
Return values
void

Definition at line 697 of file standardflash.c.

◆ standardflashSetQEBit()

void standardflashSetQEBit ( )

: Sets the QE bit in status register byte 2. Does not modify any other bits. This is accomplished by first reading both bytes, performing a write enable, then writing the status register data back in with the QE bit set.

This is a 'derived' command which uses multiple single commands to accomplish a set task.

Return values
void

Definition at line 99 of file standardflash.c.

◆ standardflashUnprotectSector()

void standardflashUnprotectSector ( uint32_t  address)

OPCODE: 0x39
Un-protects a sector containing the address address.

Return values
void

Definition at line 930 of file standardflash.c.

◆ standardflashWaitOnReady()

void standardflashWaitOnReady ( )

: Wait while Read/Busy Status bit in SRB is 1 (device is busy). This is accomplished by reading the first status register and delaying while the BSY bit is 1.

This is a 'derived' command which uses multiple single commands to accomplish a set task.

Return values
void

Definition at line 77 of file standardflash.c.

◆ standardflashWriteDisable()

void standardflashWriteDisable ( )

OPCODE: 0x04
Sends opcode to disable writing.

Return values
void

Definition at line 184 of file standardflash.c.

◆ standardflashWriteEnable()

void standardflashWriteEnable ( )

OPCODE: 0x06
Sends opcode to enable writing.

Return values
void

Definition at line 171 of file standardflash.c.

◆ standardflashWriteEnableVolatileSR()

void standardflashWriteEnableVolatileSR ( )

OPCODE: 0x50
Sends opcode to enable writing for the volatile status register.

Return values
void

Definition at line 448 of file standardflash.c.

◆ standardflashWriteSR()

void standardflashWriteSR ( uint8_t *  txBuffer,
uint8_t  txNumBytes 
)

OPCODE: 0x01
Writes the value in data to the status register byte 1, or bytes 1 and 2. At least 1 byte needs to be written.

Parameters
txBufferByte(s) of data to be written into the status register.
txNumBytesThe number of bytes to be transmitted, either 1 or 2.
Return values
void

Definition at line 372 of file standardflash.c.

◆ standardflashWriteSRB1()

void standardflashWriteSRB1 ( uint8_t  regVal)

Definition at line 406 of file standardflash.c.

◆ standardflashWriteSRB2()

void standardflashWriteSRB2 ( uint8_t  regVal)

Definition at line 420 of file standardflash.c.

Variable Documentation

◆ txStandardflashInternalBuffer

uint8_t txStandardflashInternalBuffer[MAXIMUM_TX_BYTES]

Definition at line 73 of file standardflash.c.