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.

TMS570LC4357-EP: eCAP CAPx reading during pending write

Part Number: TMS570LC4357-EP

Hello,

In datasheet I can't find any information about eCap CAPx register reading procedure. For that reason I'm wondering if there is any (even minimal) risk to read garbage value when reading eCap CAPx register? For example when reading during hw value update. Or can we assume that those operations are atomic and reading always return correct old/new value?

Thank you for help,
Regards,
Sebastian

  • Hello Sebastian,

    I think there might be a possibility of race condition as there is no synchronization between the incoming signal & CPU ISR. But if you want to read just the latest CAPy value in every amount of time (for example 1 second), then One-shot mode of ECAP could be useful instead of continuous capture mode.

    In continuous capture mode, the CAPy will be updated by the new captured time-stamp. In eCAP ISR, it's better to read the CAP1 first, then CAP2,..

  • Hello QJ Wang,

    Thank you for your reply. In my application overwriting old value by new one will be fine. My question is more like if we have thrid state of register value between old and new one during register value update. Like for example half of new and half of old or some oder garbage? Or reading this register will always return proper value (new or old).

    Regards,
    Sebastian Sokolowski

  • Hello Sebastian,

    This kind of race condition should be avoided. I will check this for you.

  • You can enable the interrupt of the last capture event, and read the captured ecap values in the ecap ISR. The ecap registers are updated when the event interrupt is generated.