J-Flash SPI - Custom Device Support
While J-Flash SPI already supports a large number of SPI flashes, there might still be devices that are not yet included.
To allow customers to fill the gaps on their own, custom J-Flash SPI device support can be expanded through XML files.
This article details how custom device support can be added.
Adding a new device
In order to add a new SPI flash device to the J-Flash SPI software, the device can be added to the Flash.xml file found in the J-Link software installation directory under ETC\JFlashSPI\Flash.xml or to a custom FlashDevices XML file.
Devices are split into <DeviceInfo> and <Device> tags. When adding a new device, it should first be checked wether a <DeviceInfo> tag with the same attributes already exists. If so, the new <Device> tag can be added as a child of that <DeviceInfo> tag. Otherwise, a new <DeviceInfo> and <Device> tag should be created.
The file uses the following structure:
<DeviceList>
<Flash>
<Eeprom>
<DeviceInfo Id3B="0x000000" PageSize="0x00000020" SectSize="0x00000000" DevSize="0x00001000" StatRegFormat="MICRON" Type4BMode="NONE" SpiApi="EEPROM_2BADDR">
<Device Vendor="ST" Name="M95320"/>
</DeviceInfo>
</Eeprom>
<Nor>
<DeviceInfo Id3B="0x158020" PageSize="0x00000100" SectSize="0x00010000" DevSize="0x00200000" StatRegFormat="WINBOND_3BP" Type4BMode="NONE" SpiApi="NORMAL">
<Device Vendor="ST" Name="M25PE16"/>
</DeviceInfo>
</Nor>
<Fram>
<DeviceInfo Id3B="0x0822C2" PageSize="0x00000100" SectSize="0x00008000" DevSize="0x00008000" StatRegFormat="MICRON" Type4BMode="NONE" SpiApi="FRAM">
<Device Vendor="Infineon" Name="FM25V02A"/>
</DeviceInfo>
</Fram>
</Flash>
</DeviceList>
FlashDevices folder
Similar to the JLinkDevices folder, custom XML files can be placed into the FlashDevices folder.
This is recommended for custom device support, as adding devices to the included Flash.xml file will result in lost changes after updating the J-Link software package, while the FlashDevices folder is persistent.
In case a custom device shares an ID and name with an internal device, the custom devices will fully override the internal device.
If the folder does not exist, it may be created.
The location of the central folder depends on the host OS, as well as on the active user on that OS:
| OS | Location |
|---|---|
| Windows | C:\Users\<USER>\AppData\Roaming\SEGGER\FlashDevices |
| Linux | $HOME/.config/SEGGER/FlashDevices |
| macOS | $HOME/Library/Application Support/SEGGER/FlashDevices |
Flash Device XML file
The Flash.xml file is used to add support for new flash devices.
This section explains the structure, tags, attributes etc. of the Flash.xml file.
In the following, the valid XML tags and their possible attributes are explained.
General rules
- Attributes may only occur inside an opening tag
- Attribute values must be enclosed by quotation marks
Tag Description
| Tag | Description |
|---|---|
| <DeviceList> | Opens the XML file top-level tag. |
| <Flash> | Opens the flash device list. |
| <Eeprom> | Opens the EEPROM device list. |
| <Nor> | Opens the NOR device list. |
| <Fram> | Opens the FRAM device list. |
| <DeviceInfo> | Specifies general device information that can be applied to multiple flash devices. |
| <Device> | Specifies device specific information. |
XML-tag DeviceList
Example
<DeviceList>
<Flash>
<Nor>
<DeviceInfo Id3B="0x158020" PageSize="0x00000100" SectSize="0x00010000" DevSize="0x00200000" StatRegFormat="WINBOND_3BP" Type4BMode="NONE" SpiApi="NORMAL">
<Device Vendor="ST" Name="M25PE16"/>
</DeviceInfo>
</Nor>
</Flash>
</DeviceList>
Explanation
Opens the XML file top-level tag. Only present once per XML file.
Attributes
This tag has no attributes.
Notes
- Must only occur once per XML file
- Must be closed via </DeviceList>
XML-tag Flash
Example
<Flash>
<Nor>
<DeviceInfo Id3B="0x158020" PageSize="0x00000100" SectSize="0x00010000" DevSize="0x00200000" StatRegFormat="WINBOND_3BP" Type4BMode="NONE" SpiApi="NORMAL">
<Device Vendor="ST" Name="M25PE16"/>
</DeviceInfo>
</Nor>
</Flash>
Explanation
Opens the flash device list.
Attributes
This tag has no attributes.
Notes
- Must only occur once in a <DeviceList> tag
- Must be closed via </Flash>
XML-tag Eeprom
Example
<Eeprom>
<DeviceInfo Id3B="0x000000" PageSize="0x00000020" SectSize="0x00000000" DevSize="0x00001000" StatRegFormat="MICRON" Type4BMode="NONE" SpiApi="EEPROM_2BADDR">
<Device Vendor="ST" Name="M95320"/>
</DeviceInfo>
</Eeprom>
Explanation
Opens the EEPROM device list.
Attributes
This tag has no attributes.
Notes
- Must only occur once in a <Flash> tag
- Must be closed via </Eeprom>
XML-tag Nor
Example
<Nor>
<DeviceInfo Id3B="0x158020" PageSize="0x00000100" SectSize="0x00010000" DevSize="0x00200000" StatRegFormat="WINBOND_3BP" Type4BMode="NONE" SpiApi="NORMAL">
<Device Vendor="ST" Name="M25PE16"/>
</DeviceInfo>
</Nor>
Explanation
Opens the NOR device list.
Attributes
This tag has no attributes.
Notes
- Must only occur once in a <Flash> tag
- Must be closed via </Nor>
XML-tag Fram
Example
<Fram>
<DeviceInfo Id3B="0x0822C2" PageSize="0x00000100" SectSize="0x00008000" DevSize="0x00008000" StatRegFormat="MICRON" Type4BMode="NONE" SpiApi="FRAM">
<Device Vendor="Infineon" Name="FM25V02A"/>
</DeviceInfo>
</Fram>
Explanation
Opens the FRAM device list.
Attributes
This tag has no attributes.
Notes
- Must only occur once in a <Flash> tag
- Must be closed via </Fram>
XML-tag DeviceInfo
Example
<DeviceInfo Id3B="0x158020" PageSize="0x00000100" SectSize="0x00010000" DevSize="0x00200000" StatRegFormat="WINBOND_3BP" Type4BMode="NONE" SpiApi="NORMAL">
<Device Vendor="ST" Name="M25PE16"/>
</DeviceInfo>
Explanation
Specifies general device information that can be applied to multiple flash devices.
Attributes
| Attribute | Mandatory | Description | Example |
|---|---|---|---|
| Id3B | Hexadecimal value that specifies the ID of the device. | Id3B="0x158020" | |
| Ignore2ndIdByte | Specifies wether the second byte of the ID should be ignored for identification. | Ignore2ndIdByte="1" | |
| PageSize | Hexadecimal value that specifies the page size of the device. | PageSize="0x00000100" | |
| SectSize | Hexadecimal value that specifies the sector size of the device. | SectSize="0x00010000" | |
| DevSize | Hexadecimal value that specifies the size of the device. | DevSize="0x00200000" | |
| StatRegFormat | Specifies the format of the status register. For a list of valid attribute values, please refer to Attribute values - StatRegFormat. | StatRegFormat="MICRON" | |
| Type4BMode | Specifies the supported 4B mode. For a list of valid attribute values, please refer to Attribute values - Type4BMode. | Type4BMode="NONE" | |
| SpiApi | Specifies the used SPI API. For a list of valid attribute values, please refer to Attribute values - SpiApi. | SpiApi="NORMAL" | |
| IdInfo | Specifies additional ID information. For a list of valid attribute values, please refer to Attribute values - IdInfo. | IdInfo="S25FS512S" | |
| QspiInfo | Specifies additional information for QSPI devices. For a list of valid attribute values, please refer to Attribute values - QspiInfo. | QspiInfo="GD25Q128E" |
Notes
- May occur multiple times in a <Eeprom>, <Nor> or <Fram> tag
- Must include at least one <Device> tag
- Must be closed via </DeviceInfo>
| Attribute values - StatRegFormat | Description |
|---|---|
| MICRON | StatusFlagReg: [1:1] == Err, [4:4] == Err, [5:5] == Err, [7:7] == Ready StatusReg: [4:2] = BP0-2, [6:6] == BP3 |
| MICRON_2 | [0:0] == Busy, [4:2] == BP0-2, [6:6] == BP3 |
| SPANSION | [0:0] == Busy, [4:2] == BP0-2, [6:5] == ErrFlags |
| WINBOND_3BP | Byte0: [0:0] == Busy, [4:2] == BP0-2 Byte1: [0:0] == SRP1, [1:1] == QE, [5:3] == LB1-LB3, [6:6] == CMP |
| WINBOND_4BP | [0:0] == Busy, [5:2] == BP0-3, [6:6] == QE |
| ADESTO_1BP | [0:0] == Busy |
| GIGADEV_5BP | [0:0] == Busy, [6:2] == BP0-4, [9:9] == QE in WRR |
| MICRON_3BP | [0:0] == Busy, [4:2] == BP0-2 |
| ADESTO_2BP | [0:0] == Busy, [3:2] == BP0-1 |
| MICROCHIP | [0:0] == Busy, [4:4] == BP0 |
| ADESTO_PE | [0:0] == PageSize, [1:1] == Sector Protection, [7:7] == Busy |
| GIGADEV_5BP_2 | [0:0] == Busy, [6:2] == BP0-4 |
| WINBOND_4BP_2 | [0:0] == Busy, [5:2] == BP0-3 |
| ALLIANCE_3BP | [0:0] == Busy, [4:2] == BP0-2; QE [9:9] == QE |
| SPANSION_4BP | [0:0] == Busy, [5:2] == BP0-3 |
| XMC_4BP | [0:0] == Busy, [5:2] == BP0-3; [9:9] == QE |
| Attribute values - Type4BMode | Description |
|---|---|
| NONE | Device does not support 4B mode at all |
| EXTRA_CMDS | Device supports extra prog, erase, read commands which accept 4 byte addresses |
| ENTER_EXIT | Device supports specific commands to enter/exit 4B mode and make old commands temporarily 4B compatible |
| 4BCMD | Device supports only commands with 4 byte addresses |
| Attribute values - SpiApi | WREN | WRDI | RDID | RDSR | WRSR | READ | PP | SE | BE | EN4B | EX4B | NumAddrBytes | Dedicated4BAddrMode | StatusIsReadyBit | StatusBitPos | FMEN PROG | FMEN ERASE |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EEPROM_2BADDR | 0x06 | 0x04 | 0x00 | 0x05 | 0x01 | 0x03 | 0x02 | 0x00 | 0x00 | 0x00 | 0x00 | 0x02 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 |
| EEPROM_3BADDR | 0x06 | 0x04 | 0x00 | 0x05 | 0x01 | 0x03 | 0x02 | 0x00 | 0x00 | 0x00 | 0x00 | 0x03 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 |
| FRAM | 0x06 | 0x04 | 0x9F | 0x05 | 0x01 | 0x03 | 0x02 | 0x00 | 0x00 | 0x00 | 0x00 | 0x02 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 |
| NORMAL | 0x06 | 0x04 | 0x9F | 0x05 | 0x01 | 0x03 | 0x02 | 0xD8 | 0xC7 | 0xB7 | 0xE9 | 0x03 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 |
| MICRON | 0x06 | 0x04 | 0x9F | 0x70 | 0x01 | 0x03 | 0x02 | 0xD8 | 0xC7 | 0xB7 | 0xE9 | 0x03 | 0x00 | 0x01 | 0x07 | 0x00 | 0x00 |
| MICROCHIP | 0x06 | 0x04 | 0x9F | 0x05 | 0x01 | 0x03 | 0x02 | 0x20 | 0xC7 | 0xB7 | 0xE9 | 0x03 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 |
| ADESTO_PE | 0x00 | 0x00 | 0x9F | 0xD7 | 0x00 | 0x03 | 0x02 | 0x50 | 0x00 | 0x00 | 0x00 | 0x03 | 0x00 | 0x01 | 0x07 | 0x00 | 0x00 |
| Attribute values - IdInfo |
|---|
| S25FL512S |
| S25FS512S |
| Attribute values - QspiInfo |
|---|
| GD25Q128E |
XML-tag Device
Example
<Device Vendor="ST" Name="M25PE16"/>
Explanation
Specifies device specific information.
Attributes
| Attribute | Mandatory | Description | Example |
|---|---|---|---|
| Vendor | String value that specifies the vendor of the device. | Vendor="ST" | |
| Name | String value that specifies the name of the device. | Name="M25P16" |
Notes
- May occur multiple times in a <DeviceInfo> tag
- No separate closing tag. Directly closed after attributes have been specified: <Device ... />