FlexTimer0 - k20dx256 vll10 will not toggle on compare

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

FlexTimer0 - k20dx256 vll10 will not toggle on compare

Jump to solution
1,474 Views
Cdn_aye
Senior Contributor I

Hi

 

I have used Device Init to set up  FTM0_CH0 to do an input capture on ptc1 (alt4, pin 71) and to do an output compare on FTM0_CH2. When the counter compare triggers, the FTM0_CH2 (alt4, pin 73) was set in device init to toggle ptc3. This is code purely generated by the cw10.3 beta2 wizard (cw10.2 was tested and worked/failed the same way).

 

We put a signal in on ptc1 and FTM0 traps on the ISR for TOF, Edge Capture and Output compare IRQ's. So we know that the timer is working. But the output ptc3 never toggles. Even if we disconnect pt3 in device init, from the timer and try to do a bit banging port bit toggle using     GPIOC_PTOR |= (1<<3);

 

The port will not toggle.

 

If we generate a project without FTM0 and just with ptc3 as a device init component, then use GPIOC_PTOR |= (1<<3); the code will toggle the port bit.

 

Is there something fundamental I am missing? I thought we could use PTC1 and PTC3 in the alt4 configuration with FTM0. But it doesn't seem to work.

 

This is a custom board so we have to change to another port and pin if we have made a design error in choosing to toggle PTC3 with FTM0_CH2. Any suggestions would be appreciated.

 

Thanks

 

Robert

Original Attachment has been moved to: ftm0_ftm2-toggle-of-ptc3-not-working.zip

0 Kudos
Reply
1 Solution
1,048 Views
Cdn_aye
Senior Contributor I

Hi

The problem was the software control bit. When it is on, it overrides the toggle bit of the timer. Thank you for the help.

View solution in original post

0 Kudos
Reply
8 Replies
1,048 Views
vfilip
NXP Employee
NXP Employee

Hello,

could you please post here the demonstration project in order to analyze it?

best regards

Vojtech Filip

Processor Expert Support Team



0 Kudos
Reply
1,048 Views
Cdn_aye
Senior Contributor I

http://temp-zip.s3.amazonaws.com/PTC3_dev_init.zip?AWSAccessKeyId=1YRY3X8P49KQG5A3DG82&Expires=13497...

As I noted before, this component for the ftm0 does not have the auto toggle for ptc3. This on has a manual toggle. Neither works as long as the ftm0 component is in the project. We can toggle the bit if the ftm0 is disabled.

This is a download link of the file. I have posted the file, but I do not know how to attach a file to the reply or when the posts of the file I made even went. I published them but I don't know if you get a message. It would be a lot of help to have a help document or tutorial on how to use the new community forum, not on what it does, but how to do it. It is great but a time sink when you don't know how to do the simple things.

Regards

Robert

0 Kudos
Reply
1,048 Views
vfilip
NXP Employee
NXP Employee

Hello,

I was not able to see the output on PTC3 with your project. Could you please double check that you measure the requested pin and you have selected the correct CPU in PEx project? Did you checked the errata to your chip mask?

My code to see the PTC3 pin toggle:

for(;;) {

  counter++;

  GPIOC_PTOR |= 8;    //toggles pin 3

}

I was able to see the output of the FTM0_CH2 on PTC3 too. Please see the attached settings of Init_FTM component.

Regarding forum and attachments. I have reported this functionality as a forum issue. In meantime as workaround please use the following steps:

#1 Post your message without attachments.

#2 Edit the just posted message using Edit button:

pastedImage_36.png

#3 Now you should be able to add the attachments.

best regards

Vojtech Filip

Processor Expert Support Team

1,048 Views
Cdn_aye
Senior Contributor I

Hi,

Yes; this is exactly the problem and this is the reason for the SR. We cannot see the output either, no matter what we do.

We have measured this pin many, many, many times. Please read through the SR note I posted again; we cannot see an output if we have the flextimer assigned, we can see an output if we do not see the flextimer assigned. It does not matter which flextimer. If any flex timer is assigned we cannot see an output on ptc3.

I do not see anything on this in the errata I have… but maybe mine is out of date. Please send me the errata you are using and I will recheck.

Regards

Robert

0 Kudos
Reply
1,048 Views
vfilip
NXP Employee
NXP Employee

Hello,

there is probably misunderstanding. I am able to see the PTC3 toggle as GPIO and also as FTM2_CH0 output. I have also verified FTM2_CH0 in input capture mode in the end and it works on my side.

I have double-checked your project with GPIO toggle (PTC3_dev_init) and it works on my side. So please ignore the following sentence in previous response: I was not able to see the output on PTC3 with your project.

For now, could you please send me the project with FTM that does not work on your side in order to analyze it. You originally reported this as a issue but you did not send a project demonstrating this behavior.

Link to Errata:

https://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K20_100&fpsp=1&tab=Documentation_Tab

Just click on Errata in left menu. However I have not find any issue related to FlexTimer there.

best regards

Vojtech Filip


0 Kudos
Reply
1,048 Views
Cdn_aye
Senior Contributor I

I will add the example project using FTM0 for input capture on ptc1 with interrupt, output compare on FTM2 with interrupt, toggle set on output compare for FTM2 ptc3. The toggle does not work. If you turn off the toggle in DeviceInit for FTM2 and uncomment the code that manually toggles ptc3. The output will toggle. It would not do this before; when I started up the project I was asked to select the cpu. This had already been done. After I did this I could manually toggle ptc3. I think there might be an error in DevInit.

If you get this to work, would you be able to replicate the input on ptc1 on the output of ptc3 using ftm0 as the input capture, ftm2 for output compare please? The defaults are ok, any duty cycle. We just want to see the two timers tracking each other and the output working. Thank you,

0 Kudos
Reply
1,048 Views
vfilip
NXP Employee
NXP Employee

Hello,

please find my demonstration project of the Init_FTM component in the following configuration:

FTM0_CH2 - PTC3 output compare

FTM0_CH0 - PTC1 input capture on rising method

Generally I have not encountered any problem during project creation. I am able to see the ouput on PTC3, when I wire it into PTC1 input I receive periodical interrupt on channel 1. From my perspective the code in DI is OK. I have used CW V10.3 Beta2.

best regards

Vojtech Filip

Processor Expert Support Team


0 Kudos
Reply
1,049 Views
Cdn_aye
Senior Contributor I

Hi

The problem was the software control bit. When it is on, it overrides the toggle bit of the timer. Thank you for the help.

0 Kudos
Reply