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.

TMS320F28379D: Update of register ETSEL on ePWM module

Part Number: TMS320F28379D

Hello experts,

in my application I have to run the time-base submodule in up-down-count mode.
At the time points 1, 2, 1, 2, ... (see picture) the interrupt routine MyInterrupt() should be triggered.


The event for interrupt at time point 1:
Time-base counter equal to compare B register (CMPB_1) when the timer is incrementing.

The event for interrupt at time point 2:
Time-base counter equal to compare B register (CMPB_2) if the timer is decrementing.

Because I can only set one event as interrut source in the event trigger submodule, I have the following in mind to trigger the interrupts in the time points 1 and 2.

At time 1, at the beginning of the interrupt routine MyInterrupt():
Counter-Compare B shadow register = CMPB_2
ETSEL[INTSELCMP] = 0
ETSEL[INTSEL] = 111

At time 2, at the beginning of the interrupt routine MyInterrupt():
Counter-Compare B shadow register = CMPB_1
ETSEL[INTSELCMP] = 0
ETSEL[INTSEL] = 110

The loading of Counter-Compare B register from its shadow register ist done when Time-Base counter is equal to zero or period (TBCTR = 0x00 || TBCTR = TBPRD).There must be no problem here.
My question is about updating register ETSEL. Is it possible to update this register "on the fly" as I have described above. Can there be problems or unpredictable behavior here?

 Thank you in advance for your reply - Bui