Flash Center User's Manual v1.20
| Prev: Application | Table of Contents | Next: Legal / Contact |
- 4 Adding Memory Devices
4 Adding Memory Devices
4.1 Introduction
While there are many memory devices included in the Flash Center’s parts list by default, users may find that the part that they wish to program is not present. Hence, the Flash Center includes a method to allow users to add additional memory parts to the library and to specify the parameters for programming these parts. In order to add a memory device to the Flash Center, the user must first define the memory part’s programming parameters in an XML file and then load the file into Flash Center.
4.2 Importing Memory Device Files
There are two ways to add memory devices into the Flash Center’s parts list from a memory part file.
One method for loading the file in the Flash Center is to open the “Select Target Device” dialog and then click the “Load Part File...” button. The memory part file can be then chosen from the file selection dialog.
The other way to add the parts defined in a memory part file is to put the file into the Flash Center’s parts directory. This directory is located in the Flash Center’s installation directory and is named parts. When the Flash Center is launched, it will automatically load all files in the parts directory that have the .xml file extension.
Regardless of the method chosen to load the memory part file, if the file is properly formatted, the parts will be integrated into the parts list and can be selected for programming in the Choose Target Device dialog.
Note: The deviceName parameters for the memory devices must be unique. If there is a duplication of the deviceName parameters between parts definitions, then parts loaded later will overwrite parts definitions loaded earlier. When using the “Load Part File...” option, this is useful as it allows for the refinement of parts definitions without having to restart Flash Center. When the parts with duplicate deviceName parameters are located in the parts directory, it is indeterminate which one will be loaded.
4.3 Defining Memory Device Files
In order to add a memory device to the Flash Center’s parts list, the part must first be defined in a memory part file.
The following is an example of a memory part file, taken from one of the files that ships with the Flash Center, st-spi-flash-m25pe.xml. It defines 4 memory parts which inherit the bulk of their parameters from the global default values or the default values declared at the top of the file.
<?xml version="1.0" encoding="UTF-8"?>
<devices>
<default version="1.0">
<manufacturerName> STMicro </manufacturerName>
<deviceAlgorithm>SPI flash</deviceAlgorithm>
<maxBitrate>33000</maxBitrate>
<addressWidth>3</addressWidth>
<readDummyBytes>1</readDummyBytes>
<writeSize>256</writeSize>
<eraseSize>256</eraseSize>
<writeTime>1200</writeTime>
<eraseTime>10000</eraseTime>
<readInstruction>0x0b</readInstruction>
<readDeviceIdInstruction>0x9f</readDeviceIdInstruction>
<eraseInstruction>0xdb</eraseInstruction>
<deviceConnectedBits>0x00</deviceConnectedBits>
<deviceConnectedMask>0xfc</deviceConnectedMask>
</default>
<device version="1.0">
<deviceName>M25PE10</deviceName>
<deviceDescription>
STMicro M25PE10 128 Kilobyte SPI Flash
</deviceDescription>
<capacity>128*1024</capacity>
<expectedDeviceId>\x20\x80\x11</expectedDeviceId>
</device>
<device version="1.0">
<deviceName>M25PE20</deviceName>
<deviceDescription>
STMicro M25PE20 256 Kilobyte SPI Flash
</deviceDescription>
<capacity>256*1024</capacity>
<expectedDeviceId>\x20\x80\x12</expectedDeviceId>
</device>
<device version="1.0">
<deviceName>M25PE40</deviceName>
<deviceDescription>
STMicro M25PE40 512 Kilobyte SPI Flash
</deviceDescription>
<capacity>512*1024</capacity>
<expectedDeviceId>\x20\x80\x13</expectedDeviceId>
</device>
<device version="1.0">
<deviceName>M25PE80</deviceName>
<deviceDescription>
STMicro M25PE80 1 Megabyte SPI Flash
</deviceDescription>
<capacity>1024*1024</capacity>
<maxBitrate>50000</maxBitrate>
<hasEraseAll>true</hasEraseAll>
<writeTime>1350</writeTime>
<eraseAllTime>10*1000000</eraseAllTime>
<eraseAllInstruction>0xc7</eraseAllInstruction>
<expectedDeviceId>\x20\x80\x14</expectedDeviceId>
</device>
<device version="1.0">
<deviceName>M25PE16</deviceName>
<deviceDescription>
STMicro M25PE16 2 Megabyte SPI Flash
</deviceDescription>
<capacity>2*1024*1024</capacity>
<maxBitrate>50*1000</maxBitrate>
<blockProtectBits>0x1c</blockProtectBits>
<hasEraseAll>true</hasEraseAll>
<writeTime>800</writeTime>
<eraseAllTime>17*1000000</eraseAllTime>
<eraseAllInstruction>0xc7</eraseAllInstruction>
<expectedDeviceId>\x20\x80\x15</expectedDeviceId>
<deviceConnectedMask>0x60</deviceConnectedMask>
</device>
</devices>
Memory File Part Format
The parts definition format used for the Flash Center is based upon XML. (For an overview of the XML format, please refer to the official XML website at http://www.w3.org/XML/).
The memory part file format contains multiple elements. It begins with the XML declaration and is followed by the <devices> node which can contain one <default> node and multiple <device> nodes. The <default> node and the <device> nodes each contain multiple elements which define parameter values for memory devices. Each <device> node defines a single memory device. The <default> node can be used to define common features of all of the memory parts in the file.
XML Declaration
The first line in the example file is the XML declaration line. This line should be the first line in all memory part files.
Devices Node
The only item at root level in the XML file is the <devices> element node. All other elements in the file are subnodes of the <devices> node; the second line of the file should be the declaration of the <devices> node and the last line of the file should close the <devices> node. The <default> node and all of the <device> nodes should be subnodes of the <devices> node.
Default Node
The <default> node is an optional node that defines the shared parameter values for all the devices defined in the file. Any parameters defined in the <default> node will override the built-in default values for that individual parameter.
The <default> element has one attribute, version, which must be set to 1.0. There should be only one <default> node. If there is more than one <default> node, only the first one is parsed; the rest are ignored.
Device Nodes
Each <device> node in the memory part file defines a single memory part. Multiple <device> nodes are allowed under the <devices> node, each one defining a different memory device. The parameter values declared under each <device> node define the features of the device and also characterize the programming methodology for the memory device. The parameters defined within each <device> node will vary depending on the type of memory device plus the specifics of the memory device.
It is important when adding new parts into the Flash Center’s part list that the new part has a unique name, as defined in the <deviceName> parameter. If there are memory parts that have the same <deviceName> value, only one of the parts will be included in the parts list. In this situation, a warning will be displayed to the user.
The <device> element has one attribute, version, which must be set to 1.0.
Device Parameters
In the memory parts file, each memory device is described as a list of parameter values which define features such as the name of the device, the size of the memory, the type of device, etc. The parameters required to define a particular memory part will vary depending on what type of memory device it is as well as other specific features of the part.
Note: Parameter names are case sensitive.
Default parameter values
Some parameters have default values defined, so they need not be defined for most memory devices. For example, baseDeviceAddress and writeInstruction have default values of 0x50 and 0x02, respectively. These default values are taken from typical values for these parameters. For many memory parts, the default values will be correct, so these parameters need not be defined in the <device> node. For those parts whose parameter values differ from the default values, specifying that parameter will override the default value.
Additionally, it is possible to define file-specific default parameter values by defining the parameter value in the <default> node. The parameters defined under the <default> node will override the regular default values. As with the normal default values, the file-specific defaults can also be overridden in the <device> node for any individual memory part.
Parameter Types
There are four main types of device parameters: text, boolean, integer, and binary data. In addition, there is one parameter, deviceAlgorithm, that is a text type parameter for which only three specific values are accepted.
The “text” parameters can accept any text input. Examples include manufacturerName and deviceDescription, where any XML-permitted string value is allowed.
The “boolean” parameters allow two values: true or false, case insensitive. Examples of boolean parameters are hasEraseAll and busyBitPolarity.
The “integer” parameters take unsigned numeric values. By default, integer values will be parsed as decimal values. Prefixing the value with 0x will cause the Flash Center to parse the value as a hexadecimal value. In addition, integer values can be defined as the multiplication of two values, using the * symbol. (Space characters are not allowed around the * symbol.) For example, 16384, 0x4000, 16*1024, 0x10*0x400, and 0x10*1024 all represent the same value. Examples of integer parameters are capacity, writeInstruction, and deviceBusyBit.
The “binary data” parameters represent a sequence of byte values. Each byte value in the sequence can be represented by any XML-permitted character or can be entered as a hexadecimal value prefixed with \x. For example, abc123, \x20\x80\x14, and abc\xff are all valid entries for a binary data value. The only binary data parameter is expectedDeviceId.
Memory Device Types
There are three types of memory devices supported by the Flash Center. These are: I2C EEPROM, SPI EEPROM, and SPI flash. Some memory device parameters are common to all three memory device types, while some are specific to I2C EEPROMs, some are specific to SPI devices (both EEPROMs and flash devices), and some parameters are specific to SPI flash devices.
Global Memory Device Parameters
The following is a table of the parameters common to all memory devices. All of these parameters must be defined for every memory part.
Parameter Type Default Description deviceAlgorithm text The type of memory device. The programming algorithm will be determined based on this parameter value. Supported values are “i2c eeprom,” “spi eeprom,” and “spi flash,” case insensitive. deviceName text The name of the memory device. Note that the device name must be unique; devices with duplicate names will result in an error. deviceDescription text A long description of the device. Displayed when the memory device is selected during selection of the target. Typically, it contains the manufacturer name, device name, memory size, and device type. manufacturerName text The manufacturer of the memory device. capacity int Size of the device in bytes. Value must be non-zero. maxBitrate int The maximum bit rate the device can use to communicate to the programming adapter. Value must be non-zero. If there are multiple speed grades for the memory part, the highest bit rate is recommended for this parameter. addressWidth int 1 The number of bytes in the memory address field when reading from and writing to the device. If the address has overflow bits they will automatically be added to the device address (I2C) or command code (SPI). Value must be non-zero. writeSize int The number of bytes per write operation. For parts with variable page sizes, enter the size of the smallest page. Value must be non-zero. writeTime int The number of microseconds required to complete a write operation to a single page. Use the minimum or typical value, as the Flash Center can poll the device to wait additional time if necessary. If there are multiple speed grades for the memory part, the lowest time is recommended for this parameter. Value must be non-zero.
I2C Memory Device Parameters
The following is a table of the parameters specific to I2C EEPROM memory devices.
Parameter Type Default Description baseDeviceAddress int 0x50 The base device address for I2C devices. pageShift int 0 Devices whose capacity exceeds the total number of bits supplied in its address word, will use bits of the I2C device address to fully address the data. The pageShift parameter specifies the position of the least significant bit of such address bits in the I2C device address. This parameter is usually zero, but the Microchip 24xx1025 family is one that requires this parameter.
Required SPI Memory Device Parameters
The following is a table of required parameters specific to both SPI EEPROM devices and SPI flash devices. All of these parameters must be defined for all SPI memory devices, though for many of these parameters, the default values will be the correct values.
Parameter Type Default Description readStatusRegisterInstruction int 0x05 The instruction to read the device status register. This is the register which contains the busy bit and the block protect bits. deviceBusyBit int 0x01 The bits in the status register which indicate that an operation is in progress. This parameter is used as a bit mask on the status register to determine the busy status. busyBitPolarity bool false The polarity of the busy bit in the status register. Set to true if the busy bit has inverted polarity, signifying that 1 means “ready.” readInstruction int 0x03 The instruction which initiates a read operation from the device. For devices with a “fast read” command, the default value should be overridden. readDummyBytes int 0 The number of padding bytes inserted in between the readInstruction and shifting data out of the device. Typically, this parameter only needs to be set for flash devices with a “fast read” command. writeInstruction int 0x02 The instruction to write data to the device. writeEnableInstruction int 0x06 The instruction which is sent to enable writing to the device. Set to 0 if the device does not have a write enable instruction. writeDisableInstruction int 0x04 The instruction which is sent to terminate write mode. Set to 0 if the device does not have a write disable instruction. writeEnableBits int 0x02 The bits of the status register that indicate the successful execution of the writeEnableInstruction.
Optional SPI Memory Device Parameters
The following is a table of optional parameters specific to both SPI EEPROM devices and SPI flash devices. Although these parameters are not required, defining them will improve the ability for the Flash Center to detect errors during the programming process.
Parameter Type Default Description readDeviceIdInstruction int For devices that support it, the instruction to read the device ID. expectedDeviceId binary The ID code expected from the read device ID instruction. Defining this parameter is only necessary if readDeviceIdInstruction is also defined. writeBufferInstruction int For memory devices that have a two part page program process, this defines the instruction for writing data to a memory buffer. See the Atmel AT45DBxxxx family of SPI flash parts for examples of memory parts that use memory buffers for page programming. writeStatusRegisterInstruction int 0x01 The instruction to write to the status register. Set to 0 if the device does not have a write status register instruction. writeStatusRegisterEnableInstruction int The instruction to enable writing to the status register. Define this parameter for parts that have separate write enable and write status register enable instructions. If this parameter is undefined, the Flash Center will use the value defined for writeEnableInstruction. writeStatusRegisterTime int 5000 The number of microseconds required to complete a write operation to the status register. Use the minimum or typical value, as the Flash Center can poll the device to wait additional time if necessary. If there are multiple speed grades for the memory part, the lowest time is recommended for this parameter. deviceConnectedBits int The bits of the status register that are always set to 1. This is used with the deviceConnectedMask parameter for detecting unplugged SPI devices. See the section below for more information about this parameter. deviceConnectedMask int The bits of the status register that have a fixed value. This is used with the deviceConnectedBits parameter for detecting unplugged SPI devices. If undefined, the value from deviceConnectedBits will be used. See the section below for more information about this parameter. blockProtectBits int 0x9c Sets which bits of the status register indicate that the device blocks or the status register are write protected. See the section below for more information about this parameter.
data
Device Connected Bits and Mask
In the SPI protocol, there is no predefined method for an SPI slave device to acknowledge receipt of commands from the SPI master. Therefore, the SPI master could send the slave a command but the master may not have a method for determining if a slave device was connected to receive it. However, if a SPI memory device has bits in the status register that always have a fixed value, the status register can be used by Flash Center to determine whether there is a connection to the device or not.
The deviceConnectedBits and deviceConnectedMask parameters are used to define these bits in the status register. The deviceConnectedMask parameter tells Flash Center which bits have a fixed value and deviceConnectedBits tells it what the value of those bits are. If these parameters are defined for a memory device, Flash Center will check these bits for a connection to the target device, both while the memory device is idle and while a memory operation, such as a page program or sector erase operation, is in progress.
If deviceConnectedBits is defined but deviceConnectedMask is undefined or 0, Flash Center will use the value of deviceConnectedBits for deviceConnectedMask. This results in Flash Center being only able to detect bits in the status register that have a fixed value of 1 but not bits that have a fixed value of 0.
If both deviceConnectedBits and deviceConnectedMask are undefined or 0, then the status register will not be used for detecting a connection to the target memory device.
Note: Some memory devices will return different results when the status register is read during a memory operation. For example, the Atmel AT25xxxx family will return b1111_1111 while a memory operation is in progress. Because none of the bits in the status register have the same value while the parts are idle, deviceConnectedBits and deviceConnectedMask are not defined for these parts, and the status register is not used to determine a connection to the parts.
Block Protect Bits
Most SPI memory parts have a system by which portions of the memory can be protected from modification. The blockProtectBits parameter tells Flash Center which bits of the status register indicate that block protection is enabled. Typically, a memory device will have a bit in the status register to indicate that block protection is enabled as well as bits used to indicate which blocks are protected. All of these bits should be included in the blockProtectBits parameter.
At the beginning of an erase or a write operation, if any of the block protect bits in the status register are non-zero, the Flash Center will write 0 to the status register in an attempt to clear the block protection. If the write status register instruction is not defined or writing to the status register fails to clear the block protect bits, an error message will be displayed and the operation will exit.
For devices whose block protect bits are not cleared by writing to the status register (e.g. they have special instructions to clear the block protection), the block protection will have to be cleared prior to using Flash Center to program the device.
SPI Flash Memory Device Parameters
The following is a table of the parameters specific to SPI flash memory devices.
Parameter Type Default Description eraseInstruction int The instruction which erases a portion of the device. If the device has multiple erase sizes (for devices with both sector and block erase), it is recommended that the instruction for the smaller erase size be given. eraseSize int The size in bytes of the portion erased by eraseInstruction. If the device has multiple erase sizes (for devices with both sector erase and block erase), it is recommended that the smaller size be specified. Value must be non-zero. eraseTime int The number of microseconds required complete the erase operation specified in eraseInstruction. Use the minimum or typical value, as the Flash Center can poll the device to wait additional time if necessary. If there are multiple speed grades for the memory part, the lowest time is recommended for this parameter. Value must be non-zero. hasEraseAll bool false If set to true, indicates that the device has support for the chip erase command and eraseAllInstruction and eraseAllTime must be defined. eraseAllInstruction int The instruction to execute a full chip erase. eraseAllTime int The number of microseconds required to execute the chip erase operation. Use the minimum or typical value, as the Flash Center can poll the device to wait additional time if necessary. If there are multiple speed grades for the memory part, the lowest time is recommended for this parameter. Value must be non-zero. eraseBeforeWrite bool true If set to false, Flash Center will not issue erase commands before a write command. This is useful for devices such as the Atmel AT45DBxxxx family of SPI flash parts, as they support a single command that erases and programs a page of memory.
| Prev: Application | Table of Contents | Next: Legal / Contact |
