nerves-project / nerves_system_rpi4

Base Nerves system configuration for the Raspberry Pi 4
Apache License 2.0
91 stars 49 forks source link

Enable PWM #254

Open clupprich opened 1 month ago

clupprich commented 1 month ago

I'm working on a little home automation project and wanted to use RPi4's PWM pins to control a led driver.

With the current system the /sys/class/pwm directory wasn't present, so I googled a bit and found https://elixirforum.com/t/rpi4-hardware-pwm-dtoverlay-need-kernel-module/33264. I think I made the right modifications, it's working for me right now.

fhunleth commented 1 month ago

@clupprich Sorry for the delays!!! I figured that I'd work through some major updates to all Nerves systems first and then get to this. It's taking longer than expected. Suffice it to say, I think your changes are fine, but I'm not sure about enabling unconditionally. Anyone using the PWM pin as a normal GPIO will see their code break. However, maybe we just comment out enabling the pwm dtoverlay in the config.txt with a note. Your other changes will majorly safe the next person time.

Anyway, just wanted to let you know that I hadn't forgotten about this. Once I get the big changes (Erlang, Buildroot, GCC, etc. updates in), I'll get to pushing this PR across the finish line and getting a release out. Thanks for submitting it!

clupprich commented 1 month ago

@fhunleth No worries at all!

Anyone using the PWM pin as a normal GPIO will see their code break.

Oh, yeah, I didn't think about that (I'm very new to the embedded world). I can update my PR with your suggested changes.

Thanks for maintaining this ecosystem - it's great fun to explore it!