Using PWM with periphery library

I tried to use the PWM example and got the following error:

Traceback (most recent call last):
File “/root/mu_code/PMW_LEDtest.py”, line 4, in
pwm = PWM(0, 10)
File “/usr/local/lib/python3.8/dist-packages/periphery/pwm.py”, line 39, in init
self._open(chip, channel)
File “/usr/local/lib/python3.8/dist-packages/periphery/pwm.py”, line 60, in _open
raise LookupError(“Opening PWM: PWM chip {} not found.”.format(chip))
LookupError: Opening PWM: PWM chip 0 not found.

Does this mean that there is no PWM functionality implemented?

Yes, You can see https://wiki.seeedstudio.com/ODYSSEY-X86J4105-GPIO/, PWM is not available.

I recently wrote a software PWM library in python for the GPIO pins which uses the periphery library as a base. It works well and is very simple to use. I would be happy to comment the code, add examples of use and share on github if anyone is interested.

1 Like

I’m very interested in your PWM solution and would like to test it on my Odyssey x86. I would really appreciate if you can share your code.

As promised: https://github.com/Daedelus1982/GPIO_Odyssey
Let me know if you have any questions / comments.

1 Like

Thanks. I tested it briefly today with a led and it seems to work. I will do some more testing tomorrow and I’ll come back to you with my findings.

While I was testing your PWM solution I discovered that the pins connected to chip1 all give 3,3V except pin 11(?). All the other pins connected to chip0 en Chip2 only give 3,29V. I noticed this first with a LED connected to one of those pins (chip0 or chip2) was not as bright as when connected to a pin of chip1. Is this normal behaviour or is there something wrong with my board?

Sorry for the late reply. I was going to check the outputs yesturday but I seem to have mislaid my multimeter in my recent move. I checked the PWM signal with my rubbish handheld osciliscope at first, but this didnt give me good reading on the voltage output.
I am driving 12v motors with a motor controller in between the motors and the odyssey so the controller is not to fussy about the exact trigger volltage but I guess for some its more important?