Problems using the PWM on Jetson AGX Xavier

I’m trying to use the PWM in AGX xavier, but it didn’t work.

L4T version : 32.4.4

i checked my board’s PWM & pinmux

/sys/kernel/debug# ll /sys/class/pwm/pwmchip*
/sys/class/pwm/pwmchip0 -> ../../devices/3280000.pwm/pwm/pwmchip0/		-> PWM1
/sys/class/pwm/pwmchip1 -> ../../devices/c340000.pwm/pwm/pwmchip1/
/sys/class/pwm/pwmchip2 -> ../../devices/32c0000.pwm/pwm/pwmchip2/		-> PWM5
/sys/class/pwm/pwmchip3 -> ../../devices/32f0000.pwm/pwm/pwmchip3/		-> PWM8
/sys/class/pwm/pwmchip4 -> ../../devices/39c0000.tachometer/pwm/pwmchip4/

/sys/kernel/debug# cat tegra_pinctrl_reg
Bank: 0 Reg: 0x02440020 Val: 0x00000054 -> soc_gpio54_pn1	->PWM1 #pin15 in 40pin header
Bank: 0 Reg: 0x02434090 Val: 0x00000054 -> soc_gpio12_ph0	->PWM5 #pin18 in 40pin header
Bank: 0 Reg: 0x02430040 Val: 0x00000056 -> soc_gpio44_pr0	->PWM8 #pin13 in 40pin header

pins for pwm are set to gpio in default.
i changed pinmux like this

$ vi jetson-xavier.conf
source "${LDK_DIR}/p2972-0000.conf.common";

$ vi bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg
pinmux.0x02434090 = 0x00000406; 
pinmux.0x02440020 = 0x00000404; 
pinmux.0x02430040 = 0x00000404;

$ sudo ./ -k MB1_BCT jetson-xavier mmcblk0p1

after flashing, i checked tegra_pinctrl_reg, those value updated successfully.
and i tried like this.

$ cd /sys/class/pwm/pwmchip0   #PWM8, pin 13
$ echo 0 > export
$ cd pwm0
$ echo 20000 > period
$ echo 10000 > duty_cycle
$ echo 1 > enable

I tried all of 3 pins like that, but there weren’t any output signal at those pins.

Please advise me what is wrong.

and another question:

I’m trying update pinmux setting like that,
but if I update package in unbuntu on Xavier (apt upgrade command)
after that, pinmux roll back to default value.
and after that, pinmux setting can not updated like those way.
(sudo ./ -k MB1_BCT jetson-xavier mmcblk0p1 command)

if i try flash, it was printed “success” in the shell, but checked xavier’s “tegra_pinctrl_reg” file, it didn’t update.

the only way to update, it needs hole flashing. but, this way make back to default filesystem.
so, if i try to change pinmux, i can’t update ubuntu package on Xavier.

how can i update pinmux after ubuntu package on Xavier updated?

hello dhkwak,

you should perform a whole flash to update the pinmux of board configuration file.

hello JerryChang
Thanks for your answer.
but, i know that way. i hope to know the way how to change after ubuntu on Xavier updated.
I think Xavier’s ubuntu does not update MB1 block in mmc, so updated kerenl, dtbs or something make this situation.

and 1st question, pinmux for pwm, could i get any advice?

hello dhkwak,

you may refer to eLinux page for reference,

hello JerryChang

lt’s late i had other issue. and PWM works now. thanks.
but i’m finding the way pinmux without whole flashing…

hello dhkwak,

that’s board configuration file, you should perform a whole flash to update it.