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.

Atomic operations in CC3200

Other Parts Discussed in Thread: CC3200

I was wondering which operations on the CC3200 are guaranteed to be atomic (i.e performed in single CPU instruction and hence can't get interrupt "in the middle").

For example, I need to share a global flag between an interrupt handler and other "regular" routines.

Is assignment of char variable (8-bit) atomic? What about int (32-bit)?

If not, is there another way to share such a flag?

Just to clarify - i'm working without RTOS, so there are no threads issues here, just interrupts.

  • Hello,

    Basically, you can use mutex to protect on critical sections.

    To your question regarding assignment, it really depends on the basic length of operation of the processor.

    With cc3200, it is 32 bits so every assignment of 32 bits should be atomic.

    If you read-modify-write, this is not atomic.

    For 64 bits operations or even 16/8 bits, atomic is not guarenteed.

    Regards

  • Hey Shlomi,

    Thank you very much for the speedy and informative reply.

    1. I'll use a pure 32-bit assignment to be safe.

    2. Is there a TI example of how to use mutexes on the CC3200?


    Tal

  • Hello,

    If you look at user.h file in the SDK, you would see locks and sync objects.

    The lock is a mutex. The host driver is using it when it sends a command to the device and unlock it only upon command complete.

    The name of the lock is GlobalLockObj. You can create your own similary.

    Regards,

    Shlomi