This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

280x atomic access to 32-Bit CPU Timers 0/1/2

If I use an instruction that performs a 32 bit read of one of the TIMERxTIM registers, is this access guaranteed to be atomic with respect to counter rollover?  In other words, is there any chance that the upper and lower words of the read data will be inconsistent.  I'm using a 28015.

thanks,

galen

 

  • Galen Seitz said:

    If I use an instruction that performs a 32 bit read of one of the TIMERxTIM registers, is this access guaranteed to be atomic with respect to counter rollover?  In other words, is there any chance that the upper and lower words of the read data will be inconsistent.  I'm using a 28015.

    thanks,

    galen

    If you perform a 32-bit access to a volatile variable then the access will not be broken up into two 16-bit accesses.  You can double check that this is happening by looking at the disassembly in code composer studio. 

    -Lori

     

  • Sorry I wasn't more clear.  This really wasn't a compiler question.  I just want to confirm that a movl from a TIMERxTIM register cannot be corrupted due to counter rollover.

    thanks,

    galen


  • Galen Seitz said:
    This really wasn't a compiler question.  I just want to confirm that a movl from a TIMERxTIM register cannot be corrupted due to counter rollover.

    Yes, the MOVL will perform a single 32-bit read so you will get the timer value (all bits) at that instance.

    Regards,

    Lori