STMicroelectronics SPC574Kxx, SPC572Lxx, SPC570Sxx, SPC574Sxx User Manual

UM1618 User manual

Standard Software Driver for C55 Flash module embedded on SPC57 K, L and S line microcontroller

Introduction

This document is the user manual for the Standard Software Driver (SSD) for single C55 Flash module integrated in SPC574Kxx, SPC572Lxx, SPC570Sxx and SPC574Sxx devices.

The SSD is a set of APIs that enables user application to operate on the Flash module embedded on a microcontroller. The C55 SSD contains a set of functions to program/erase a single C55 Flash module.

The C55 Standard Software Driver (SSD) Flash provides the following APIs:

FlashInit

FlashErase

FlashEraseAlternate

BlankCheck

FlashProgram

ProgramVerify

CheckSum

FlashCheckStatus

FlashSuspend

FlashResume

GetLock

SetLock

OverPgmProtGetStatus

FlashArrayIntegrityCheck

FlashArrayIntegritySuspend

FlashArrayIntegrityResume

UserMarginReadCheck

July 2020

UM1618 Rev 5

1/51

www.st.com

Contents

UM1618

 

 

Contents

1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. 6

 

1.1

Document overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

 

1.2

Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

2

API specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

 

2.1

General overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

 

2.2

General type definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

 

2.3

SSD configuration parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

 

2.4

Context data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

 

2.5

Other data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9

 

2.6

Return codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

 

2.7

Normal mode functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

2.7.1 FlashInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.7.2 FlashErase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.7.3 FlashEraseAlternate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.7.4 BlankCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.7.5 FlashProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.7.6 ProgramVerify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.7.7 CheckSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

2.7.8 FlashCheckStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

2.7.9 FlashSuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

2.7.10 FlashResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

2.7.11 GetLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

2.7.12 SetLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2.7.13 OverPgmProtGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

2.8 User Test Mode Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

2.8.1 FlashArrayIntegrityCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

2.8.2 FlashArrayIntegritySuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

2.8.3 FlashArrayIntegrityResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

2.8.4 UserMarginReadCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Appendix A Code sizes and stack usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

2/51

UM1618 Rev 5

UM1618

Contents

 

 

Appendix B Write/erase times. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Appendix C System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Appendix D Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Appendix E Document references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

UM1618 Rev 5

3/51

List of tables

UM1618

 

 

List of tables

Table 1. Type definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Table 2. SSD configuration structure field definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Table 3. Context data structure field definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Table 4. Block information structure field definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Table 5. Large block select structure field definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Table 6. MISR structure field definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Table 7. Return codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Table 8. Arguments for FlashInit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Table 9. Return values for FlashInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Table 10. Arguments for FlashErase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Table 11. Return values for FlashErase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Table 12. Troubleshooting for FlashErase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Table 13. Bit allocation for blocks in low address space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 14. Bit allocation for blocks in middle address space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 15. Bit allocation for blocks in high address space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 16. Bit Allocation for Blocks in the first Large Address Space . . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 17. Bit allocation for blocks in the second large address space . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 18. Arguments for FlashEraseAlternate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Table 19. Return values for FlashEraseAlternate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Table 20. Troubleshooting for FlashEraseAlternate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Table 21. Arguments for BlankCheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Table 22. Return values for BlankCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Table 23. Troubleshooting for BlankCheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Table 24. Arguments for FlashProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Table 25. Return values for FlashProgram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Table 26. Troubleshooting for FlashProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Table 27. Arguments for ProgramVerify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Table 28. Return values for ProgramVerify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Table 29. Troubleshooting for ProgramVerify. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Table 30. Arguments for CheckSum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 31. Return values for CheckSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 32. Troubleshooting for CheckSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 33. Arguments for FlashCheckStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Table 34. Return values for FlashCheckStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Table 35. Troubleshooting for FlashCheckStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Table 36. Arguments for FlashSuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Table 37. Return values for FlashSuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Table 38. Suspend State Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Table 39. Suspending State vs. C55 Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Table 40. Arguments for FlashResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Table 41. Return values for FlashResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Table 42. Resume state definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Table 43. Arguments for GetLock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Table 44. Return values for GetLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Table 45. Troubleshooting for GetLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Table 46. Lock indicator definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Table 47. blkLockState in low address space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Table 48. blkLockState in middle address space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4/51

UM1618 Rev 5

UM1618

List of tables

 

 

Table 49. blkLockState in high address space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Table 50. blkLockState in the first large block (128K/256K) address space. . . . . . . . . . . . . . . . . . . . 34 Table 51. blkLockState in the second large block space (128K/256K) address space . . . . . . . . . . . 34 Table 52. blkLockState in UTest block Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Table 53. Arguments for SetLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Table 54. Return values for SetLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Table 55. Troubleshooting for SetLock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Table 56. Arguments for OverPgmProtGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Table 57. Return values for OverPgmProtGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Table 58. Troubleshooting for OverPgmProtGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Table 59. Arguments for FlashArrayIntegrityCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Table 60. Return values for FlashArrayIntegrityCheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Table 61. Troubleshooting for FlashArrayIntegrityCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Table 62. Arguments for FlashArrayIntegritySuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Table 63. Return values for FlashArrayIntegritySuspend. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Table 64. Troubleshooting for FlashArrayIntegritySuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Table 65. Suspend State Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Table 66. Arguments for FlashArrayIntegrityResume. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Table 67. Return values for FlashArrayIntegrityResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Table 68. Troubleshooting for FlashArrayIntegrityResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Table 69. Resume state definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Table 70. Arguments for UserMarginReadCheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Table 71. Return values for UserMarginReadCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Table 72. Troubleshooting for UserMarginReadCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Table 73. Code size and stack usage for SPC574Kxx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Table 74. Write/erase times for SPC57EM80xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Table 75. Write/erase times for SPC574Kxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Table 76. System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Table 77. Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Table 78. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

UM1618 Rev 5

5/51

Introduction

UM1618

 

 

1Introduction

1.1Document overview

The roadmap for the document is as follows:

Section 1.2 shows the features of the driver. Appendix C: System requirements details the system requirement for the driver development.Appendix E: Document references and lists the documents referred and terms used in making of this document. Appendix D: Acronyms lists the acronyms used.

Chapter 2 describes the API specifications. In this section there are many sub sections, which describe the different aspects of the driver. Section 2.1 provides a general overview of the driver. Section 2.2 mentions about the type definitions used for the driver. Section 2.3 mentions the driver configuration parameters. Section 2.4 and Section 2.5 describe the data context structure and some other data structures used in this driver. Section 2.6 provides return code information. Section 2.7 and Section 2.8 provide the detailed description of normal mode and user’s test mode standard software Flash Driver APIs’ respectively.

1.2Features

The C55 SSD provides the following features:

Driver binary built with Variable-Length-Encoding (VLE) instruction set.

Driver released in binary c-array format to provide compiler-independent support for non-debug-mode embedded applications.

Driver released in s-record format to provide compiler-independent support for debugmode/JTAG programming tools.

Each driver function is independent of each other so the end user can choose the function subset to meet their particular needs.

Support from word-wise to quad-page-wise programming according to specific hardware feature for fast programming.

Position-independent and ROM-able

Ready-to-use demos illustrating the usage of the driver

Concurrency support via asynchronous design.

6/51

UM1618 Rev 5

UM1618

API specification

 

 

2API specification

2.1General overview

The C55 SSD has APIs to handle the erase, program, erase verify and program verify operations on the Flash. Apart from these, it also provides the feature for locking specific blocks and calculating check sum. This SSD also provides four User Test APIs for checking the Array Integrity and do user margin read check as well as do suspend/resume those operations. All functions work as asynchronous model for concurrency event support by invoking ‘FlashCheckStatus’ function to track the on-going status of targeted operation.

2.2General type definitions

Table 1. Type definitions

Derived type

Size

C language type description

 

 

 

BOOL

8-bits

unsigned char

 

 

 

INT8

8-bits

signed char

 

 

 

VINT8

8-bits

volatile signed char

 

 

 

UINT8

8-bits

unsigned char

 

 

 

VUINT8

8-bits

volatile unsigned char

 

 

 

INT16

16-bits

signed short

 

 

 

VINT16

16-bits

volatile signed short

 

 

 

UINT16

16-bits

unsigned short

 

 

 

VUINT16

16-bits

volatile unsigned short

 

 

 

INT32

32-bits

signed long

 

 

 

VINT32

32-bits

volatile signed long

 

 

 

UINT32

32-bits

unsigned long

 

 

 

VUINT32

32-bits

volatile unsigned long

 

 

 

2.3SSD configuration parameter

The configuration parameter which is used for SSD operations is explained in this section. The configuration parameters are handled as structure. User should correctly initialize the fields including c55RegBase, mainArrayBase, uTestArrayBase,, mainInterfaceFlag, programmableSize and BDMEnable before passing the structure to SSD functions. The rest of parameters such as lowBlockInfo, midBlockInfo, highBlockInfo and nLargeBlockNum, are initialized by ‘FlashInit’ automatically and can be used for other purposes of user’s application.

UM1618 Rev 5

7/51

API specification

 

UM1618

 

 

 

 

 

Table 2. SSD configuration structure field definition

 

Parameter name

Type

Parameter description

 

 

 

 

 

c55RegBase

UINT32

The base address of C55 control registers.

 

 

 

 

 

mainArrayBase

UINT32

The base address of Flash main array.

 

 

 

 

 

 

 

Block info of the low address space. It includes

 

lowBlockInfo

BLOCK_INFO

information of this block space based on different block

 

 

 

sizes.

 

 

 

 

 

 

 

Block info of the mid address space. It includes

 

midBlockInfo

BLOCK_INFO

information of this block space based on different block

 

 

 

sizes.

 

 

 

 

 

 

 

Block info of the high address space. It includes

 

highBlockInfo

BLOCK_INFO

information of this block space based on different block

 

 

 

sizes.

 

 

 

 

 

nLargeBlockNum

UINT32

Number of blocks of the large address space (128K or

 

256K).

 

 

 

 

 

 

 

 

uTestArrayBase

UINT32

The base address of the UTest block.

 

 

 

 

 

mainInterfaceFlag

BOOL

The flag to select main interface or not.

 

 

 

 

 

programmableSize

UINT32

The maximum programmable size of the C55 Flash

 

according to specific interface.

 

 

 

 

 

 

 

 

BDMEnable

BOOL

The debug mode selection. User can enable/disable

 

debug mode via this input argument.

 

 

 

 

 

 

 

The type definition for the structure is given below.

typedef struct _c55_ssd_config

{

UINT32 c55RegBase;

UINT32 mainArrayBase;

BLOCK_INFO lowBlockInfo;

BLOCK_INFO midBlockInfo;

BLOCK_INFO highBlockInfo;

UINT32 nLargeBlockNum;

UINT32 uTestArrayBase;

BOOL mainInterfaceFlag;

UINT32 programmableSize;

BOOL BDMEnable;

} SSD_CONFIG, *PSSD_CONFIG;

2.4Context data structure

The Context Data structure is used for storing the context variable values while an operation is in-progress. The operations that support asynchronous model may require caching the context data including ‘FlashProgram’, ‘ProgramVerify’, ‘BlankCheck’, ‘CheckSum’, ‘FlashArrayIntegrityCheck’, and ‘UserMarginReadCheck’. User needs to declare and initialize a context data

8/51

UM1618 Rev 5

UM1618

API specification

 

 

structure before passing it to the above SSD functions. Refer to ‘FlashCheckStatus’ to have a quick view of how to initialize the context data. The context data structure contents can be reviewed at any time during the operation progress (these information may be useful in some cases), but they must not be changed for any reason in order to make the operation completes correctly.

 

Table 3. Context data structure field definitions

Name

 

Description

 

 

 

dest

 

The context destination address of an operation

 

 

 

size

 

The context size of an operation

 

 

 

source

 

The context source of an operation

 

 

 

pFailedAddress

 

The context failed address of an operation

 

 

 

pFailedData

 

The context failed data of an operation

 

 

 

pFailedSource

 

The context failed source of an operation

 

 

 

pSum

 

The context sum of an operation

 

 

 

pMisr

 

The context MISR values of an operation

 

 

 

pReqCompletionFn

 

Function pointer to the Flash function being checked for status

 

 

 

The type definition for the structure is given below.

typedef struct _c55_context_data

{

UINT32 dest;

UINT32 size;

UINT32 source;

UINT32 *pFailedAddress;

UINT32 *pFailedData;

UINT32 *pFailedSource;

UINT32 *pSum;

MISR *pMisr;

void* pReqCompletionFn;

} CONTEXT_DATA, *PCONTEXT_DATA;

2.5Other data structures

Some other data structures used for SSD operation is explained in this section. They are the structures used for variable declaration in SSD configuration and context data structures or input argument declaration in some APIs.

Table 4. Block information structure field definitions

Name

Type

Definition

 

 

 

n16KBlockNum

UINT32

Number of 16K block.

 

 

 

UM1618 Rev 5

9/51

API specification

 

UM1618

 

 

 

 

 

Table 4. Block information structure field definitions (continued)

 

Name

Type

Definition

 

 

 

 

 

n32KBlockNum

UINT32

Number of 32K block.

 

 

 

 

 

n64KBlockNum

UINT32

Number of 64K block.

 

 

 

 

The type definition for the structure is given below:

typedef struct _c55_block_info

{

UINT32 n16KBlockNum;

UINT32 n32KBlockNum;

UINT32 n64KBlockNum;

} BLOCK_INFO, *PBLOCK_INFO;

Table 5. Large block select structure field definitions

Name

Type

Definition

 

 

 

 

 

Bit map for the first 32 bit block select (from bit 0 to bit

firstLargeBlockSelect

UINT32

31) in Large block (128K or 256K block) space such that

bit 0 is corresponding to the least significant bit and bit

 

 

 

 

31 is corresponding to the most significant bit.

 

 

 

 

 

Bit map for the second 32 bit block select (from bit 32 to

secondLargeBlockSelect

UINT32

upper bits) in Large block (128K or 256K block) space

such that bit 32 is corresponding to the least significant

 

 

 

 

bit and bit 63 is corresponding to the most significant bit.

 

 

 

The type definition for the structure is given below:

typedef struct _c55_nLarge_block_sel

{

UINT32 firstLargeBlockSelect;

UINT32 secondLargeBlockSelect;

} NLARGE_BLOCK_SEL, *PNLARGE_BLOCK_SEL;

Table 6. MISR structure field definitions

Name

Type

Definition

 

 

 

Wn

 

Each Wn is corresponding to each MISR value provided by

UINT32

user. User must provide totally ten MISR values via this

n = 0, 1, …9

 

structure to do user’s test mode functions.

 

 

 

 

 

The type definition for the structure is given below:

typedef struct _c55_misr

{

UINT32 w0;

UINT32 w1;

UINT32 w2;

UINT32 w3;

10/51

UM1618 Rev 5

UM1618

API specification

 

 

UINT32 w4;

UINT32 w5;

UINT32 w6;

UINT32 w7;

UINT32 w8;

UINT32 w9;

} MISR, *PMISR;

2.6Return codes

The return code is returned to the caller function to notify the success or errors of the API execution. These are the possible values of return code:

Table 7. Return codes

Name

Value

Description

 

 

 

C55_OK

0x00000000

The requested operation is successful.

 

 

 

C55_ERROR_ALIGNMENT

0x00000001

Alignment error.

 

 

 

 

 

New program/erase cannot be performed

 

 

while a high voltage operation is already in

C55_ERROR_BUSY

0x00000004

progress.

 

 

New array integrity cannot be performed

 

 

while an array integrity is going on.

 

 

 

C55_ERROR_PGOOD

0x00000008

The program operation is unsuccessful.

 

 

 

C55_ERROR_EGOOD

0x00000010

The erase operation is unsuccessful.

 

 

 

C55_ERROR_NOT_BLANK

0x00000020

There is a non-blank Flash memory location

 

 

within the checked Flash memory region.

 

 

There is a mismatch between the source data

C55_ERROR_VERIFY

0x00000040

and the content in the checked Flash

 

 

memory.

 

 

 

C55_ERROR_BLOCK_INDICATOR

0x00000080

Invalid block space indicator.

 

 

 

C55_ERROR_ALTERNATE

0x00000100

The operation does not support alternate

 

 

interface for the specified address space.

C55_ERROR_FACTORY_OP

0x00000200

Factory erase/program is locked.

 

 

 

 

 

In ‘FlashArrayIntegrityCheck’ or

C55_ERROR_MISMATCH

0x00000400

‘UserMarginReadCheck’, the MISR values

generated by the hardware do not match the

 

 

values passed by the user.

 

 

 

 

 

In ‘FlashArrayIntegrityCheck’ or

C55_ERROR_NO_BLOCK

0x00000800

‘UserMarginReadCheck’, no block has been

 

 

enabled for array integrity check.

 

 

 

C55_ERROR_ADDR_SEQ

0x00001000

Invalid address sequence error.

 

 

 

C55_ERROR_MARGIN_LEVEL

0x00002000

Invalid margin level error.

 

 

 

UM1618 Rev 5

11/51

API specification

 

 

UM1618

 

 

 

 

 

 

 

Table 7. Return codes (continued)

 

Name

 

Value

Description

 

 

 

 

 

 

 

 

 

The operation has been done and there is no

 

C55_DONE

 

0x00010000

more this operation requested on

 

 

 

 

FlashCheckStatus function.

 

 

 

 

 

 

 

 

 

The operation is in progress and user need

 

C55_INPROGRESS

 

0x00020000

call FlashCheckStatus more times finish this

 

 

 

 

operation.

 

 

 

 

 

2.7Normal mode functions

2.7.1FlashInit

Description

This function initializes an individual Flash module. It accesses to Flash configuration register and read out the number of block for each memory space of single Flash module.

For each time of using this driver, user must provide the chip-dependent parameters such as c55RegBase, mainArrayBase, uTestArrayBase, mainInterfaceFlag, programmableSize and DBMEnable and the rest of parameters are initialized via this function. Those are block information including number of block based on block size for each address space.

Prototype

UINT32 FlashInit (PSSD_CONFIG pSSDConfig);

Arguments

Table 8. Arguments for FlashInit

Argument

Description

Range

 

 

 

pSSDConfig

Pointer to the SSD

The values in this structure are chip-dependent.

Configuration Structure.

Please refer to Section 2.3 for more details.

 

 

 

 

Return values

Table 9. Return values for FlashInit

Type

Description

Possible values

 

 

 

UINT32

Indicates successful completion of operation.

C55_OK

 

 

 

Troubleshooting

None.

Comments

In case of mainInterfaceFlag is main interface, ‘FlashInit’ checks the C55_MCR_RWE, C55_MCR_EER and C55_MCR_SBC bits, and then clear them if any of them is set.

12/51

UM1618 Rev 5

UM1618

API specification

 

 

This function also clears PGM/ERS bit in MCR/MCRA register if any of them is set.

Assumptions

None.

2.7.2FlashErase

Description

This function is to do erase operation for multi-blocks on single Flash module according to user’s input arguments via main interface. The targeted Flash module status is checked in advance to return relevant error code if any. This function only sets the high voltage without waiting for the operation to be finished. Instead, user must call ‘FlashCheckStatus’ function to confirm the successful completion of this operation.

Prototype

UINT32 FlashErase(PSSD_CONFIG pSSDConfig,

UINT8 eraseOption,

UINT32 lowBlockSelect,

UINT32 midBlockSelect,

UINT32 highBlockSelect,

NLARGEK_BLOCK_SEL nLargeBlockSelect);

Arguments

Table 10. Arguments for FlashErase

Argument

Description

Range

 

 

 

pSSDConfig

Pointer to the SSD

The values in this structure are chip-dependent.

Configuration Structure.

Please refer to Section 2.3 for more details.

 

 

 

 

 

 

The valid value can be:

 

The option is to select

C55_ERASE_MAIN (0x0)

eraseOption

user’s expected erase

C55_ERASE_MAIN_FERS (0x1)

 

operation.

C55_ERASE_UTEST (0x2)

 

 

C55_ERASE_UTEST_FERS (0x3)

 

 

 

 

 

Bit-mapped value such that the least significant

 

 

bit is at bit 0 of 16K block region (if available),

 

To select the array blocks

then 32K block region (if available) and lastly

lowBlockSelect

64K block region (if available). Select the block

in low address space for

in the low address space to be erased by setting

 

erasing.

 

1 to the appropriate bit of lowBlockSelect. If

 

 

 

 

there is not any block to be erased in the low

 

 

address space, lowBlockSelect must be set to 0.

 

 

 

UM1618 Rev 5

13/51

API specification

 

 

UM1618

 

 

 

 

 

 

 

Table 10. Arguments for FlashErase (continued)

 

Argument

 

Description

Range

 

 

 

 

 

 

 

 

 

Bit-mapped value such that the least significant

 

 

 

 

bit is at bit 0 of 16K block region (if available),

 

 

 

To select the array blocks

then 32K block region (if available) and lastly

 

 

 

64K block region (if available). Select the block

 

midBlockSelect

 

in mid address space for

in the middle address space to be erased by

 

 

 

erasing.

setting 1 to the appropriate bit of

 

 

 

 

midBlockSelect. If there is not any block to be

 

 

 

 

erased in the middle address space,

 

 

 

 

midBlockSelect must be set to 0.

 

 

 

 

 

 

 

 

 

Bit-mapped value such that the least significant

 

 

 

 

bit is at bit 0 of 16K block region (if available),

 

 

 

To select the array blocks

then 32K block region (if available) and lastly

 

 

 

64K block region (if available). Select the block

 

highBlockSelect

 

in high address space for

in the high address space to be erased by

 

 

 

erasing.

setting 1 to the appropriate bit of

 

 

 

 

highBlockSelect. If there is not any block to be

 

 

 

 

erased in the high address space,

 

 

 

 

highBlockSelect must be set to 0.

 

 

 

 

 

 

 

 

To select the array blocks

Bit-mapped value such that the least significant

 

 

 

in Large (128K or 256K)

bit is at bit 0 of Large block region (if available).

 

 

 

address space for erasing.

 

nLargeBlockSelect

 

It includes two elements to

Select the block in the Large address space to

 

 

be erased by setting 1 to the appropriate bit of

 

 

 

decode the first half of

nLargeBlockSelect. If there is not any block to

 

 

 

Large block select and the

 

 

 

second half of Large block

be erased in the Large address space,

 

 

 

nLargeBlockSelect must be set to 0.

 

 

 

select.

 

Return values

Table 11. Return values for FlashErase

Type

Description

Possible values

 

 

 

 

 

C55_OK

UINT32

Successful completion or error value.

C55_ERROR_ERASE_OPTION

C55_ERROR_BUSY

 

 

C55_ERROR_FACTORY_OP

 

 

 

14/51

UM1618 Rev 5

STMicroelectronics SPC574Kxx, SPC572Lxx, SPC570Sxx, SPC574Sxx User Manual

UM1618 API specification

Troubleshooting

Table 12. Troubleshooting for FlashErase

Error codes

Possible causes

Solution

 

 

 

C55_ERROR_ERASE_OPTION

Invalid erase option.

Use one of the valid values for the

option.

 

 

 

 

 

 

 

Wait until all previous program/erase

 

New erase operation

operations on the Flash module

 

cannot be performed

finish. Possible cases that erase

C55_ERROR_BUSY

because there is

cannot start are:

program/erase sequence in

– erase in progress (MCR-ERS is

 

 

progress on the Flash

high);

 

module.

– program in progress (MCR-PGM

 

 

is high);

 

 

 

 

The factory erase could not

Factory erase is locked by the

C55_ERROR_FACTORY_OP

system due to the data at the UTest

 

be performed.

NVM ‘diary’ location.

 

 

 

 

 

Comments

'FlashErase' always uses main interface to complete an erase operation and ignores the value of the ‘mainInterfaceFlag’ in the SSD configuration structure. However, it is recommended that user should explicitly set this flag value to TRUE before calling

'FlashErase'.

The eraseOption input argument provides an option for user to select his expected erase operation. If user wants to do factory erase, he must select eraseOption as C55_ERASE_MAIN_FERS or C55_ERASE_UTEST_FERS. If user wants to do normal erase operation on main array, eraseOption must be C55_ERASE_MAIN and lastly, user must select C55_ERASE_UTEST to do erase operation on UTest block.

The factory erase feature can be used to provide a faster erase. But the feature cannot be performed if the data at “diary” location in the UTest NVM space contains at least one zero at reset. In that case, each try to perform factory erase causes the error C55_ERROR_FACTORY_OP be returned.

The inputs lowBlockSelect, midBlockSelect, highBlockSelect and nLargeBlockSelect are bit-mapped arguments that are used to select the blocks to be erased in the Low/Mid/High/Large address spaces of main array. The selection of the blocks of the main array is determined by setting/clearing the corresponding bit in lowBlockSelect, midBlockSelect, highBlockSelect or nLargeBlockSelect.

The bit allocations for blocks in one address space are: the least significant bit is corresponding to 16K block region and start with block 0 (if available), then 32K block region (if available), then 64K block region (if available), and lastly 8K block region (if available). The following diagrams show the formats of lowBlockSelect, midBlockSelect, highBlockSelect and nLargeBlockSelect for the C55 module.

The Large block select includes two elements to decode the block selection for first 32 blocks (from bit 0 to bit 31) and second 32 blocks (from bit 32 to upper bits) separately.

Below is example for block allocation and bit map for specific Flash module with two blocks for each block size in low, middle or high address space. The invalid blocks are marked as reserved. And the number of valid bits may be various according to specific Flash module.

UM1618 Rev 5

15/51

API specification

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

UM1618

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Table 13. Bit allocation for blocks in low address space

 

 

 

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

bit 31

 

 

 

 

 

bit 5

 

 

bit 4

 

 

bit 3

 

 

bit 2

 

bit 1

 

 

 

bit 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

reserved

 

 

 

64K block 1

 

64K block 0

32K block 1

 

32K block 0

16K block 1

 

16K block 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Table 14. Bit allocation for blocks in middle address space

 

 

 

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

bit 31

 

 

 

 

bit 5

 

 

bit 4

 

 

 

bit 3

 

 

bit 2

 

bit 1

 

 

 

bit 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

reserved

 

 

64K block 1

 

64K block 0

 

32K block 1

 

32K block 0

16K block 1

 

16K block 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Table 15. Bit allocation for blocks in high address space

 

 

 

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

bit 31

 

bit 9

 

 

bit 8

 

 

bit 7

 

bit 6

 

bit 5

 

 

bit 4

bit 3

 

bit 2

 

bit 1

 

bit 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8K

 

 

8K

 

 

8K

 

8K

 

 

64K

 

 

64K

32K

 

32K

 

16K

 

16K

 

reserved

 

block

 

 

block

 

block

 

block

 

block

 

block

block

 

block

 

block

 

 

 

 

 

 

 

 

 

 

 

 

block 0

 

 

 

 

 

3

 

2

 

 

1

 

 

0

 

 

1

 

0

 

1

 

0

 

 

1

 

 

 

 

Table 16. Bit Allocation for Blocks in the first Large Address Space

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

bit 31

 

 

 

 

 

bit 16

 

 

 

bit 15

 

 

bit 14

 

 

 

 

bit 1

 

 

 

 

bit 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

block 31

 

 

 

 

 

block 16

 

block 15

 

block 14

 

 

block 1

 

 

block 0

 

 

 

 

 

 

 

 

 

 

 

 

Table 17. Bit allocation for blocks in the second large address space

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

bit 31

 

 

 

 

 

bit 16

 

 

 

bit 15

 

 

bit 14

 

 

 

 

bit 1

 

 

 

 

bit 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

reserved

 

 

 

 

 

reserved

 

block 47

 

block 46

 

 

block 33

 

block 32

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If the selected main array blocks or UTest block are locked for erasing, those blocks are not erased, but ‘FlashErase’ still returns C55_OK. User needs to check the erasing result with the ‘BlankCheck’ function.

It is impossible to erase any Flash block when a program or erase operation is already in progress on C55 module. ‘FlashErase’ returns C55_ERROR_BUSY when trying to do so. In addition, when ‘FlashErase’ is running, it is unsafe to read the data from the Flash partitions having one or more blocks being erased. Otherwise, it causes a Read-While-Write error.

Assumptions

It assumes that the Flash block is initialized using a ‘FlashInit’ API.

16/51

UM1618 Rev 5

Loading...
+ 35 hidden pages