Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 274
Posted: 08:08am 17 Apr 2026
Copy link to clipboard
Print this post
G'day Brian, Are you running PicoMite V6.02.01 on the RP2350 board? there where a few changes to the Stepper commands from V6.02.00 to V6.02.01 that might be causing what you are seeing.
Also STEPPER INIT got a few more options.
Regards, Lyle.
mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 274
Posted: 08:46am 17 Apr 2026
Copy link to clipboard
Print this post
G'day Brian, This is a cut down version of the test program for my coil winding machine, this definitely works on PicoMite RP2350B V6.02.01 Maybe try running this and see if you get some motion and add the rest from there.
' prog to test stepper functions
Option default integer
SetTick 200,Show_Pos
Stepper init Stepper axis x,gp0,gp1,,,200,400,50,5 Stepper axis y,gp2,gp3,,,400,600,100,5 Stepper position home Stepper run Stepper gc g1 x100 y80 f500 Stepper gc g0 x0 y0
Do Pause 100 Loop Until Peek(stepper active)=0 ' wait until motion complete
Pause 250 ' wait for final position update Stepper close
End
Sub Show_Pos Print @(100,100),"X-POS= " Str$(Peek(stepper x),-4,4) Print @(100,120),"Y-POS= " Str$(Peek(stepper y),-4,4) End Sub
> option list PicoMite MMBasic RP2350B V6.02.01 OPTION FLASH SIZE 16777216 OPTION COLOURCODE ON OPTION PICO OFF OPTION CPUSPEED (KHz) 200000 >
Also note that the stepper system works in the background, I found this very confusing at the beginning, the motors can be running while you are sitting at the command prompt.
Regards, Lyle.
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 11:37pm 17 Apr 2026
Copy link to clipboard
Print this post
Thanks for that code Mozzie
Just tried now and got this
RUN [11] Stepper init Error : Stepper already initialized
The code modified for my setup, now as I don't have the Y axis setup I commentated the Y axis out
' prog to test stepper functions
Option default integer
SetTick 200,Show_Pos
Stepper init Stepper axis x,gp27,gp25,,,200,400,50,5 'Stepper axis y,gp2,gp3,,,400,600,100,5 Stepper position home Stepper run Stepper gc g1 x100 f500 Stepper gc g0 x0
Do Pause 100 Loop Until Peek(stepper active)=0 ' wait until motion complete
Pause 250 ' wait for final position update Stepper close
End
Sub Show_Pos Print @(100,100),"X-POS= " Str$(Peek(stepper x),-4,4) 'Print @(100,120),"Y-POS= " Str$(Peek(stepper y),-4,4) End Sub
Now notice the error was on line 11 so I do think I need to get that flash nuke code for the new 2350B so I can totally wipe the pico2 board as the stepper code is still in the pico.
Regards Bryan Edited 2026-04-18 09:38 by Bryan1
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 12:41am 18 Apr 2026
Copy link to clipboard
Print this post
Ok so found Peter had a new beta so downloaded that and flashed the pico2,
So this has me boggled as with a fresh flashed pico2 how can the stepper setup remember the settings
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 12:45am 18 Apr 2026
Copy link to clipboard
Print this post
1) You don't need to nuke the Pico. After an error the program configuration remains active. This is normal, for regular programs it lets you examine what caused the problem and typing "clear" erases all variables. However I think STEPPER runs on the second core and doesn't respond to Clear so you need to type "CPU RESTART" to reboot the Pico.
2) You could use Lyle's code without removing "y". It doesn't matter if nothing is connected to the y pins. I don't have x or y connected and it works properly.
3)Here is your first modified program, tested and working.
' prog to test stepper functions
Option default integer
SetTick 200,Show_Pos
Stepper init Stepper axis x,gp27,gp25,,,200,400,50,5 'Stepper axis y,gp2,gp3,,,400,600,100,5 Stepper position home Stepper run Stepper gc g1 x100 f500 Stepper gc g0 x0
Do Pause 100 Loop Until Peek(stepper active)=0 ' wait until motion complete
Pause 250 ' wait for final position update Stepper close
End
Sub Show_Pos Print @(100,100),"X-POS= " Str$(Peek(stepper x),-4,4) ' Print @(100,120),"Y-POS= " Str$(Peek(stepper y),-4,4) End Sub
And the output after a successful run.
> RUN Stepper initialized - 100KHz timer active Warning: Soft limits not configured. Use STEPPER LIMITS to set working area. Stepper armed - executing buffered commands
X-POS= +0.0000 >
Edit You Posted while I was writing this. Edited 2026-04-18 10:55 by phil99
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 01:14am 18 Apr 2026
Copy link to clipboard
Print this post
Here is your last version running. All I had to do on mine was change the pins to ones that are free on my Pico.
> cpu restart > RUN Stepper initialized - 100KHz timer active Warning: Soft limits not configured. Use STEPPER LIMITS to set working area. Hardware limit switches configured X axis limits: 0X-POS= +32.5513mm (0 to 160000 steps) Stepper armed - executing buffered commands >
Edit. Read the Stepper Manual, you need to type STEPPER CLOSE so stop it. CPU RESTART not needed.
Edited 2026-04-18 11:24 by phil99
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 01:20am 18 Apr 2026
Copy link to clipboard
Print this post
Well with that last code I put up, the pico did run the code and it did take a few goes to get it to run but both the PSU and the scope didn't show anything. I set the voltage to 12 volts and 430mA yet at no time have I seen any current drawn. I also put a new stepper chip in with no change and I have noticed a led on the stepper board that isn't lit and never has.
Now I have just been using MCCC as the client and decided to finally download teraterm only to find trying to install it got a access denied on this win10 computer so texted my daughter to ask her boyfriend of that command line code we talked about as he is in IT to get rid of this "Bob" so I have full control of this PC.
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 01:28am 18 Apr 2026
Copy link to clipboard
Print this post
Use this after an error or <Ctrl-C> instead of CPU Restart.
mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 274
Posted: 03:06am 18 Apr 2026
Copy link to clipboard
Print this post
G'day, Bryan, you may have found a bug in the stepper code, a quick test has shown the enable pin is not being set, some further testing to follow. My system doesn't use the enable so works ok, maybe tie enable to 3v3 and see if you get movement.
As Phil99 has pointed out, the stepper system is still running in the background once initialized until stopped with STEPPER CLOSE or a reset / power cycle.
On error skip Stepper close Stepper Init 0.05, 150, GP22
Your earlier code with this at the start will stop the error if the code exits early and doesn't close the stepper system.
Regards, Lyle. Edited 2026-04-18 13:10 by mozzie
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 03:46am 18 Apr 2026
Copy link to clipboard
Print this post
Hi Mozzie I finally got the code working but no joy out of these small stepper boards at all so I just looked at the option of setting up my board so the enable, step and DIR pins are giving a DM556 micro stepper so I can test this on my cnc.
Now one question with these small driver boards are the step signals pulled up or down, also on the scope with the step pin there was some action at 2.5 volts but just spikes and no real waveform also the DIR pin did go from high to low when the second gc was started.
Now I did find after using a limit stop trying to use run again gave an error where it said so I did a reboot each time
> run Stepper initialized - 100KHz timer active Warning: Soft limits not configured. Use STEPPER LIMITS to set working area. Hardware limit switches configured X axis limits: 0.000 to 200.000 mm (0 to 160000 steps) Stepper armed - executing buffered commands
Now in MCCC it doesn't show the print statement but it is shown on the lcd.
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 04:21am 18 Apr 2026
Copy link to clipboard
Print this post
Now going off the scope pic I would say the DIR and Step signals are pulled low which is the case on my cnc setup.
Just finished making the new cable so time to test my DM556 micro stepper and the X axis so then I can calibrate the steps using my dial indicator.
Well just tried on the cnc X axis the code ran but no movement Edited 2026-04-18 14:44 by Bryan1
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 04:54am 18 Apr 2026
Copy link to clipboard
Print this post
OK found I had left the enable set so commentated it out and put a Stepper clear at the top of the code.
Upload completed 1
Saved 619 bytes > Time taken: 39606mS RUN [11] Stepper init 0.05, 150, GP22 Error : Stepper already initialized > C:\Users\Bryan\Documents\MMBasic Code\mozzie test.bas Uploading using: 'target port\COM9:19200 s\picomite Upload started NEW > autosave
Upload completed 1
Saved 625 bytes > Time taken: 35838mS RUN [11] Stepper init 0.05, 150, GP22 Error : Stepper already initialized
So is the bug you referring to Mozzie ?
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 05:29am 18 Apr 2026
Copy link to clipboard
Print this post
Yes Mozzie showed the answer, add:-
On error skip Stepper close
just above:-
Stepper Init 0.05, 150, GP22
That will ensure the stepper system is closed before trying to open it. The "on Error Skip" prevents the Close command causing an error if it is already closed. . Edited 2026-04-18 15:34 by phil99
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 05:34am 18 Apr 2026
Copy link to clipboard
Print this post
OK I had the Stepper close the same and commenting it out got the code running now putting Stepper close back in gave this
Upload completed 1
Saved 625 bytes > Time taken: 42259mS RUN [10] Stepper close Error : Stepper not initialized
Now I've got my scope Channel 1 hooked up to the step pin GP25 where I did change the GP pin as enable was left out, the ground off the probe goes to the ground rail on the breadboard.
When the code is running got no action on the scope at just ground static, I am thinking as the DM556 is 5 volt min the pico isn't enough to drive it so may have to research a 5 volt logic board so the DIR and Step pins can do the 5 volt. Edited 2026-04-18 15:41 by Bryan1
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 05:37am 18 Apr 2026
Copy link to clipboard
Print this post
The "On Error Skip" prevents the Close command causing an error if it is already closed.
You need both lines.
Edit. Or perhaps to ignore errors in the next 2 lines:-
ON ERROR SKIP 2 Edited 2026-04-18 15:43 by phil99
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Stepper position home Stepper run Stepper gc g1 x50 f100 Stepper gc g0 x0
Do Pause 100 Loop Until Peek(stepper active)=0 ' wait until motion complete
Pause 250 ' wait for final position update Stepper close
End
Sub Show_Pos Print @(100,100),"X-POS= " Str$(Peek(stepper x),-4,4) 'Print @(100,120),"Y-POS= " Str$(Peek(stepper y),-4,4) End Sub
Stepper initialized - 100KHz timer active Warning: Soft limits not configured. Use STEPPER LIMITS to set working area. Hardware limit switches configured X axis limits: 0.000 to 200.000 mm (0 to 160000 steps) Stepper armed - executing buffered commands
Now on the LCD it did show the code running now I've got the scope set to 5 volts, 5ms with a 3V trigger level and while the code is running only got ground static on the scope.
Also on the cnc I put a ground wire to the breadboard ground
Thru out the day when I saw it wasn't working trying those limit switchs sometimes when the code went to that code above but nothing was printed on the LCD none of the limit switch pins would work and only a reset would work. Now when the code is running right every limit switch works. Edited 2026-04-18 15:58 by Bryan1
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 06:04am 18 Apr 2026
Copy link to clipboard
Print this post
Level shifter modules are readily available or you can make your own on breadboard / stripboard. 1 general purpose NPN transistor and 2 resistors per pin.
The transistor emitter goes to the Pico DOUT pin, the base goes to 3.3V via a 10kΩ resistor and the collector is the output and also goes to 5V via 4.7kΩ.
BC547, BC548, BC549, or PN100 are examples that should work.
Putting ON ERROR SKIP at the start won't work. It only operates on the very next command. It has to be just like Mozzie showed, no creativity allowed!
ON ERROR SKIP Stepper Close
Bryan1 Guru Joined: 22/02/2006 Location: AustraliaPosts: 1862
Posted: 07:05am 18 Apr 2026
Copy link to clipboard
Print this post
So if I got this right the 3.3V can come from the 3v3 pin on the pico2 via the 10K resistor and the collector will go to a 5V board I have to make. Now the DM556 can accept 24 volts drive signals so a level shifter to suit or in my case the CNC runs straight off my shed battery via a 30 amp fuse.
I did notice on my CNC the DIR and Step pins were pulled up 5 volts on that Ebay board that got my CNC going again so I could pull 5 volts from that as the USB cable is always connected and 5 volts is there for the taking.
It would be great if I can get this stepper code working with the DM556 rather than use those small stepper boards as those CNC boards are designed for 3D printers NOT CNC's and Surface Grinders
Anyway with the luck I'm having NEXT JOKE like with my inverter and now this stepper code decided as my battery bank is fully charged I put the pump on to fill that steel 30 year old tank beside my shed that fills a water trough and the vege garden. Now I couldn't workout why the tank kept losing water and with me being busy in the shed when the tank was 1/2 full noticed the side of tank leaking where a rust hole appeared about a 3rd up the tank.
So thats a job for old solder sticks I have after the flood at the side of my shed is gone to fix it then that water trough can be filled again so the local wildlife can have a water point again.
Now I always planned to put a camera on that water tank so back in the day I made those back pack 2040 Zero boards. Now when I saw the camera was going to removed from MMBasic I pulled the board I made out only to find the reason I couldn't get it working I only connected one I2C line to the breakout pins so a simple jumper wire can fix that.
My idea is couple that Zero camera board to a 2040W board and as I have wifi around the farm using starlink make a live webpage so the water trough is live and in summer watching huge brown and black snakes taking a drink will be a sight to see I'm sure.
Got a call from SOS today asking me if I could help this company finish a project so my retirement is being disrupted for a couple of days next week or longer and I put my preference down for doing shutdown with them so I mentioned just go off my report when I did Mt Isa and call back in 5 minutes saying off that report I'm back on the shutdown list
Now with the stepper reference PDF it just states the G-code goes to a buffer and nothing else about that buffer so some explanation about that would be nice.
I am involved in another forum where I'm a moderator for home distilling as I have been making moonshine since 2010 and I looked at the cost of going legal where one has give away a daughter just to afford the cost of doing business.
As the excise is like $134 a litre of 100% and payable when it's made not sold. So trying to start a business in this country has become a joke where one needs a millions dollars just to start.
Anyway for all the help I have gotten from this forum over the years I can make bottle for those that are keen to get one where I will made a label stating your name or nickname with a note at the bottom when this bottle is empty bring it back for a refill
Regards Bryan
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3151
Posted: 08:00am 18 Apr 2026
Copy link to clipboard
Print this post
1) You can also get 5V from the Pico Pin 39, VSYS. See the manual, Hardware Details. 2) If the CNC can accept 24V logic levels you don't need 5V. Change the collector resistor to 22kΩ and connect it to 24V instead.
If the CNC is happy with 5V logic input perhaps stick with that as it keeps 24V off the breadboard. Less chance of a mistake going bang.
Edit. If your CNC requires inverted logic the transistors can be made to do that. Connect the emitter to ground, the base to the Pico DOUT pin via 10kΩ and the collector to CNC input and 4.7kΩ to 5v. . Edited 2026-04-18 18:15 by phil99
Page 2 of 3
Print this page
The Back Shed's forum code is written, and hosted, in Australia.