这是本文档旧的修订版!
编码器DTS探究
背景:ST的PLC参考设计板对应的设备树源码位于:https://github.com/peyoot/ccmp25_dt/blob/scarthgap/ccmp25-plc.dts ,编码器设备树的部分只是按早期官方文档的一个示例修改,需要进一步修改并验证其可用性。 官方文档可能有更新,LPTIM见:https://wiki.st.com/stm32mpu/wiki/LPTIM_device_tree_configuration#On_STM32MP2_series ,而 TIM DEVICE见https://wiki.st.com/stm32mpu/wiki/TIM_device_tree_configuration#On_STM32MP2_series
当前的设计,以counter_DI_1_2为例
&timers1 { status = "okay"; /* USER CODE BEGIN timers1 */ /delete-property/dmas; /delete-property/dma-names; /* USER CODE END timers1 */ counter_DI_1_2 { /* remove pwm10,pwm11 and add this */ pinctrl-names = "default", "sleep"; pinctrl-0 = <&ccmp25_timers1_ch3_4_pins>; pinctrl-1 = <&ccmp25_timers1_ch3_4_sleep_pins>; status = "okay"; }; 和 <code> ccmp25_timers1_ch3_4_pins: ccmp25-timers1-ch3_4 { pins { pinmux = <STM32_PINMUX('D', 9, AF8)>, /* TIM1_CH3_PWM */ <STM32_PINMUX('D', 8, AF8)>; /* TIM1_CH4_PWM */ bias-disable; }; }; ccmp25_timers1_ch3_4_sleep_pins: ccmp25-timers1-ch3_4_sleep { pins { pinmux = <STM32_PINMUX('D', 9, ANALOG)>, /* TIM1_CH3_PWM */ <STM32_PINMUX('D', 8, ANALOG)>; /* TIM1_CH4_PWM */ }; };
</code>