I am using S912ZVML12F1WKH for oil pump project. I want to know whether PTU trigger can modifer in every period to read ADC value?

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

I am using S912ZVML12F1WKH for oil pump project. I want to know whether PTU trigger can modifer in every period to read ADC value?

Jump to solution
714 Views
dannydeng
Contributor III

Dears,

I modify the trigger time in every PTU period to read ADC value, but I can not get TUG0 out value, and can not get ADC interrupt.

I want to know whether PTU trigger can modifyd in every period to read ADC value?

    Thanks...

Labels (1)
1 Solution
390 Views
RadekS
NXP Employee
NXP Employee

Hi Ray,

The PTU module consists of two trigger generators (TG0 for ADC0 and TG1 for ADC1). For each TG a separate enable bit is available, so that both TGs can be enabled independently.

The trigger generation of the PTU module is synchronized to the incoming reload event.

This reload event resets and restarts the internal time base counter and makes sure that the first trigger value from the actual trigger list is loaded.

Reload mechanism:

Each trigger generator uses two lists to load the trigger values from the memory. One list can be updated by the CPU while the other list is used to generate the trigger events. After enabling, the TG uses the lists in alternate order. When the update of alternate trigger list is done, the SW must set the PTULDOK bit. If the load OK bit is set at the time of reload event, the TG switches to the alternate list and loads the first trigger value from this trigger event list. The reload event clears the PTULDOK bit.

See Figure 14-24. TG0 Reload behavior with local PTULDOK in RM

So, typically we use two lists per trigger and code could anytime update only un-active list.

To reduce the used memory size, it is also possible to set TG0L0IDX equal to TG0L1IDX or to set TG1L0IDX equal to TG1L1IDX. In this case the trigger generator is using only one physical list of trigger events even if the trigger generator logic is switching between both pointers. The SW must make sure, that the CPU does not update the trigger list before the execution of the trigger list is done. The time window to update the trigger list starts at the trigger generator done interrupt flag (TGxDIF) and ends with the next reload event. Even if only one physical trigger event list is used the TGxLIST shows a swap between list 0 and 1 at every reload event with set PTULDOK bit.

This is case of MC9S12ZVML128_BLDC_Sensorless example code.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
391 Views
RadekS
NXP Employee
NXP Employee

Hi Ray,

The PTU module consists of two trigger generators (TG0 for ADC0 and TG1 for ADC1). For each TG a separate enable bit is available, so that both TGs can be enabled independently.

The trigger generation of the PTU module is synchronized to the incoming reload event.

This reload event resets and restarts the internal time base counter and makes sure that the first trigger value from the actual trigger list is loaded.

Reload mechanism:

Each trigger generator uses two lists to load the trigger values from the memory. One list can be updated by the CPU while the other list is used to generate the trigger events. After enabling, the TG uses the lists in alternate order. When the update of alternate trigger list is done, the SW must set the PTULDOK bit. If the load OK bit is set at the time of reload event, the TG switches to the alternate list and loads the first trigger value from this trigger event list. The reload event clears the PTULDOK bit.

See Figure 14-24. TG0 Reload behavior with local PTULDOK in RM

So, typically we use two lists per trigger and code could anytime update only un-active list.

To reduce the used memory size, it is also possible to set TG0L0IDX equal to TG0L1IDX or to set TG1L0IDX equal to TG1L1IDX. In this case the trigger generator is using only one physical list of trigger events even if the trigger generator logic is switching between both pointers. The SW must make sure, that the CPU does not update the trigger list before the execution of the trigger list is done. The time window to update the trigger list starts at the trigger generator done interrupt flag (TGxDIF) and ends with the next reload event. Even if only one physical trigger event list is used the TGxLIST shows a swap between list 0 and 1 at every reload event with set PTULDOK bit.

This is case of MC9S12ZVML128_BLDC_Sensorless example code.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------