I’m in trouble with Jetson Nano and hope you can help me.
I need to use the board with a camera (Flir Duo Pro R), which accepts 3.3-5V PWM signal at 50Hz as commands.
Before Jetson (during pinmux configuration), I tested my scripts with a Raspberry 3B+, so I’m comparing the two boards.
Due to strange feedback by Jetson I decided to use a common arduino servomotor to test the signal and here the situation where I am:
SERVOMOTOR
Raspberry successfully generates right pwm signal
Jetson successfully generates right pwm signal
CAMERA
Raspberry successfully generates right pwm signal and camera receives commands
Camera does not receive commands, I don’t know anything about signal
This is very strange situation and I don’t know how to solve.
I’m powering the board via USB for this test, so I thought it could be voltage/current issue, but PWM is low voltage signal.
Hi, did you probe the PWM signal to camera with oscilloscope? Or you can just probe the signal without any external device. It is important to observe if any difference between the output signals of Raspberry and Jetson.
RASPBERRY
No problems: oscilloscope shows the right signal.
JETSON
Only troubles. In particular Voltage is around 225mV (very low), and freq in not 50Hz (as I set).
The signal is affected by strong noise I think.
I tried other DCs, other freqs, DCs change (as trigger, that I need).
Anytime the same: Raspberry works fine, Jetson doesn’t.
I don’t know how to solve this situation, and if I’m wrong.
Hope someone can help me
# cd /sys/class/pwm/pwmchip0
# echo 0 > export
# cd pwm0
# echo 20000 > period (20us is the total time period of the pulse)
# echo 10000 > duty_cycle (50% duty cycle)
# echo 1 > enable
I read something about sysfs to control pwm and I used exactly your example.
Unfortunately the result is the same: low voltage, random freq and unrecognizable signal.
I’m not sure but I think it means pwm-0 (on pin 32) is correctly set.
(I don’t clearly know the difference between platform/70110000.pwm and platform/7000a000.pwm, maybe different elements? J41 and another, I think).
In this long period I made some tests.
I’m so sorry to tell you that my oscilloscope is untrustworthy (I used it for other purposes but results are not right), and I can’t have new one due to Covid-19 emercency.
I used sysfs in Jetson (always pin32) as you suggested and I note that:
SERVOMOTOR responds correctly (pwm signal successfully generated)
CAMERA does not respond
What I can point out is that Servomotor is 3-wired (Vcc, GND and signal) and Camera is 2-wired (GND, signal).
So, I think Jetson pin does not generate enough voltage for camera expectation (3.3-5V), in the other case Servomotor receives 5V voltage-level. Could be this?
If it is, Jetson does not work as it should, because logic-level of pinout should be 3.3V (like Raspberry). This also explains why I can manage pwm to camera with Raspberry.
Hi, the pin 32 is 3.3v output. There is a 1.8v to 3.3v level shift between pin 32 and Tegra chip pin. There is request of pin output on level shift: Do not recommend having the external pullup or pulldown resistors. If mandatory, it is recommended the value should be larger than 50 kΩ.
You can check the datasheet of camera to see if there is such pu/pd as requested.
There is no mention of pullup or pulldown in camera datasheet/manual (Flir Duo Pro R). I’m contacting producer to make certain about this, but I’m quite sure there isn’t any resistor.
Any other solutions?
It is a strange behaviour. If you need more details for helping me, please let me know.
I used jetson-io.py to configure pinmux, and I have both 32 and 33 PWM pins.
The strange thing is that I’m able to change position of common 5V 3-wires servomotor using 32 PWM pin: I think the voltage it receives is not up to 5V (low speed rotations and not always successful), but I can see its positioning according to what I set (with both python and sysfs). I just thought something to do with 3rd wire (5V), but It is my supposition.
Really don’t know why and how to solve this strange behaviour.
Hi Jacopo,
Can you read the register 0x700031fc after selecting PWM in jetson-io?
Also, please try PWM signals by writing 0x05 to register 0x700031fc.
First share, what is the value in register 0x700031fc.
Then try with 0x05 value.
Voltage always up to around 1V, but sometimes a waveform appears (no freq). The second waveform you can see is a singular one of those I want to generate (10% of 20ms period), but wrong voltage. This is an half good news I think.
Hi Jacopo,
Image you shared is not getting loaded.
So, are you saying with value 0x5 also, there is no improvement in PWM signals?
Also, to save your debugging time, you do not need to run jetson-io to enable PWM (just for debugging), you can directly write value 0x1 into register 0x700031fc.
Can you also check PWM signals by writing 0x9 value in above register, see if the signals improved?
Thank you again and sorry for image uploading (strange because I can see it). Anyway I edited previous post (image re-uploaded) and new result will be uploaded here.
I paid more attention to your instructions and I tried all steps here-reported:
~/Desktop/pwmtest$ sudo devmem2 0x700031fc b
/dev/mem opened.
Memory mapped at address 0x7fa64a1000.
Value at address 0x700031FC (0x7fa64a11fc): 0x1
~/Desktop/pwmtest$ python simple.py
running
^C
~/Desktop/pwmtest$ sudo devmem2 0x700031fc b 0x05
/dev/mem opened.
Memory mapped at address 0x7fac4fb000.
Value at address 0x700031FC (0x7fac4fb1fc): 0x1
Written 0x5; readback 0x5
~/Desktop/pwmtest$ sudo devmem2 0x700031fc b
/dev/mem opened.
Memory mapped at address 0x7fb7192000.
Value at address 0x700031FC (0x7fb71921fc): 0x5
~/Desktop/pwmtest$ python simple.py
running
^C
~/Desktop/pwmtest$ sudo devmem2 0x700031fc b 0x09
/dev/mem opened.
Memory mapped at address 0x7f929b7000.
Value at address 0x700031FC (0x7f929b71fc): 0x5
Written 0x9; readback 0x9
~/Desktop/pwmtest$ sudo devmem2 0x700031fc b
/dev/mem opened.
Memory mapped at address 0x7f93249000.
Value at address 0x700031FC (0x7f932491fc): 0x9
wesiijet@wesiijet-sbc:~/Desktop/pwmtest$ python simple.py
running
^C
I used python script reported in previous post, which gets same results of sysfs:
beginning voltage is rightly 0V, but when I try to generate PWM, voltage is stable at around 1V (no 3.3V) and “random” waveforms go to 0V (the opposite I want) as you can see in picture;
when script is interrupted, not always voltage returns to 0V, but I can read 1V;
there are no frequency and no duty-cycle, but sometimes I can recognize waveform I want. In picture I can recognize 4 intervals of 20ms: first it starts HIGH and after 2ms goes LOW, then HIGH for all 20ms, then third waveform same as first one, and the fourth is exactly what I want (2ms HIGH in 20ms period). I reported this case, but last waveform doesn’t always appear and most of time voltage remains stable at around 1V.
I’m pretty confident that if voltage was stable at 0V at default, this problem could be fixed (only UP to 3.3V left).
I’m not able to solve this problem, so I hope you can help me.
I have to say that I’m using Jetson with other (no-PWM) peripherals and all is good, I’m in trouble only with PWM since the beginning. Also softwares configurations work well.