2358869_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2358869_en-US

2358869_en-US

how to use FLEXPWM on IMXRT1170 using Zephyr?

Hi all,

I am planning to use Zephyr with IMXRT1176 and use the FLEXPWM to generate PWM signal output.
I have read through some of the previous post regard FLEXPWM and XBAR. Needing to init the XBARA for routing FLEXPWM to output for the bare metal codes.

Now I am wondering, how does this work in Zephyr? What do I need to define in the device tree? Do I still simply define the FLEXPWM group and the build system handle the XBARA configuration?

From my understanding, zephyr uses generic API to set output for PWM, but with such hardware dependencies in the IMXRT117X MCU, how does this work? Manual setup?

Is there any example or notes to help clarify on this area?

Re: how to use FLEXPWM on IMXRT1170 using Zephyr?

Hi @TomC818 ,

Thanks for your interest in NXP MIMXRT series!

In Zephyr, if the selected pin is a normal FLEXPWM alternate function, you only need to enable the corresponding FLEXPWM submodule in devicetree and provide the correct pinctrl. Zephyr’s MCUX PWM driver will apply pinctrl and configure the FLEXPWM through the generic PWM API. The MIMXRT1170 EVK already has such an example using flexpwm1_pwm2 and GPIO_AD_04 as FLEXPWM1_PWM2_A.
However, if your design requires routing a FLEXPWM signal through XBARA to an XBAR output pin, the current Zephyr PWM driver does not automatically configure XBARA for PWM. You need to manually configure XBARA in board/application initialization using MCUX SDK APIs, or add a small custom driver/init function to consume an xbar-maps property. Zephyr has an nxp,mcux-xbar binding and some drivers, such as QDEC, use it, but the PWM driver itself does not currently consume xbar-maps.

Please refer to the following two key drivers:
1. https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/pwm/pwm_mcux.c
2. https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/sensor/nxp/qdec_mcux/qdec_mcux.c

Best regards,
Gavin

Re: how to use FLEXPWM on IMXRT1170 using Zephyr?

Could you expand on this answer further? The only in-tree use of `xbar-maps` seems to be in /zephyr/samples/sensor/qdec/boards/mimxrt1050_evk_mimxrt1052_hyperflash.overlay


Would this be something like using the numerical values of 

kXBARA1_InputFlexpwm1Pwm0OutTrig0 -> kXBARA1_OutputFlexpwm1Pwm0Exta ?

タグ(1)
評価なし
バージョン履歴
最終更新日:
2 週間前
更新者: