PWM0 on Jetson nano Rel-32.5 not working

Hello,

I’m trying to enable PWM0 (LCD_BL_PWM) on Jetson Nano Devkit. I’ve set the pinmux for it to:
lcd_bl_pwm_pv0 {
nvidia,pins = “lcd_bl_pwm_pv0”;
nvidia,function = “pwm0”;
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_DISABLE>;
};
in file tegra210-batuu-pinmux-p3448-0003.dtsi.
After I uploaded the dtb file, I tried to export it and use it from command line:
cd /sys/class/pwm/pwmchip0
echo 0 > export
cd pwm0
echo 5000000 > period
echo 5000000 > duty_cycle
echo 1 > enable
There was no change on the oscilloscope.
Additional debugging information:
root@jetson-nano-2gb-devkit:/sys/kernel/debug/pinctrl/700008d4.pinmux# cat pinmux-pins | grep pwm
pin 39 (PE7): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function pwm3 group pe7
pin 168 (LCD_BL_PWM PV0): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function pwm0 group lcd_bl_pwm_pv0
pin 172 (LCD_GPIO2 PV4): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function pwm1 group lcd_gpio2_pv4
pin 217 (DVFS_PWM PBB1): 700008d4.pinmux (GPIO UNCLAIMED) (HOG) function cldvfs group dvfs_pwm_pbb1
I tried similar procedure for pwm3 (pwm reserverd for fan), and it worked fine after I disabled the driver that was using it.
Both pins have the same pinmux settings (aside from name and function, of course), but one works fine, the other doesn’t.

All help is welcome.

Thanks in advance,
Nikola

Hi,

What is your method to update the dtb file?

I’m using the following setup:

  • I added the path to the device tree in the extlinux.conf (FDT /boot/tegra-xyz.dtb)
  • I just replace the /boot/tegra-xyz.dtb every time when I need to enable/disable some peripheral
    This setup is proven to work, as I added several I2C and SPI peripherals, as well as GPIO keyboard, LEDs, etc.

Please check the gpio register

GPIO_CNF_0 ->0x6000D500

Could you give me some clue in how to check it from command line?

sudo busybox devmem 0x6000D500

it reads: 0x00000000

Sorry, wrong register. Are you able to read 0x6000D540 ?

yes, same result, 0x00000000

Just to double confirm…

If you export this lcd_bl_pwm_pv0 as gpio in your sysyfs (/sys/class/gpio/) and toggle it will you see the register dump give different result?

root@jetson-nano-2gb-devkit:/sys/class/gpio# echo 168 > export
root@jetson-nano-2gb-devkit:/sys/class/gpio# cd gpio168
root@jetson-nano-2gb-devkit:/sys/class/gpio/gpio168# echo out > direction
root@jetson-nano-2gb-devkit:/sys/class/gpio/gpio168# echo 1 > value
root@jetson-nano-2gb-devkit:/sys/class/gpio/gpio168# devmem 0x6000D540
0x00000000
But the output is visibly different (i.e. the LED is now on)

Just to clarify, if it is important, I’m using Jetson Nano 2gb devkit.

0x6000D504 could you check if this one able to have dump result on your side?

0x00000003 when I dump 0x6000D504

Could you reboot the device and dump it again? Just to prevent our GPIO configuration in sysfs affects the result.

after reboot:
root@jetson-nano-2gb-devkit:~# devmem 0x6000D504
0x00000003

Could you write bit 0 of this register to 0 and see if your PWM can work?

How can I do that from the command line?

You mean write the register or configure the PWM?

Write the register; PWM is already configured via DT.