How can I AB-SWAP in S32K312 used Cyclone Pro and Image Creation Util ?

By Suhyun S. : Apr 20, 2025 at 08:01 PM (20:01 hours)
Staff: Johnny N. : 9 comments

Hello.

I want to use a single image to program both partitions A and B.
Is it possible to do this using Cyclone Pro (or FX) and the Image Creation Utility?

NXP provides guidance on how to do this, as shown below.

"
Write value 0x00000051 (that the ID of HSE_SRV_ID_ACTIVATE_PASSIVE_BLOCK service) somewhere to non-cacheable (this is important because Messaging Unit does not see cached data) SRAM memory (not DTCM).
And then write address of this value to Messaging Unit MU0, TR1 register.
That's all. If you receive response 0x55A5AA33 (that's HSE_SRV_RSP_OK) in RR1 register, the operation was successful.
"
https://community.nxp.com/t5/S32K/s32k3-flash-swap-requirements/m-p/1920123/highlight/true#M38475


Is there a way to configure it using the Image Creation Utility according to that method?

BRs,
Suhyun

[Original post deleted]

See answer from Juan below.

Hello Johnny.

I tested using the method you provided, but the partition swap did not occur.
I executed the QO and PM commands twice, but the program was written only to one partition.
The program is written only to the 0x400000 address, and the second partition at 0x500000 is blank.
The script I used is as follows:


; Automatically generated configuration file
; Silicon Manufacturer is Generic
; Silicon Architecture is ARM devices
; Do not modify the comments above this line if using Cyclone Image Creation Utility
:RESETDELAY 0
:ARCHTYPE 1
:DEVICE NXP_S32K3xx_S32K312
:USESWD 1
:DEBUGFREQUENCY 5560
:SAPGUIVERSION 392E3538
:KEEPPOWERON 1
:IMGOPTIONS {"pesettings":{"create_image_settings":{"image_settings_version":946,"allow_overlay_data_to_overwrite_image_data":false}}}
:NEWIMAGE
:DESCRIBEIMAGE BJ1_AB_SWAP
CM nxp_s32k312_1x32x456k_hse_enabled.arp
CQ ;Clear Queue
QO fbl_v202.sre
EN ;Erase If Not Blank
PM ;Program Module
VM ;Verify Module
CM nxp_s32k312_1x32x424k_ab_swap.arp
CQ ;Clear Queue
QO fbl_v202.sre
EN ;Erase If Not Blank
PM ;Program Module
VM ;Verify Module


The S32K312 has ACTIVE and PASSIVE partitions.
Initially, I want to program the ACTIVE partition using the first QO command,
then perform a partition swap, and afterward, program the newly swapped ACTIVE partition using the second QO command.

Could you review and help me identify what the issue might be?

BRs
Suhyun

Hi Suhyun,


You can program both the active and passive region in one single sequence as long as your .sre has data in both regions. In other words, your fbl_v202.sre must have data starting at address 0x00400000(active) and at address 0x00500000(passive).

Once your fbl_v202.sre has data for both regions, you can use the sequence below to program both:

CM nxp_s32k312_1x32x424k_ab_swap.arp
CQ ;Clear Queue
QO fbl_v202.sre ;Contains data for both active and passive
EN ;Erase If Not Blank
PM ;Program Module
VM ;Verify Module

Dear Juan S.

The fbl_v202.sre file contains data only for the ACTIVE partition (0x400000~0x4FFFFF).

Is there any way to implement the operation mentioned by NXP through Image Creation?
Perhaps by modifying the ARP file or through another method?

"
Write value 0x00000051 (that the ID of HSE_SRV_ID_ACTIVATE_PASSIVE_BLOCK service) somewhere to non-cacheable (this is important because Messaging Unit does not see cached data) SRAM memory (not DTCM).
And then write address of this value to Messaging Unit MU0, TR1 register. That's all.
If you receive response 0x55A5AA33 (that's HSE_SRV_RSP_OK) in RR1 register, the operation was successful.
"

BRs,
Suhyun

Hi Suhyun,

If we can provide you with a method to program both the active and passive flash regions, do you still need to perform the AB swap?

Dear Juan S.

The fbl_v202.sre file must contain only the data for the active partition (0x400000--0x4FFFFF). (This is a mandatory requirement.)
If it's possible to program both the active and passive partitions without modifying the SRE file, then an A/B swap is not necessary.

BRs,
Suhyun

Suhyun,

We can create a new algorithm for you that programs both partitions. Please submit an algorithm request with a link to this forum post and I will assign it to the algorithm team.

https://www.pemicro.com/SRS/create_SR_flashAlgRequest.cfm

Regards,

Dear Johnny N.

I made support ticket. (#34601)
Please check it.

BRs,
Suhyun