I am trying to capture a PWM signal using the FTM module. I need to both read the counter value at each rising/falling edge and also read the level of the pin. The problem is the Capture module does not have a GetValue() method. If I trying to create a BitIO component, I get a pin conflict error. The option to "Enable Pin Sharing" is greyed out and can not be selected. Apparently there used to be an InputPin component in PE that did not allocate the pin and therefore did not result in a pin conflict, but this component is not available in the latest version of CW.
What can I do to workaround this issue aside from forgetting about PE and reading the GPIO register directly?
I am using the FRDM-KE06z board with Codewarrior Special Edition 10.6.
Hello Arman Samimi:
I think this is a hardware restriction rather than Processor Expert issue. Kinetis L and Kinetis K MCUs have a MUX option to change functionality at run time, so you can actually share the same pin between peripherals. For KE family when a peripheral is enabled, then the IO functionality is disabled, as stated in the KE06 Reference Manual:
As workaround you can define a different pin as input for the BitIO component and connect it to the Capture pin, so you can read the logic state.
About the InputPin component, I am not sure what component you are referring to.
I hope this helps you.
PS. Always post to dedicated community spaces such as Processor Expert Software, so your question gets more attention.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
Thank you for your reply. I was actually able to read the logic state directly by using the GPIOx_PDIR registers and everything worked as expected, so I do not agree that this is a hardware limitation. In my opinion, PE should allow using the BitIO component in combination with the Capture component.
Hello Arman Samimi:
You are right, sorry for my inaccurate response. Actually the statement I presented above means that the GPIO module loses control of the pin and the control is taken by the alternate peripheral, in this case the FTM, but you can still read the GPIOx_PDIR register.
The situation is similar to the next thread: Re: Read the pin value of a configured peripheral
As in that case, I think that having an extra component just to read the pin is not necessary, especially since each component generates code and its configuration structures need to be allocated, which consumes valuable memory.
However, thanks a lot for your feedback, let me pass it to the Processor Expert development team.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------