Jetson Nano 2GB PWM synchronized outputs - how to start two PWM outputs at the exact same time

Dear NVIDIA,

My use-case is needing to drive two differential DC motors on a mobile robot where the motor drivers are controlled via PWM where the motor speed is adjusted by a 0…+5v input signal (using level-shifters on the GPIO header).

On my Nano 2GB I have PWM-0 and PWM-2 available to use and I wish to control them via a kernel driver that will write directly to the PWM Controller registers (ie: PWM_CONTROLLER_PWM_CSR__0) :

root@elroy:~/dev/pwm# 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 ((null) ): period: 0 ns duty: 0 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
root@elroy:~/dev/pwm#

The problem is, how can I start both PWM’s in a synchronized way so that they both fire-off at exactly the same time? I can achieve this on the Raspberry Pi BCM2835 which has a register that has bits that can be OR’d together to enable multiple PWM outputs, simultaneously.

Is there something like this available on the Tegra X1 ?

Alternatively, should I perhaps try this method, or something similar? :-

  1. Enable the SWR_PWM_RST (set to 1) on CLK_RST_CONTROLLER_RST_DEVICES_L_SET_0 to reset / “stop” the PWM’s.
  2. Disable the SET_CLK_ENB_PWM (set to 0) on CLK_RST_CONTROLLER_CLK_ENB_L_SET_0 to “stop” the PWM clocks.
  3. configure and ENABLE PWM-0 and PWM-2 via PWM_CONTROLLER_PWM_CSR_0_0 and PWM_CONTROLLER_PWM_CSR_2_0 registers
  4. Clear the CLR_CLK_ENB_PWM (set to 1) on CLK_RST_CONTROLLER_CLK_ENB_L_CLR_0 to “start” the PWM clocks.
  5. Clear the CLR_PWM_RST (set to 1) on CLK_RST_CONTROLLER_RST_DEV_L_CLR_0 to start / “enable” the PWM’s

Would this be a way that I could get PWM-0 and PWM-2 to start simultaneously (synchronized) and would this be best-practice?

Thanks very much!
Cheers,
Rodney

Sorry for the late response, is this still an issue to support? Thanks

Hello kayccc,

Yes, it is still open - I would like to know of a method that I can use to get multiple PWMs all starting simultaneously.

Could you please look into this?

Thanks very much!
Cheers,
Rodney

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

hello Rodney.G.Davies,

had you tried the steps you’ve mentioned? do you see the deviation of two PWMs?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.