I want to experiment with PWM pure signals (signals generated by a dedicated hardware, without any jitter caused by the running software).
I tried to generate this signal on a RPi4B board on GPIO12.
I already changed config.txt:I tried with sys/class:
but I can't see any signal coming from GPIO12, even with an oscilloscope.
I tired with RPi.GPIO:
It works, I can see the PWM signal coming from GPIO12. However I suspect this library doesn't use fully-hardware PWM generation. I can see jitter and the frequency and duty-cucle set don't match the values measured by the oscilloscope.
Any suggestion?
I tried to generate this signal on a RPi4B board on GPIO12.
I already changed config.txt:
Code:
dtparam=audio=offdtoverlay=pwm,pin=12,func=4
Code:
user@raspberrypi:/sys/class/pwm/pwmchip0 $ sudo echo 0 > exportuser@raspberrypi:/sys/class/pwm/pwmchip0 $ sudo echo 1000000 > pwm0/perioduser@raspberrypi:/sys/class/pwm/pwmchip0 $ sudo echo 500000 > pwm0/duty_cycleuser@raspberrypi:/sys/class/pwm/pwmchip0 $ sudo echo 1 > pwm0/enable
I tired with RPi.GPIO:
Code:
import RPi.GPIO as GPIOpin = 12GPIO.setmode(GPIO.BCM) # Utilizzare la numerazione BCMGPIO.setup(pin, GPIO.OUT) # Configura il pin GPIO12 come output PWMfrequency = 500 # Imposta la frequenza del PWM (in Hz)pwm = GPIO.PWM(pin, frequency) # Crea un'istanza PWM sul pin con la frequenza specificatapwm.start(led_brightness) # Avvia il PWM
Any suggestion?
Statistics: Posted by pozz — Fri Jul 26, 2024 4:00 pm