I just noticed this when building my code today. I get this message in the Problems tab:
Warning: Direction cannot be applied if no pin is routed (Direction) MyProjectNameHere pin_mux/Direction Processor Expert Problem
I eventually found the issue, which is that in the pin_mux table, I do not have a pin routed for FTM CH0 and CH1. However, my project works with my encoder just fine. I then selected the corresponding pins in pin_mux, but now I get this error:
Selected value is in conflict with other configuration(s) property 'CH0 - Channel 0' from component pin_mux Exclusive connection required by ; Selected value is in conflict with other configuration property 'CH0 - Channel 0' from component pin_mux, conflict in configuration of MUX bit-field of PORTB_PCR18 register. (Pin) MyProjectNameHere ftm_2_qd_comp/Pin Processor Expert Problem
Is this a bug in PEx?
The pin_mux component provide configuration of pins for all devices of the target MCU. When you select just a direction of pin without any routing to a device it is not possible to set the direction. In addition, when you route a pin to a device, the device can provide setting of the direction (e.g. TxD pin of the UART is output).
The first warning is not a bug.
Please note, that the Collapsed View Mode (in the Component Inspector of the PinSetting component) displays routing of pins for every device separately. It also means that you can select one pin for two devices - this is a conflict because one pin can be routed to one device only. This case is reported as a error in the settings.
You can configure the routing by using the PinSettings component (pin_mux) or by another component (e.g. Init_FTM). When you select a pin of FTM CH0 in a Init_FTM the routing is visible in the PinSettings component too. This pin cannot be routed by any other device (e.g. GPIO).
See for example the following case that demonstrate the conflict of the settings (the error is reported correctly):
If you have a different problem, send me the details of the issue (how to reproduce the problem and the project if possible), please.
Thanks for your reply, Marek. It makes perfect sense that you shouldn't be able to route the pin for two different peripherals, hence the error. I think that the warning is a little misleading. For those that do not understand the problem, the warning would lead them to think that they need to route the pin, because the only option under Input is "Input" or "Output". It turns out that I just had to select "Input" and then hit Delete, followed by Enter, and then it would change to "No pin routed". There isn't a user-selectable option for "No pin routed", unfortunately.
You are right that this functionality is not clear. There is Enable Automatic command (in the context menu of the item) that remove the selected value.
I have checked this command but it seems that there is bug - this command is not available for the Direction when no pin/signal is routed. I have already reported this issue to the responsible development team.
You can use the following workaround to remove selected direction:
When the warning is reported (Direction cannot be applied if no pin is routed), select the Pin/Signal:
Open the context menu of the Direction item (by clicking of the right button of the mouse into the item) and select the Enable Automatic command:
The selection of the Direction is removed.
Open the context menu of the Pin/Signal Selection item and select the Enable Automatic command too:
The routing of the pin is removed.