Git Product home page Git Product logo

Comments (13)

maruel avatar maruel commented on May 5, 2024 2

Just a note that pi-blaster plays with the same CPU registers and the state modification is not bound by process lifetime. Sometimes resetting the state requires really cutting the power.

That said the implementation is still known to be buggy but should have worked. Will double check in the next days.

from periph.

maruel avatar maruel commented on May 5, 2024 1

That's some gorgeous success :)

oscilloscope

from periph.

simokawa avatar simokawa commented on May 5, 2024 1

Nice ;-)

I did more tests and find out we need to clear unnecessary ctl bits otherwise GPIO12 did not work after reboot.

I removed debug outputs and made a pull request.

from periph.

maruel avatar maruel commented on May 5, 2024

Did it print an error message? To work, you have to run it as root. Also I never tested having both loaded, as pi-blaster will also try to setup the PWM clock source.

There's also known bugs that the clock is not canceled correctly yet; https://periph.io/x/periph/host/bcm283x#pkg-note-bug

from periph.

mikegleasonjr avatar mikegleasonjr commented on May 5, 2024

Hi !

  • No error messages (err == nil)
  • I noticed that pi-blaster and my own code can conflict, I tried both separately after clean reboots. Whenever I started pi-blaster, I started it as not deamon (-D) so that I could stop it.

I am using the latest Stretch (end of november) with a clean install.

from periph.

simokawa avatar simokawa commented on May 5, 2024

I also found current hardware PWM does not work. I found a few problems.

  1. PWM address map is broken. For example, pwmMemory.rng1 is offset by 4 bytes, we need a padding before it.
  2. Current configuration of dat1 looks strange.
    I will send a pull request for 1.

I am using Pi B+.
Thanks,

from periph.

mikegleasonjr avatar mikegleasonjr commented on May 5, 2024

Still not working with a clean power-cycle and #169 merged

from periph.

maruel avatar maruel commented on May 5, 2024

Thanks for the report. Next window I have available to investigate at the earliest is tomorrow evening. Will report once I double checked what I messed up.

from periph.

simokawa avatar simokawa commented on May 5, 2024

Please try my pwm2 branch
https://github.com/simokawa/periph/tree/pwm2
or the patch
simokawa@9d5eacd

It also modifies rng/dat settings + verbose debugging and worked for me.

from periph.

maruel avatar maruel commented on May 5, 2024

Thanks! Will try to look at it tonight.

from periph.

mikegleasonjr avatar mikegleasonjr commented on May 5, 2024

@maruel @simokawa I can confirm it is working on the pwm2 branch:

package main

import (
	"os"
	"os/signal"
	"time"

	"periph.io/x/periph"
	"periph.io/x/periph/conn/gpio"
	"periph.io/x/periph/host/rpi"
)

func main() {
	periph.Init()
	p := rpi.P1_12 // GPIO18
	pwm := p.(gpio.PinPWM)

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)

	t := time.NewTicker(100 * time.Millisecond)
	defer t.Stop()

	i := gpio.Duty(0)
	step := gpio.Duty(2000)
	for {
		select {
		case <-c:
			return
		case <-t.C:
			pwm.PWM(i, 100*time.Microsecond)
			i += step
			if i > gpio.DutyMax || i < 0 {
				step = -step
				i += step
			}
		}
	}
}

from periph.

maruel avatar maruel commented on May 5, 2024

Ok finally had time to confirm on the oscilloscope it works great, can you clean up the branch in preparation for merging?

from periph.

mikegleasonjr avatar mikegleasonjr commented on May 5, 2024

thanks guys!

from periph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.