Code execution during flash storage.

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

cross mob
BrCo_4643431
Level 1
Level 1

I have a application that requires continuous execution from the CM4. Occasionally data is placed into flash by the CM0 , which blocks code execution by the CM4 during the flash write, even during a non-blocking flash write. Is there any way to have CM4 code execution continue uninhibited during the CM0  flash storage event?

0 Likes
1 Solution
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Which PSoC 6 sub family device are you using?

If you are using PSoC 63 family device, please refer section 13.1.5 Read While Write (RWW) Support in PSoC 63 BLE architecture TRM (link given below)

https://www.cypress.com/file/385621/download

Please go through it and update if you need more details.

Thanks

Ganesh

View solution in original post

0 Likes
4 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Which PSoC 6 sub family device are you using?

If you are using PSoC 63 family device, please refer section 13.1.5 Read While Write (RWW) Support in PSoC 63 BLE architecture TRM (link given below)

https://www.cypress.com/file/385621/download

Please go through it and update if you need more details.

Thanks

Ganesh

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

The PSoC 6 MCU supports read operations on one area while programming/erasing in another area. This is implemented to support firmware upgrades and parallel tasks in the dual-core system. The application flash contains four RWW sectors, UFLASH0 to UFLASH3, each 256KB in size. The EE emulation and SFlash are additional RWW sectors apart from the main flash. The RWW feature is available between sectors – you can read/execute from one sector while there is an ongoing write/erase operation in another sector. However, when the code execution/read is in the last 16 bytes of a given sector (say sector 0) and the flash write/erase operation is in the next sector (sector 1), an RWW violation may occur if prefetch is enabled. This is because prefetch will fetch the next 16 bytes of data, which is part of sector 1 while a write operation is underway in the same sector. This will result in a fault and should be considered during firmware design. Firmware can be designed to place dead code in the last 16 bytes of every sector making sure the last 16 bytes of a sector are never accessed or can disable prefetch during a flash write/erase operation.


Best Regards,
Vasanth

0 Likes

That totally makes sense, but how can I guarantee that the flash sections I use will not overlap with application flash? Is there some way to find out where in flash my application will be stored?

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

This is taken care in the linker script. You can modify that according to your requirement. To store the data you can use the emulated EEprom area specified also. Or you can make sure that your targets are in different segments. The RWW feature is available between sectors – you can read/execute from one sector while there is an ongoing write/erase operation in another sector. However, when the code execution/read is in the last 16 bytes of a given sector (say sector 0) and the flash write/erase operation is in the next sector (sector 1), an RWW violation may occur if prefetch is enabled. This is because prefetch will fetch the next 16 bytes of data, which is part of sector 1 while a write operation is underway in the same sector. This will result in a fault and should be considered during firmware design. Firmware can be designed to place dead code in the last 16 bytes of every sector making sure the last 16 bytes of a sector are never accessed or can disable prefetch during a flash write/erase operation.

Best Regards,
Vasanth

0 Likes