S32K3 Find the Currently Executing core ID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K3 Find the Currently Executing core ID

Jump to solution
2,141 Views
jonnyWHIS
Contributor III

Hi there,

I have a function that i'd like to behave slightly differently depending on which S32K3 core invokes it. At the moment i have a function returning the value of what i thought was the correct register.

In the S32K3xx RM, under MCM Register Descriptions (Chapter 6.4.1) it mentions a Processor Identifier (PID) register. However if i read the value of this register, it returns 0 regardless of which core the read is performed on.

I'm assuming that this is not the correct register, but i cannot find a more relevant one in the manual. Could you advise :

- if it is possible to find the currently executing core ID, and if so

- what register/driver function is required to do this

 

I have both cores running no problem, but maybe there's something more i need to do in the .mex file?

Any help would be appreciated.

0 Kudos
Reply
1 Solution
2,117 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @jonnyWHIS 

The name of the PID register is wrong, I will ask to update it. It should be called Process Identifier, not Processor Identifier. The description of the bits is then correct. It says:
"Process Identifier
Identifies the CPU process."

It can't be used to identify which core is running a code.

For this purpose, you can use register CPXNUM in MCM at address 0x40260004.

It's used in startup files, for example. You can find code like this in startup code:

/* If this is the primary core, initialize data and bss */
ldr r0, =0x40260004
ldr r1,[r0]

ldr r0, =MAIN_CORE
cmp r1,r0
beq _INIT_DATA_BSS

Regards,
Lukas

View solution in original post

0 Kudos
Reply
2 Replies
2,118 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @jonnyWHIS 

The name of the PID register is wrong, I will ask to update it. It should be called Process Identifier, not Processor Identifier. The description of the bits is then correct. It says:
"Process Identifier
Identifies the CPU process."

It can't be used to identify which core is running a code.

For this purpose, you can use register CPXNUM in MCM at address 0x40260004.

It's used in startup files, for example. You can find code like this in startup code:

/* If this is the primary core, initialize data and bss */
ldr r0, =0x40260004
ldr r1,[r0]

ldr r0, =MAIN_CORE
cmp r1,r0
beq _INIT_DATA_BSS

Regards,
Lukas

0 Kudos
Reply
2,089 Views
jonnyWHIS
Contributor III

Hi Lukas, brill thank you, using that CPXNUM register has worked for me.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1944389%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K3%20Find%20the%20Currently%20Executing%20core%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1944389%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20there%2C%3C%2FP%3E%3CP%3EI%20have%20a%20function%20that%20i'd%20like%20to%20behave%20slightly%20differently%20depending%20on%20which%20S32K3%20core%20invokes%20it.%20At%20the%20moment%20i%20have%20a%20function%20returning%20the%20value%20of%20what%20i%20thought%20was%20the%20correct%20register.%3C%2FP%3E%3CP%3EIn%20the%20S32K3xx%20RM%2C%20under%20MCM%20Register%20Descriptions%20(Chapter%206.4.1)%20it%20mentions%20a%20%3CSTRONG%3EProcessor%20Identifier%20(PID)%3C%2FSTRONG%3E%26nbsp%3Bregister.%20However%20if%20i%20read%20the%20value%20of%20this%20register%2C%20it%20returns%200%20regardless%20of%20which%20core%20the%20read%20is%20performed%20on.%3C%2FP%3E%3CP%3EI'm%20assuming%20that%20this%20is%20not%20the%20correct%20register%2C%20but%20i%20cannot%20find%20a%20more%20relevant%20one%20in%20the%20manual.%20Could%20you%20advise%20%3A%3C%2FP%3E%3CP%3E-%20if%20it%20is%20possible%20to%20find%20the%20currently%20executing%20core%20ID%2C%20and%20if%20so%3C%2FP%3E%3CP%3E-%20what%20register%2Fdriver%20function%20is%20required%20to%20do%20this%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20have%20both%20cores%20running%20no%20problem%2C%20but%20maybe%20there's%20something%20more%20i%20need%20to%20do%20in%20the%20.mex%20file%3F%3C%2FP%3E%3CP%3EAny%20help%20would%20be%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1945313%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K3%20Find%20the%20Currently%20Executing%20core%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1945313%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Lukas%2C%20brill%20thank%20you%2C%20using%20that%20CPXNUM%20register%20has%20worked%20for%20me.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1944541%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K3%20Find%20the%20Currently%20Executing%20core%20ID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1944541%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213014%22%20target%3D%22_blank%22%3E%40jonnyWHIS%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20name%20of%20the%20PID%20register%20is%20wrong%2C%20I%20will%20ask%20to%20update%20it.%20It%20should%20be%20called%20Process%20Identifier%2C%20not%20Processor%20Identifier.%20The%20description%20of%20the%20bits%20is%20then%20correct.%20It%20says%3A%20%3CBR%20%2F%3E%22Process%20Identifier%3CBR%20%2F%3EIdentifies%20the%20CPU%20process.%22%3C%2FP%3E%0A%3CP%3EIt%20can't%20be%20used%20to%20identify%20which%20core%20is%20running%20a%20code.%3C%2FP%3E%0A%3CP%3EFor%20this%20purpose%2C%20you%20can%20use%20register%20CPXNUM%20in%20MCM%20at%20address%200x40260004.%3C%2FP%3E%0A%3CP%3EIt's%20used%20in%20startup%20files%2C%20for%20example.%20You%20can%20find%20code%20like%20this%20in%20startup%20code%3A%3C%2FP%3E%0A%3CP%3E%2F*%20If%20this%20is%20the%20primary%20core%2C%20initialize%20data%20and%20bss%20*%2F%3CBR%20%2F%3Eldr%20r0%2C%20%3D0x40260004%3CBR%20%2F%3Eldr%20r1%2C%5Br0%5D%3C%2FP%3E%0A%3CP%3Eldr%20r0%2C%20%3DMAIN_CORE%3CBR%20%2F%3Ecmp%20r1%2Cr0%3CBR%20%2F%3Ebeq%20_INIT_DATA_BSS%3C%2FP%3E%0A%3CP%3ERegards%2C%3CBR%20%2F%3ELukas%3C%2FP%3E%3C%2FLINGO-BODY%3E