I have connected the Rapsberry Pi to a Stepper driver which controls a stepper motor. Recently I observed step losses on the motor every second or two. This is only noticable at higher RPM (>500 Hz PWM). With a scope I can see that the raspberry pi skips rectangle pulses (see screenshot). Are these glitches normal or is my raspbbery pi broken? Any Ideas if a misconfiguration of the pi can lead to this phenomena?

I used following code to produce the pwm in the screenshot:
Code: Select all
import RPi.GPIO as GPIO
import sys # exit program
import time
import signal
GPIO.setmode(GPIO.BCM)
pin_step = 18
GPIO.setup(pin_step, GPIO.OUT)
pwm = GPIO.PWM(pin_step, 1)
pwm.start(10.0)
freq = 1000
pwm.ChangeFrequency(freq)
def signalHandlerSIGINT(signal, frame):
pwm.stop()
GPIO.cleanup()
sys.exit(0)
signal.signal(signal.SIGINT, signalHandlerSIGINT)
while True:
time.sleep(10)
