I tried to test the FTM functionality on GoldBox.
Attempt to generate the cycle flip signal through FTM_0, then capture the rising edge of the FTM_0 generated signal through FTM_1 and count.(The FTM_0 moduleused as the time base.)
Set channel 0 of FTM_0 as output mode, and PinActivate is TogglePin.
Set channel 1 of FTM1 as the input capture mode.\
However, after I completed the setup and started the program according to the steps in section 43.5.30.1 of the S32RM manual, FTM0 and FTM1 did not start to run, and CNT was always 0.
Attached is the program I wrote.
Could you tell me where my problem is.
Whether the initialization process is incorrect, or the GTB setup step is incorrect.
Hi,
How are you verifying that the project is working without GTB? Also, which RTD version are you using?
The Icu example requires an external connection to be able to start counting, do you have this external connection?
If you would like for your project to be reviewed, we recommend opening a ticket under the NXP online services.
Please, let us know.
A1:
The above GTB project is based on the S32DS Icu and Ocu example project modification. The modification includes the following two parts:
When I ran the program without part b, FTM_0 and FTM_1 worked, and CNT counted correctly.
A2:
A3:
Sorry, I don't understand.
Does external connection mean that FTM needs to use an external clock as the clock source (i.e. SC[CLKS] = External clock)?
Hi,
Thanks for your feedback.
Seeing the image you have shared, once you are setting GTBEOUT, you are doing it in a different manner to what we are custom to. You are doing an inverse AND with a GTBEOUT mask, is this mask the inverse of setting 1 to GTBEOUT?
Why are you not setting the flag with the OR operation? As follows:
Ftm_Ocu_Ip_gapcxBase[0]->CONF |= (FTM_CONF_GTBEOUT_MASK);
If you are using the provided masks by the RTD, you are setting to 0 the GTBEOUT bit, which does not start the GTB feature.
Also, as per your question "Whether there can exist both Icu and Ocu channels in the same FTM.", we are seeing the following when we configure both Icu and Ocu under the same module:
#error "FTM_1 instance cannot be used by ICU. Instance locked by another driver!"
For which, it seems that the drivers do not let this mixture under the same module. We do apologize.
Please, let us know.
Thanks for your feedback.
I modified my program according to your method, and the two FTMS started normally.
I also changed the location of the FTM clock initialization operation. As follows:
But new problems arise.
Does this mean that the two FTMs are not started at the same time, that is, the GTB function is not set successfully?
Attached is the revised completed project.
Did I miss any operations?
Thanks for your help.
Hi,
For the image that you are sharing, you are enabling GTB (line 153) prior to finishing the configuration of the FTM modules.
As said in the Reference Manual [Page 2243, S32G2 Reference Manual, Rev. 7, February 2023]:
"To initiate the GTB feature in the configuration described in the preceding figure, write 1 to CONF[GTBEOUT] in the FTM module used as the time base."
Since you are configuring the GTB and then modifying the source clock, the enablement of GTB is not as the Reference Manual describes.
Also, are you enabling both the Icu and Ocu modules for debugging? For what we see, the example for Ocu does not set the counter to stop under debugging.
Please, let us know.