0

PWMOut ValueError using stepper motor on Crickit
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PWMOut ValueError using stepper motor on Crickit

by AtomicPenguin on Mon Jan 14, 2019 7:15 pm

I am trying to run the Uni-polar Stepper motor demo using the Drive port of the Cricket (with a CPX). I believe the wiring is correct.
When I run (Save) the code, I get the first print statement ("Uni-Polar Stepper motor demo!"), and then nothing happens but I get the following error message in the Serial Monitor (I have inserted a debug print just BEFORE the assignment of the stepper_motor variable.)

------------------------------
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Uni-Polar Stepper motor demo!
Just BEFORE assignment of stepper_motor variable
Traceback (most recent call last):
File "code.py", line 9, in <module>
File "adafruit_crickit.py", line 252, in drive_stepper_motor
File "adafruit_crickit.py", line 262, in _motor
File "adafruit_motor/stepper.py", line 82, in __init__
ValueError: PWMOut: 'frequency' must be at least 1500
----------------------------

It appears that the code is barfing on the "stepper_motor = crickit.drive_stepper_motor" statement. The code never gets to the "INTERSTEP_DELAY = 0.02" statement.

I am pretty sure I have updated the CPX and the Cricket firmware.

Any ideas out there?

AtomicPenguin
 
Posts: 14
Joined: Fri May 16, 2014 5:54 pm

Re: PWMOut ValueError using stepper motor on Crickit

by adafruit_support_mike on Wed Jan 16, 2019 3:36 am

Could you post a link to the tutorial you're using, or the Github link to the library please?

adafruit_support_mike
 
Posts: 57106
Joined: Thu Feb 11, 2010 2:51 pm

Re: PWMOut ValueError using stepper motor on Crickit

by AtomicPenguin on Wed Jan 16, 2019 11:39 am

Yes -

Here is the tutorial I am trying to follow: https://learn.adafruit.com/adafruit-cri ... n-steppers

Specifically, I am trying the "Uni-Polar Only Drive Port" example, which uses the crickit.drive_stepper_motor object.

I have updated the latest "Crickit seesaw Firmware" from here: https://github.com/adafruit/seesaw/releases/tag/1.1.4

with the seesaw-crickit.uf2 file. (I note with interest that this refers to a PWM fix.)

Anyway, I also know that the stepper motor is good, because I can run it off an Arduino (full rotation is about 512 steps).

Thanks for your help,

Gary

AtomicPenguin
 
Posts: 14
Joined: Fri May 16, 2014 5:54 pm

Re: PWMOut ValueError using stepper motor on Crickit

by adafruit_support_mike on Thu Jan 17, 2019 3:47 am

Thank you. I'll check with the folks who handle the Crickit and CircuitPython code to see what's causing the error.

adafruit_support_mike
 
Posts: 57106
Joined: Thu Feb 11, 2010 2:51 pm

Re: PWMOut ValueError using stepper motor on Crickit

by colinbotts on Thu Jan 31, 2019 12:52 pm

Similar problems here. I can't get the stepper motor tutorial examples to run, either on the Motor port or the Drive port.

Here's what I get from the serial monitor for the Motor port example:

Bi-Polar or Uni-Polar Stepper motor demo!
Traceback (most recent call last):
File "code.py", line 8, in <module>
File "adafruit_crickit.py", line 247, in stepper_motor
File "adafruit_crickit.py", line 262, in _motor
File "adafruit_motor/stepper.py", line 82, in __init__
ValueError: PWMOut: 'frequency' must be at least 1500

And for the Drive port example:

Uni-Polar Stepper motor demo!
Traceback (most recent call last):
File "code.py", line 8, in <module>
File "adafruit_crickit.py", line 252, in drive_stepper_motor
File "adafruit_crickit.py", line 262, in _motor
File "adafruit_motor/stepper.py", line 82, in __init__
ValueError: PWMOut: 'frequency' must be at least 1500


I have to be honest, I'm getting fairly disappointed by the Crickit. I already posted the other day about it crashing using Makecode (with CPX), and now I'm running into problems with Python. Hopefully these issues can be worked out soon.

colinbotts
 
Posts: 7
Joined: Sun Jan 27, 2019 5:33 pm

Re: PWMOut ValueError using stepper motor on Crickit

by AtomicPenguin on Sun Feb 03, 2019 1:09 pm

Collinbotts: Yes, as a long time, loyal Adafruit cu$tomer, I too hope that the girls and boys at Adafruit will help us out here!

AtomicPenguin
 
Posts: 14
Joined: Fri May 16, 2014 5:54 pm

Re: PWMOut ValueError using stepper motor on Crickit

by adafruit_support_mike on Mon Feb 04, 2019 5:23 am

The folks who handle the code are working on resolving the values. I'll check to see where they are in the process.

adafruit_support_mike
 
Posts: 57106
Joined: Thu Feb 11, 2010 2:51 pm

Re: PWMOut ValueError using stepper motor on Crickit

by asafmatan on Wed Feb 20, 2019 8:52 pm

Also encounter the same issue on both 'Drive' and 'Motor' outputs. Actually Stepper motor is the main reason I bought the Pi Crickit hat. pls help in advising what can be the cause of this issue.
I was able to make it work breakpointing here and setting 1500 freq to ain1 ani2 bin1 bin2 objects (btw it works only for drive port with the motor I tried)
76 def __init__(self, ain1, ain2, bin1, bin2, *, microsteps=16):
77 self._coil = (ain2, bin1, ain1, bin2)
78
79 # reject unsafe (low) pwm freq
80 import ipdb;ipdb.set_trace() <-------
81 for i in range(4):
82 if self._coil[i].frequency < 1500:
83 raise ValueError("PWMOut: 'frequency' must be at least 1500")

asafmatan
 
Posts: 14
Joined: Wed May 18, 2016 10:53 am

Re: PWMOut ValueError using stepper motor on Crickit

by johngale on Sun Feb 24, 2019 6:11 pm

Same issue. Maybe this:

@property
def stepper_motor(self):
"""``adafruit_motor.motor.StepperMotor`` object on Motor 1 and Motor 2 terminals"""
return self._motor(_MOTOR_STEPPER, StepperMotor)

in adafruit_crickit.py

should explicitly set frequency to 1500Hz, instead of leaving it on whatever default it is.

johngale
 
Posts: 8
Joined: Mon Jan 26, 2015 6:37 pm

Re: PWMOut ValueError using stepper motor on Crickit

by 1Adriano on Mon Mar 11, 2019 12:56 pm

Was this issue ever resolved? I recently purchased the crickit and i'm having the same issue.

1Adriano
 
Posts: 4
Joined: Mon Mar 11, 2019 12:54 pm

Re: PWMOut ValueError using stepper motor on Crickit

by adafruit2 on Thu Mar 14, 2019 4:11 pm

hiya sorry this totally slipped thru my ToDo list

The MakeCode crickit issues should be fixed in the latest /beta - they had to completely rewrite the underlying layers (exciting) so please retry it (use adafruit.makecode.com/beta to get the 1.3.x version)

For circuitpython, we reverted a breaking commit here
https://github.com/adafruit/Adafruit_Ci ... /issues/15
we haven't released it yet - will do after we test

adafruit2
Site Admin
 
Posts: 18327
Joined: Fri Mar 11, 2005 7:36 pm

Re: PWMOut ValueError using stepper motor on Crickit

by adafruit2 on Thu Mar 14, 2019 10:34 pm

ok tested - try 1.4.1 of the circuitpython *motor* library (not the crickit library)
https://github.com/adafruit/Adafruit_Ci ... r/releases

adafruit2
Site Admin
 
Posts: 18327
Joined: Fri Mar 11, 2005 7:36 pm

Re: PWMOut ValueError using stepper motor on Crickit

by dsheeran on Sun Mar 17, 2019 5:44 pm

I tried the fix and it doesn't work. Same problem occurs with the frequency error. Really frustrated.

Perhaps you need to give us better instructions on how to apply the patch.

I tried just moving the lib folder to the D:\CIRCUITPY folder and it copies over and warns of conflicting folders/filenames but then with MU my code still gets the same exception.

Maybe the files are getting replaced but the actual code in memory isn't????

Please assist.

dsheeran
 
Posts: 78
Joined: Wed Aug 02, 2017 1:20 pm

Re: PWMOut ValueError using stepper motor on Crickit

by adafruit2 on Mon Mar 18, 2019 12:28 am

what circuitpython board are you using?

adafruit2
Site Admin
 
Posts: 18327
Joined: Fri Mar 11, 2005 7:36 pm

Re: PWMOut ValueError using stepper motor on Crickit

by dsheeran on Mon Mar 18, 2019 7:07 am

Circuit Playground Express

dsheeran
 
Posts: 78
Joined: Wed Aug 02, 2017 1:20 pm

Please be positive and constructive with your questions and comments.