AnsweredAssumed Answered

Data Serialization

Question asked by DSPIC MIC on Aug 31, 2017
Latest reply on Sep 13, 2017 by Daniel Martynek


I am working on data serialization with S32K142/144 micro controller . I am using this  controller for CAN specific applications. And in which i realized "data serialization " should restrictively followed .

So,i have gone thorough alot-off  posts and documentations.

after all i have still one doubt , as for any peripheral resister access , we should follow "read after write".

As in below example, during accessing of LPTMR0_CSR.


void lptmr_isr(void)


  // Declare dummy variable to store the read of the LPTMR0_CSR register

volatile int dummy_var

/****   STEP #1  ****/

  // Clear the flag; enable interrupts; enable the timer


  /****  STEP #2  ****/

   // Store CSR register in dummy_var to serialize the clearing of the TCF flag

  dummy_var = LPTMR0_CSR;



1. can we use just memory barrier instruction __asm("dsb"); in place of "dummy_var = LPTMR0_CSR;" instruction ?

2. Is could you please give few example of real time use of  __asm("dmb"); __asm("dsb"); __asm("isb"); .


Please help me on this.