Can't get PWM to work

Hi,

Cannot get the PWM to work (both in C++ and Python). Is there way to debug the PWM drivers.

Python error:

Traceback (most recent call last):
  File "Servo.py", line 13, in <module>
    with navio.pwm.PWM(PWM_OUTPUT) as pwm:
  File "/home/pi/third_party/Navio2/Python/navio/pwm.py", line 15, in __enter__
    self.initialize()
  File "/home/pi/third_party/Navio2/Python/navio/pwm.py", line 34, in initialize
    pwm_export.write(str(self.channel))
IOError: [Errno 5] Input/output error

C++ Error:
Can't init channel 0

Thanks in advance.

Hi @pkot,

Are you running the scripts that we provide as examples? Did you supply power to the servo rail?

Hi @liudmila.slepova , yes using the provided example scripts. and powered the servo railing.

Hi @pkot,

I see! Do other examples also fail to run?

Hi @liudmila.slepova, Looks like only RCInput and RCOutput examples are not working (tried both with and without powering the servo-rail); other examples are working fine.

Hi @pkot,

Just to make sure: are you running those examples with sudo? Do you work with the latest image?

I’ll try to run those myself to test it.

Hi @liudmila.slepova,

Yes, running in sudo and on the last image (emlid-raspbian-20200922.img.xz) from here.

After some debugging (tested it on a different RPi and it works), it’s the Raspberry Pi that’s the problem and not the Navio2 hat. I reflashed the image and tested it to no avail.

Do you know what could be an issue on the RPi that makes the servo rail not work?

Thanks

Edit: Using Raspberry pi 4

Hi @pkot,

Sorry for the delayed response! I’m glad you’ve found the source of the issue.

I’m not sure but maybe because of the loose connection between Navio2 and the RPi board.