question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No hardware PWM's on all GPIO

See original GitHub issue

Hi!

Just started with Pi4J 2.0 and I got an error.

2020-07-10 15:44:02 gpioHardwarePWM: bad gpio for PWM (3)
[http-nio-8080-exec-5] WARN com.pi4j.library.pigpio.impl.PiGpioNativeImpl - PIGPIO ERROR: PI_NOT_HPWM_GPIO; GPIO has no hardware PWM

And the Java code:

   // This will turn on/off the FQP30N06L MOSFET
  private Pwm createDigitalPWMOutput(int pinOutput, Context pi4j) {
      try {
          // use try-with-resources to auto-close I2C when complete
      	PwmConfig config = Pwm.newConfigBuilder(pi4j)
                  .id("my-pwm-pin")
                  .name("My Test PWM Pin")
                  .address(pinOutput)
                  .pwmType(PwmType.HARDWARE)
                  .frequency(pwmFrequency)   // optionally pre-configure the desired frequency to 1KHz
                  .dutyCycle(0)     // optionally pre-configure the desired duty-cycle (50%)
                  .shutdown(0)       // optionally pre-configure a shutdown duty-cycle value (on terminate)
                  .initial(0)     // optionally pre-configure an initial duty-cycle value (on startup)
                  .build();
      	Pwm pwm = pi4j.providers().get(PiGpioPwmProvider.class).create(config);
      	pwm.on();
  		return pwm;
  	} catch (Exception e) {
  		e.printStackTrace();
  	}
  	return null;
  }

I call that function with:

Context pi4j = Pi4J.newAutoContext();
Pwm pwm0 = createDigitalPWMOutput(3, pi4j);

That’s weird because Pigpio says that there are 0-31 hard ware PWM’s http://abyz.me.uk/rpi/pigpio/

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:42 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
savageautomatecommented, Jul 13, 2020

@DanielMartensson ,

Why did it not work for me?

Please try again. I have deployed the latest version (with the signal fix) to the Maven SNAPSHOT repository now.

You may want to first delete the directory and files on your local system where this JAR file could be cached to ensure the new version is picked up by Maven.

~/.m2/repository/com/pi4j/pi4j-library-pigpio/
2reactions
DanielMartenssoncommented, Jul 12, 2020

I’d like to get the known issues fixed and publicly available. Then we’ll see which of yours remain.

This will help. https://github.com/DanielMartensson/OpenSourceLogger

@savageautomate @FDelporte

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pigpio PWM - Raspberry Pi Forums
hardware timed PWM on all of GPIO 0-31. I need 3 GPIO's with precise PWM ... The error states pigpio.error: 'GPIO has no...
Read more >
Pulse Width Modulation for Dummies-Raspberry Pi GPIO ...
A hardware PWM pin is controlled by a channel. The PWM Clock, range, and pulse width are specified for a channel. All hardware...
Read more >
Writes average PWM voltage to a GPIO pin - MathWorks
The PWM uses a software implementation allowing all GPIO pins on the Raspberry ... This argument does not accept vectors because the hardware...
Read more >
23. API - Pins — GPIO Zero 1.6.2 Documentation
GPIO library installed, (assuming no environment variables are set), the default pin factory ... Supports all features including PWM (hardware via DMA).
Read more >
troubles with bcm2835 hardware PWM
And back to bcm2835 lib. Yes, its a very old lib, but it still updates. My interest in RPI GPIO programming not only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found