Component: Serial Flash (W25) (W25) (Storage)
Author | Matrix TSL |
Version | 1.0 (Release) |
Category | Storage |
Contents
Serial Flash (W25) (W25) component
Component to allow support for the Winbond W25 range of SPI Flash devices. Compatible with various sizes of Flash including: 2Mb, 4Mb, 8Mb, 32Mb, 64Mb, 128Mb.
Examples
No additional examples
Downloadable macro reference
WriteControl
Enables or disables writing for things like erasing and programming.
Writes must be enabled after a power on reset and again after an erase command.
Parameters
- BOOL Status
- 1 = Write Enabled, 0 = Write Protected
Return value
- This call does not return a value
ReadStatus
Reads one of the internal status registers on the device
Parameters
- BYTE Reg
- Selects which status register to read, 0 = Status or 1 = Status 2.
Return value
ReadDataByte
Reads a single data byte from the specified address.
Parameters
- UINT PageAddress
- Address bits A23-A8 : 16-bit Address - Range 0x0000 - 0xFFFF
- BYTE ByteAddress
- A7-A0 : 8-bit Address within the page - Range 0x00 - 0xFF
Return value
ReadUniqueID
Reads the 8-byte unique identifier from the IC.
Useful if you need each board to have it's own guarenteed unique address or identifier.
Parameters
- BYTE ID
- 8-Byte data array to store the unique ID read back from the IC.
Return value
- This call does not return a value
WriteDataArray
Writes an array of data bytes atarting at the specified address.
Writes must be enabled and memory locations must be erased for data writes to function correctly.
Note that all bytes will be written to the same page.
Parameters
- UINT PageAddress
- Address bits A23-A8 : 16-bit Address - Range 0x0000 - 0xFFFF
- BYTE ByteAddress
- A7-A0 : 8-bit Address within the page - Range 0x00 - 0xFF
- BYTE Count
- Number of bytes to write.
- BYTE Data
Return value
- This call does not return a value
EraseChip
Erases all data stored on the chip.
Chip erase takes between 20 seconds and 100 seconds to complete.
Blocking mode is recommended to ensure write cycle is complete.
Parameters
- BOOL Blocking
- Controls if the macro blocks until the erase cycle is complete. 0 = Don't Wait, 1 = Wait
Return value
- This call does not return a value
WriteDataByte
Writes a single data byte to the specified address.
Writes must be enabled and memory locations must be erased for data writes to function correctly.
Parameters
- UINT PageAddress
- Address bits A23-A8 : 16-bit Address - Range 0x0000 - 0xFFFF
- BYTE ByteAddress
- A7-A0 : 8-bit Address within the page - Range 0x00 - 0xFF
- BYTE Data
- Data byte to write
Return value
- This call does not return a value
EraseBlock
Erases a block of data stored on the chip.
Erase takes between 45 milliseconds and 2000 milliseconds to complete.
Blocking mode is recommended to ensure write cycle is complete.
Parameters
- BYTE EraseMode
- 0=4KB / 1=32KB / 2=64KB
- UINT PageAddress
- Address bits A23-A8 : 16-bit Address - Range 0x0000 - 0xFFFF
- BOOL Blocking
- Controls if the macro blocks until the erase cycle is complete. 0 = Don't Wait, 1 = Wait
Return value
- This call does not return a value
ReadDataArray
Reads up to 256 data bytes starting from the specified address.
Note that all bytes will be read from the same page.
Parameters
- UINT PageAddress
- Address bits A23-A8 : 16-bit Address - Range 0x0000 - 0xFFFF
- BYTE ByteAddress
- A7-A0 : 8-bit Address within the page - Range 0x00 - 0xFF
- BYTE Count
- Number of bytes to read.
- BYTE Data
- Byta array to store the incoming read data.
Return value
- This call does not return a value
Initialise
Initialises the SPI bus ready for communications.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Memory Size
This property is of type Fixed list of ints and can be referenced with the variable name MemSize.
Sets the size of the flash memory available on the chip.
Number Bytes
This property is of type Unsigned integer and can be referenced with the variable name NumBytes.
No additional information
Number Pages
This property is of type Unsigned integer and can be referenced with the variable name NumPages.
No additional information
Channel
This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::CHANNEL.
SPI Channel selector
Prescale
This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::PR_SCALE.
Prescale option selector
MOSI
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::MOSI.
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
MISO
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::MISO.
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
CLK
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::CLK.
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
CS / SS
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::SS.
Chip Select / Slave Select Pin
Master Mode: General purpose output pin used to select the remote SPI device.
Slave Mode: Hardware chip select pin input used to select the SPI device.
Simulate Comms
This property is of type True or false and can be referenced with the variable name SimComms.
Decides how the simulation handles the data.
No - Do no SPI simulation and allow all simulation data to come from a local text file.
Yes - Use SPI simulation for use with Injector components etc.
Simulation File
This property is of type Line of text and can be referenced with the variable name SimFile.
Name of file to use to hold the contents of the simulated flash memory.
$(srcdir) assigns the file to the same folder as the Flowcode project file.
Unique ID Lower 32-bit
This property is of type Unsigned integer and can be referenced with the variable name UniqueID.
No additional information
Unique ID Upper 32-bit
This property is of type Unsigned integer and can be referenced with the variable name UniqueID2.
No additional information
Scope Traces
This property is of type True or false and can be referenced with the variable name cal_spi1::ScopeTraces.
Selects if the scope traces are automatically generated or not
Console Data
This property is of type True or false and can be referenced with the variable name cal_spi1::ConsoleData.
Selects if the console data is automatically generated or not
Injector
This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::Injector.
No additional information