What pins can be used for PWM control except 33 in samples

ok, I will try it later.

Please wait a few days…

thanks.
devemin

Hello.

I am sorry that I still didnt’t try this yet.

I was very busy to hacking this robot for $200 with UART command servo x25 pieces.
https://www.youtube.com/watch?v=waNGZWo4Rtg

https://twitter.com/search?q=%23プリメイドAI&src=typed_query

By the way, is there anyone else who tried PWM ? (Anyone or nVidia’s engineer ?)

Anyone can get PWM pulse ?

I decided to use STM32 microcomputer’s PWM instead of Jetson Nano’s function.

Jackchen said

I gave up this too.

If it becomes easier to use Jetson Nano’s PWM, I will try it.

thanks for this forum.
devemin

I was able to enable & use PWM using direct register access (See Tegra X1 Technical Reference Manual for details https://developer.nvidia.com/embedded/downloads#?search=Tegra%20X1):

# (All commands as root, use sudo if needed)
# Enable Pin 32 / PWM0
busybox devmem 0x700031fc 32 0x45
busybox devmem 0x6000d504 32 0x2

# Enable Pin 33 / PWM2
busybox devmem 0x70003248 32 0x46
busybox devmem 0x6000d100 32 0x00

# Then enable & control the pwm, e.g.
cd /sys/devices/7000a000.pwm/pwm/pwmchip0
echo 0 > export  # Control PWM0 on Pin 32
cd pwm0
echo 20000000 > period
echo 1500000 > duty_cycle
echo 1 > enable
2 Likes

Thanks!!!

Wow!!!

Mr. ashtuchkin, You are very cool !

Your help is the most useful in the world.

I tried it with “sudo su” and logic analyzer, then I can get the PWM pulse !
(on jetson-nano-sd-r32.2.1 image, default settings. )

Very thanks!
devemin
2019-09-24.png

THANK YOUUUUU!!!
What are the units for the Period and the duty cycle that you are setting?

It’s nanoseconds.

Be aware that PWMs on Jetson only have 8 bit duty cycle precision and the period is a 13 bit divider from 187.5kHz, so the actual values will be approximate.

but i got an error, why?
root@dlinano-desktop:/home/dlinano# busybox devmem 0x700031fc 32 0x45
root@dlinano-desktop:/home/dlinano# busybox devmem 0x6000d504 32 0x2
root@dlinano-desktop:/home/dlinano# busybox devmem 0x70003248 32 0x46
root@dlinano-desktop:/home/dlinano# busybox devmem 0x6000d100 32 0x00
root@dlinano-desktop:/home/dlinano# cd /sys/devices/7000a000.pwm/pwm/pwmchip0
root@dlinano-desktop:/sys/devices/7000a000.pwm/pwm/pwmchip0# echo 0 > export
bash: echo: write error: Device or resource busy

Maybe the device is already opened somewhere else? I don’t know, I’m not an expert.

I was using this command to understand the current state of the devices:

sudo cat /sys/kernel/debug/pwm

ashtuchkin,thank you very much, you are right, the PWM0 is already opened as lightbar when the nano is booting.

dlinano@dlinano-desktop:~$ sudo cat /sys/kernel/debug/pwm
[sudo] password for dlinano:
platform/70110000.pwm, 1 PWM device
pwm-0 (pwm-regulator ): requested enabled period: 2500 ns duty: 0 ns polarity: normal

platform/7000a000.pwm, 4 PWM devices
pwm-0 (lightbar ): requested enabled period: 10000000 ns duty: 10000000 ns polarity: normal
pwm-1 (pwm-regulator ): requested period: 8000 ns duty: 1440 ns polarity: normal
pwm-2 ((null) ): period: 0 ns duty: 0 ns polarity: normal
pwm-3 (pwm-fan ): requested enabled period: 45334 ns duty: 0 ns polarity: normal

i want to use pwm0 in my way, like the pwm2, how can i do?

I don’t know what lightbar is. You probably need to research what that is and close it’s connection to pwm0.

Is there no one who actually got pwm running using ‘Jetson Nano Developer Kit 40-Pin Expansion Header Configuration’? I tried it myself and couldn’t get it working.

Enabling pwm directly in the memory as ashtuchkin said works but is not really satisfying in the long run.

I’ve also read in different posts that the spreadsheet currently generates faulty dtsi files. Any info from the nvidia developers whether it’s possible to enable pwm using the spreadsheet at the moment?

Thanks ashtuchkin for guide. when i try, pin 33 worked good, but Pin 32 error:

write error: Device or resource busy

and when check state of PWM:

root@jetbot:/sys/devices/7000a000.pwm/pwm/pwmchip0# sudo cat /sys/kernel/debug/pwm
platform/70110000.pwm, 1 PWM device
 pwm-0   (pwm-regulator       ): requested enabled period: 2500 ns duty: 0 ns polarity: normal

platform/7000a000.pwm, 4 PWM devices
 pwm-0   (lightbar            ): requested enabled period: 10000000 ns duty: 10000000 ns polarity: normal
 pwm-1   (pwm-regulator       ): requested enabled period: 8000 ns duty: 1440 ns polarity: normal
 pwm-2   (sysfs               ): requested enabled period: 1000000 ns duty: 0 ns polarity: normal
 pwm-3   (pwm-fan             ): requested enabled period: 45334 ns duty: 0 ns polarity: normal

Please help me!!!

1 Like

Thank you very much!