Usage of Xgate Semaphore with s12x

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

Usage of Xgate Semaphore with s12x

521 Views
subashr
Contributor III

I am sharing variables between Xgate and s12x and so trying to use the Xgate semaphore to prevent any possible overlapping data access to the shared variables. But I could able to set and clear the semaphore from s12x, but in Xgate am not getting the intended response.

 

Semaphore setting in Xgate:

if ( _ssem ( 0 ) )

{

....

....

_csem ( 0 ) ;

}

 

 

Semaphore setting in S12x:

do

{

_XGSEM . Word = 0x0100 | 0x01 ;

}

while ( ! ( _XGSEM . Bits . XGSEM_grp & 0x01 ) ) ; ( comes out of this while loop till _ssem/ -csem is called in Xgate and then code is stuck here till wdt resets)

.....

.....

_XGSEM . Word = 0x0100 ;

 

On watching the XGSEM register in debugger, I could see semaphore '0' getting set and reset by the s12x, and then it is always '0'. After the ssem/csem code, the s12x is not able to set the semaphore. Could you please let me know what I am missing.

Labels (1)
Tags (3)
0 Kudos
1 Reply

268 Views
lama
NXP TechSupport
NXP TechSupport

Today, I provided an extended answer for a question related to an XGATE. The answer provides answer also to you:

Data sharing between S12x and Xgate

Best regards,

Ladislav

0 Kudos