Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ShenKanghui
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

Recently, I studied the Sflash  write operation of CYT4BF, and found that the parameter description in TRM seems to be inconsistent with the reality.

The description in TRM is attached.

According to its description,  I only need to set opcode, blocking mode, flash address and data address four parameters. The fact is, data is always written from sflash.untoc2_object_size, and data will be written to SFLASH from data address until hardFault is generated.

A description of the data length seems to be missing from the description of the parameter......

 

0 Likes
1 Solution
Apurva_S
Moderator
Moderator
Moderator
100 likes received 500 replies posted 250 solutions authored

Hi @ShenKanghui 

Each SFlash row consists of 512 bytes and WriteRow system call updates the complete 512 bytes. When you need to update only specific bytes/bits of the SFlash, the current value should be read from the memory and only those specific bytes/bits should be modified and passed as parameter for WriteRow system call.

Does this answer your question?

Regards.

View solution in original post

0 Likes
2 Replies
Apurva_S
Moderator
Moderator
Moderator
100 likes received 500 replies posted 250 solutions authored

Hi @ShenKanghui 

Each SFlash row consists of 512 bytes and WriteRow system call updates the complete 512 bytes. When you need to update only specific bytes/bits of the SFlash, the current value should be read from the memory and only those specific bytes/bits should be modified and passed as parameter for WriteRow system call.

Does this answer your question?

Regards.

0 Likes

Thank you for reply!

If WriteRow writes 512bytes at a time, that would explain my problem.  I only want to change one parameter in TOC2 now, but I find that TOC2 is only 508 bytes and HardFault will still occur...

If data is written from au32Reserved9[243] (512 bytes full), but au32Reserved9 is reserved, the system returns 0xF00000B2(Returned when WriteRow is called on invalid SFlash rows in NORMAL state.)

If HardFault is not considered, the data is already written correctly.

The parameter structure of TOC2 is shown in the attachment.

Well, thank you again.

0 Likes