Hi,
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
LPTMR0_CSR = ( LPTMR_CSR_TEN_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TCF_MASK );
/**** STEP #2 ****/
// Store CSR register in dummy_var to serialize the clearing of the TCF flag
dummy_var = LPTMR0_CSR;
}
But,
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.
Thankyou!