write byte by byte in program flash (S32K144)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

write byte by byte in program flash (S32K144)

3,463件の閲覧回数
tomgt
Contributor I

Hello,

it is possible to write byte by byte in program flash? (S32K144).

0 件の賞賛
返信
8 返答(返信)

2,357件の閲覧回数
tomgt
Contributor I

thanks for the help.

Tom

0 件の賞賛
返信

2,357件の閲覧回数
tomgt
Contributor I

is there any other way or trick to write byte per byte?

0 件の賞賛
返信

2,357件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi Tom, 

if you need store something like "calibration data/runtime data" - you can use FlexNVM configured as an EEEROM. On S32K144 is up to 4kB EEEROM available. EEEROM usage is part of S32DS Example - flash_partitioning_s32k144. 

Anyway - what is your use case for writing data byte by byte into pflash? 

Jiri

0 件の賞賛
返信

2,357件の閲覧回数
tomgt
Contributor I

Hi, 

I need to write in pflash. Target is : possible to write single byte into pflash. I am first erase sector and try to write data like this(on this same address):
-  0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
-  0xFF, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
-  0xFF, 0xFF, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF

somethimes it works, and i am read data correctrly:
(for this example i am read: 0x01, 0x02, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF)
but somethimes i am read some incorrect data like:
0x02, 0x02, 0x04, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF
and somethimes memory is crash and when i am read memory at this adrress then HardFault occur and CFSR have set bits: PRECISERR and BFARVALID.

for each case FTFC->FSTAT is set to 0x81(without first write). In summary writing to Pflash using my method is very unstable.

0 件の賞賛
返信

2,357件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Tom,

 

The results are expected. Because after the second write the data do not match the ECC checksum.

The incorrect data that you read mean “corrected” single-bit ECC errors.

The crash means an uncorrectable double-bit error.

 

Regards,

Daniel

0 件の賞賛
返信

2,357件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

in this case - you need to read sector with byte you are interested in into RAM,  modify particular byte of the sector in the RAM, delete sector in pflash, write modified sector from RAM back to its place. Also - don't forget disable all interrupts during flash operation. 

to be honest - the request write byte by byte into pflash is very odd - I can't imagine any meaningful user case for that. 

Jiri

0 件の賞賛
返信

2,357件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Tom,

 

There is no other way due to ECC.

 

During the programming of the Flash, ECC checksum is generated.

The programming operation of the Flash and the checksum is unidirectional, it can only move bits from the '1' state (erased) to the '0' state (programmed).

So once the ECC checksum has been generated, its bits cannot be changed from 0 to 1 again without an erase operation. Therefore, after a subsequent write to the same phrase, the ECC checksum will not match the stored data and this causes ECC errors.

 

Regards,

Daniel

0 件の賞賛
返信

2,357件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

The smallest portion of Flash that can be written is one phrase (8 previously erased bytes) using Program Phrase command.

Regards,

Daniel  

0 件の賞賛
返信