leon

leon

Rpi4 hardware pwm dtoverlay need kernel module?

Hi all!

Really loving the Nerves system :slight_smile: I am trying to get hardware PWM working on Nerves on a RPI4. I had this working on Raspbian before. For Nerves, I was able to customize things to get the dtoverlay added in /boot/config.txt and having the pwm.dtbo file copied into /boot/overlays as well - these by using the custom fwup.conf etc.

But after this I still don’t have a /sys/class/pwm present in my sysfs.

I tried adding dtdebug=1 to config.txt too, but that didn’t give me more info in dmesg.

So I am now thinking that I’m missing the appropriate kernel module, thinking I need to have the pwm-bcm2835.ko which is not present in kernel/drivers.

I also checked the linux-4.19.defconfig and nerves_defconfig in the nerves_system_rpi4 repo and could not find any mention of CONFIG_PWM_BCM2835.

Does this mean I will have to clone the nerves_system_rpi4 repo, make my own changes and have the kernel recompiled in order to get this kernel module ?

Did someone else try to make this work earlier ?

Hoping to get some more info before I go down this rabbithole only to find out there’s an easier way :slight_smile:

Thanks,

Leon

First 2 of 2 Posts! Switch mode

fhunleth

fhunleth

Co-author of Nerves

Hi Leon,

The current answer for adding that option is yes, you’ll need to clone nerves_system_rpi4 and make a custom system. We’re aware that this is a lot of work for making a one line kernel configuration change.

Having said that, I think that it’s an oversight that the hardware PWM kernel module isn’t being built in the official RPi4 Nerves system. While our systems aim to be minimal, for the Raspberry Pi ones, we have been trying to error on the side of including the basics for attaching hardware devices. If you would like to send a PR to the repository that enables it, that would be appreciated.

There’s also some history on PWM support on the Raspberry Pi. Since the Pi has so few hardware PWM pins, most people (myself included) had either used an I2C->PWM module or used pigpio’s DMA controller-based PWM support. pigpio is included in the default Nerves systems for Raspberry Pi specifically for PWM support. If you go the I2C->PWM module route, there are quite a few options. Pololu, Adafruit, and Sparkfun all have modules for them and sometimes have servo connectors if that’s why you’re interested in PWM.

Hope this helps!

leon

leon

Hi Frank,

Thanks for your response. I now have a custom nerves_system_rpi4 built and am currently experimenting with it. I cannot go the i2c route and have to use the hardware pwm as this is targeted to work with an existing daughterboard on the rpi4. I’ll create a PR for the nerves_system_rpi4 as soon as it works.

I never heard of the pigpio dma solution, right now I’m getting a 10khz frequency (from what I remember) on the hardware pwm pin 18 (gpio 12) which is working nice for led dimming. I’ll experiment with pigpio later too, thanks for the tip.

Regards,

Leon

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement