etpu_set4 pwmmac clarification

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

etpu_set4 pwmmac clarification

560 Views
jyothsna_rajan
Contributor III

Hi, In the etpu-set4 pwmmac sample application half-cycle reload option is specified. Where can I find more details of when cycle reload is typically used?

Is there an application note that demonstrates how to invoke and use the pwmmac functions?

Refer the attached etpuc_pwmmac.c, the specific section shown below:   

       //====== begin excerpt

      else if ( (m2 == 1) && (flag0 == 1) )
       {
           .....
           // set channelX half-cycle reload flag
           tmp_half_reload_flag__master_chan = 0x800000 + GetCurrentChanNum()
           ......
            goto PWMMAC_RELOAD;
       }

       //=============== end excerpt

The param 'tmp_half_reload_flag__master_chan' appears to be a flag but is manipulated using channel number.  What is rationale behind this?

Thank you for taking time to clarify.

Best, JR

0 Kudos
2 Replies

537 Views
johndiener
Contributor IV

Just adding a couple of notes to David's excellent info:
- tmp_half_reload_flag__master_chan is used to retain the master channel number in order to channel context switch in PWMMACReloadPhase(), and then restore proper channel context at return time. It also passes a flag indicating reload or half reload cycle into the routine.
- as mentioned, this is an alias of register B... if modifying C code that uses register aliasing it is recommended to take special care and carefully analyze and test the results of any changes.

John Diener

544 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

The function is described in the following appnote:

https://www.nxp.com/docs/en/application-note/AN2969.pdf

Mentioned feature is described in section 3.4.

 

Half cycle update has faster response, on the other hand it’ll have higher etpu load i.e. performance limits.

Regarding source code - it seems mentioned flag tmp_half_reload_flag__master_chan (it is alias for register B) has an effect on channel switching.

 

Are you going to modify or re-use eTPU source code?

0 Kudos