Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - 4z7

Pages: 1 2 »
SmoothStepper USB / Problem with SS driver 2.08
« on: March 11, 2011, 05:40:36 PM »
I have been using SS for a couple of years now. I am generally satisfied with SS performance and I don't want to appear critical of SS. I prepared the following and sent to a few days ago but never received back any acknowledgement.   I assume SS  support,  just like Mach support is forum based at this forum, so I decided to post here.  Please note that this condition was only tested on Win7 64bit

Condition:0   Machv042.36 & ss15 & FTDI driver 2.06 , Win7x64 - Operates normal (starting condition)   

 After update Mach to 3.043.022 Mach hung with ss15 and I believe SS driver was 2.06.  I updated SSdriver to 2.08  and plugin to v17 but Mach still hung  as reported in condition1, so I removed SS and connected it to a desktop machine.

Condition1:    Mach3.043.22 , ss17 or ss15 , FTDI2.08 will not load and Mach hangs.   Mach window is grayed out and mouse cursor is hour glass when on top.  Task  Manager won't end program but I can do a normal shutdown.  SS LED heartbeat is solid

When I first connected SS to the desktop, it was running Mach3.043.28 which is a current development version.  I installed the driver and plugin ss17. Mach hung condition1.   Installed Mach3.043.22 but Mach still hung.  Installed Mach3.042.36 and Mach loaded ss17 plugin and I discovered condition 2.  I loaded ss15 and condition 0 normal.  Note here that  I think I was still using FTDI2.08 and  that I got Mach3.042.36 and ss17 or ss15 to load.  BUT I am not sure.  

The following can happen with USB devices.  Plugin in to USBportA and the device  driver will load for the last driver plugged into USB portA.  Likewise for USBportB, etc.  So, if SS is plugged into USBPortA and is unrecognized (i.e. it has never been plugged into USBportA) you can install a new driver say FTDI2.08 or update driver to 2.08.  Plug SS into USBportB and it IS recognized ( i.e. it has been before plugged into USBportB) and windows will load the last driver used for the device like FTDI2.06.  So just because you updated the FTDI driver on one USB port  doesn't necessarily mean that in any other USB port the driver will always be the latest FTDI driver.  That is why if you plug in SS to a USB port that it has never been plugged into before it is unrecognized and you are asked to install a driver.

Condition:2    Mach v042.36 & ss17 Plugin will load.  I use my own joystick plugin and when jogging at 100% of max
or maybe commanding 1.05* Max Velocity ( analog +- of joystick)  SS will throw an error and halt mach "Err reported by SS. Flag register 81420000".  I thought it was my plugin, so I removed it.  With axis MaxVelocity at 50ipm I MDI commanded "g1x10F99" and motion started and moved maybe 33% of commanded and then threw the same error.  During any move, the axis velocity DRO is not very steady reading 48 49 46,etc.  Sometimes the DRO  will flash a velocity of like 200 or 500 or 5000 just before producing the err and a couple of times the error isn't  produced and axis will take off like go to 1000 within a couple of seconds.   I cannot repeat  the error with ss15. The same commanded move produces a  steady 48.7 +- .2  vel DRO and steady jogging by joystick.

Thinking that I had got Mach042.36, ss15  and FTDI2.08 to operate properly on the desktop I went to install SS back to the machine

After re-installing SS to the machine, which had Mach3.043.22 , ss17,and 2.08 ssdriver(i think); Mach started up correctly which previously had hanged as condition1.  I tested for the error condition 2 without the servos actually active so no motion was actually happening.  SS threw the same error in condition 2 so I decided to change the plugin back to v15. After doing so the Mach hung condition 1 no matter  what  version Mach or plugin.  I decided to pull the machine pc and connect to the internet.  After all, on the desktop I had a successful condition  and the only difference between the desktop and the machine operating system was Windows update hadn't been run on the machine's pc in maybe 1 year.

After 50 updates and win7 sp1 update, Mach would still hang and all my testing had left 10 different profiles none of which would work with ss. Another occurrence was::  with v15 plugin in the plugin folder, but mach started on PP, then enabled in Configure Plugins, and restart, the plugin would still be disabled on the next start.  Regardless when I'd create a new profile with ss15 and tried to load it,  Mach would hang.

I have no idea why I did not try to roll back the FTDI driver yesterday when this problem began after updating to Mach3.043.22.  Because Mach hung loading ss I assumed that ss had to be updated. After a day and a half of frustration, I rolled back the FTDI driver to v2.06.  which works  with Mach3.043.22 and ss15. Mach3.043.22  will boot with ss17 and ftdi2.06 but throws error condition 1.

Obviously there is an error between the FTDI2.08 driver and both SS plugins version 15 and 17. So in summary:

1.  SmoothStepperDriver2.08.02 which is FTDI2.08.02 driver does not work with Win7 64bit and Mach any version or plugin any version.
2.  SmothStepperDriver2.06  will load   any Mach version  or plugin .with Win7x 64
3.  SSPlugin_v17bd throws error described in Condition 2.
4.  SmothStepperDriver2.06 , Mach3.043.22, SSPlugin_Beta2_v015ogx2.ddl is reliable with Win7x64.

It should also be noted that the current version FTDI driver is 2.08.12 and that comments are "Interim bug fix release" so obviously there are bugs in 2.08.02

I hope this can help others that have reported Mach hang with a grayed out screen.

General Mach Discussion / Re: Keygrabber tips?
« on: March 11, 2011, 02:45:11 PM »
The plugin can be set up for any button press to be a ShiftKey, Keypress, Macro, OEMCode,  or any other function designed into the plugin.  So, for any DRO I set up a macro to open a Message box for user input.  The DRO's that I frequently enter characters into  are X,Y and Z axis DROs.  So the simple macro to set  the X axis is

dro = Question("X DRO:")

Because the "Question Message Box" is a Window's compliant form all keypresses process with Windows::__::SendWait("key").  The DRO macros actually function more efficient since since I don't have to use  a mouse click  to set focus to the DRO.

For the MDI window I created  the macro 'SendKeys "{Enter}", false' which acts just as if ENTER was pressed from a keyboard within the  Mach Screen or MDI.  The only issue is the " macro ENTER" doesn't process within a Windows compliant control like the "Question Message Box" or a Mach Menu dropdown etc, so two ENTERs are required from button action, a " macro ENTER"  and a  Windows::Forms::SendKeys::SendWait("{ENTER}") .

The hand held keyboard and joystick has 2 joysticks controlling 4 axes and 26 buttons. Of the 26 buttons, 2  are designated as "ShiftKeys" so there are 49 button actions.  I have one button, like button17 set to Windows::Forms::SendKeys::SendWait("{ENTER}") and Shift-button17 set to "macro ENTER" so it isn't too confusing.  The two shift buttons when pressed together can also be set to a button action. 24 + Shifted 24 + 1shift-shift = 49.

I hope this helps anyone searching for SendKeys, SendWait, or ScanCodes. I would still like to find out how and/or if a ScanCode can be
processed in Mach's screen.

General Mach Discussion / Re: Keygrabber tips?
« on: March 05, 2011, 02:55:38 AM »
I have a plugin for a hand held keyboard and joystick. My problem is getting the keypress into Mach from the plugin. The plugin uses Windows::Forms::SendKeys::SendWait("KEY") like SendWait("1") would send the character 1 to whatever app has gotfocus on the desktop.  This Method is essentially a keyboard emulator and works for most other application.  For example if I have Mach open (the plugin is in Mach), then open another app like Notepad and give it focus, all the keypresses are correctly sent to Notepad.  Same for other apps that I have tried.

But in Mach, the keypresses are not getting processed. If the MDI textbox  (I assume it is a textbox) has got focus all the keypresses including arrow keys process except "ENTER" and "ESC".  If a DRO (I would also think it is a textbox) has got focus,  NO keypresses are processed.  If no controls have focus, just Mach,  "Enter" would be the only keypress that should process (the MDI Window shortcut key) but it doesn't.  All keypresses process in any of Mach's toolbar drop down forms.

I guess I've realized just by writing this that DROs  and the MDI aren't Windows::Form elements but the main Mach window certainly is a Windows::Form. So I suspect that I'll never get SendKeys to work with Mach.  I really only want to use the hand held keypress buttons to enter characters in the MDI or a DRO.

The reason I posted in this thread is because a search for "ScanCode"  most commonly returns  with KeyGrabber and this was the last posted to thread so I'm hoping someone will read this.  I am looking for the Method in Mach that processes keyboard scancodes to see if I can pass scancodes directly.  I assume that KeyGrabber intercepts any keyboard scancode  just sent to Mach, processes what it is set up to do, then passes them directly to only Mach.  Any ideas will be appreciated and I'll post a resolution if I find it.

I have since discovered a few more details on the back end. First of all I haven't even gotten to circular motion since I'm still trying to figure out linear motion.
I found the following Mach variables that give me the g Code move in  different places.
1.   Engine->LastCommandPos[6] give you 6 axes of the current G-code move in whatever work coordinates selected like G54.

2.  setup->CurrentOrigins[6] give you the fixture offsets so adding the two together you get the machine coordinates for the G-code move.

3.  _setup->feed_rate give you the GCode commanded feed rate in  //uu/sec.

4._setup->sequence_number is a number assigned by mach for each line of continuous GCode being processed.  It increments by 1 with each line of continuous G code and resets if G-code stream is interrupted. Oddly it appears to start and reset at 2 not 1, but maybe I'm just not seeing the first pass.

5.  _setup also has individual axis position moves but it is harder and slower to  process because it isn't in an axis array.

6.  I can also set a value to each line of gcode being run on the Nextmove controller and poll it during update.  The controller also has variables to set it's buffer size and get the buffer's free space.

So, I'm polling or updating at 50ms and every cycle I increment Mach's trajectory buffer
to stay ahead of Mach's 64 ms move.  I am not sure that incrementing Machs trajectory buffer is what triggers Machs Gcode processing but I suspect so.,  If the Nextmove controller is still on the same gcode move i do nothing more until it has finish the move and into the next line and then I call the required Mach variables described above and load another move into the controller.  So far I've been keeping 3 moves in the controllers buffer.

I don't need to worry about accel decel with Mach because that all gets setup in the controller.  Outside of slaving an axis for threading I only need to process vector moves and helical moves.  The controller can be set up for S-curve accel and contourmode which is corner blending like Mach's constant velocity mode.

Does the controller you are working with have servo loop control or does it generate pulses?  Are you aware of the other  Move structure GMoves1?  You get to the structure  GMoves1 rest = MainPlanner->MovementsAdd[Engine->TrajIndex].diffs;.  I am fairly certain that smoothstepper uses the diffs to generate it's pulses.  From what I could tell they are small constant (except at accel/decel so accel is built in )relative position moves but there is no time data except for the frequency delivery which is probably at 10 ms driven by Mach's fast clock.  There is also circular and velocity sweep data in the structure but that doesn't mean you have to use it.

I still hope to here from someone that might know more about the Gcode block and the best way to get it.


Oh I wanted to say there are a lot of very generous people on this forum.  Hood and ED are two that come to mind, although Ed's gone he still left a lot.  Part of the problem is C++ is a betch and then putting .net on top of it---Microsoft barely even supports it.  I've found the best way to figure things out in CLR is to see how it is done in C# which translates into clr fairly easy.  .

One on one phone support. / Phone Support Request
« on: August 27, 2010, 07:22:19 PM »
I would like to get phone support on a plugin project and would gladly pay for an answer as I've already spent many hours (days) on this last hurdle.  I have requested advice in the forum  with details here:,15354.msg105982.html#msg105982

My email address is and if I understand correctly you will email me with a phone number and time when I may call an expert.

I'm fairly certain that you don't mean that you don't want to process circular motion.  I think what you are saying is you don't want to process the DDA's. The GMoves structure is supposed to provide position moves and velocity moves and because time is included in the structure you can get velocity from the commanded position move and  position from the commanded velocity.  From what I've seen in the ncpods code it only uses the commanded positions and ignores DDA's.

I'm working on a motion plug in for a NextmoveESB motion controller.  I have I/O, and commanded velocity motion like jogging or home, functional but I am stuck on GCode moves.  The plugin is written in C++/CLR and uses the MachInclude structures built by Ed from Joshua Systems.  I don't know if Ed's MachIncludes are broken or if there is a Mach variable that needs to be turned on but the GMoves structure doesn't return any position data.

 I call into the ring buffer to get the GMove structure (from the Mach plugin wiki):
struct GMoves
   int type;    // 0 is linear, 1 is circular
   double cx,cy,cz; // center of move for cubics.
   double ex,ey,ez,ea,eb,ec;
   double sx,sy,sz,sa,sb,sc;
  __int64  DDA1[6];    //DDA1's for cubics                                                                   
   __int64  DDA2[6];
   __int64  DDA3[6];
   double Time;
   bool   Stop;
Not all the values are returned.
type,Time,Stop and DDA's all have values but e[axis],s[axis],c[axis] are always 0.  Ex.
MDI "g1 x1 f10" will return type = 0, Time =63(64) ms, DDA[0] = 999999999  (a large int),DDA[1] = 0, but ex = sx = 0- No position data.  When the move has completed, Time returns 34 and DDA[0] returns 8888888 (a different large int) which was the final move in the trajbuffer.

I don't really want to use this GMoves structure anyway because the longest move is only 64 ms.  What I want to get from Mach is the line of G-Code broken down for the line's complete move in a structure like:
"g1 x1 f10" (assuming starting at x0,y0,z0,)
struct GLineMove
   int type;    // 0 is linear
   double center[3]; // all zeros because move is linear
   double end[6];//ex = 1.0000 ( or counts),ey = ez...=sy = sz ... = 0
   double start[6];//sx = 0 ( or counts)this is  known
   double Time;//time = 6000 (1 uu * 60 sec/10 uu *  1000ms /sec )

Obviously Mach must take a line of G-Code and translate it to axes velocity pulses.  Somewhere during this translation the above variables are probably generated but maybe not exposed in a buffered structure that can be read and incremented.  I suspect that  position move data by gcode line  has something to do with the BACK_BUFFER  but I haven't discovered how to get at a "Back Buffer"or any movement structure other than the velocity pulse based GMoves and GMoves1.

Any ideas would be appreciated.


More info on the NextMove controllers:
The controller is a Texas Inst. Microcontroller which runs basic c software called Mint.  There are 3 or 4 servo channels, 4 stepper channels, 20 inputs,  11 outputs and 2 additional analog channels.  I/O, Servos, steppers are setup and tuned with a UI called MintWorkBench and the setup is stored in eprom on the controller.  The program that runs on the controller is just a loop that waits for an  event to happen (like a limit switch hit or estop) then processes the event and when finished returns to the main loop to wait for another event or command from a host which will be Mach if I can ever figure out how to get G code line moves.  The real beauty of this controller is just how simple it is to interface to a host.  All the host controls are AxtiveX and they pretty much duplicate all the functions and methods available in Mint.  For example aX is a pointer to the MintController.lib::ActiveXMintController;
aX->set_Jog(short nAxis, float vel); // jogs the axis at +- vel direction

aX->VectorA(nNumberOfAxes, nAxesArray,  fPosArray);;// coordinated one or more axis moves

Thanks for the reply.  I'm glad someone is reading this thread.  I don't really understand your code. I think it's a VB script maybe from a mach screen control.  I want to write to the mach screen error label from a C++/Cli managed plugin.  After more research (hours and hours) I think this is the code that should work but it doesn't.

using namespace System::Runtime::InteropServices;

namespace Joystick {
void SetMachError(String^ Message)

{                  //LPCSTR_TrajectoryControl::LastError
   String^ ms = Marshal::PtrToStringAnsi((IntPtr)&MainPlanner->LastError );   
   if( ms != nullptr )
   {      ms = Message;
      // //MessageBox::Show("ms " + ms );return;// "ms Did we get here?"

void funcs(){
   SetMachError("Did we get here?");

I've also tried the following String^ ms managed pointers.

   String^ ms = Marshal::PtrToStringAnsi((IntPtr) (void*) &MainPlanner->LastError );

They all compile but none display in the Mach error label. I have confirmed with a MessageBox that  ms is NOT Null.
 Maybe  it can't happen because in Ed's _TrajectoryControl::LastError is a LPCSTR and in Mach TrajectoryControl. LastError is a CString .


I've been working on a plugin using Ed's managed template for a few months now.  Most of that time has been spent learning C++/CLI starting from a minimal knowledge of VB.  CLI is sure frustrating.

Can't figure this out

1.  Is there a way to set the Mach error label like  MachErrorMsg("*********x") or SetMachError("*********x")? From the Shuttle Plugin:

   void SetMachError(Cstring Message){
      CString *err = &MainPlanner->LastError;
      if(err != NULL )
      *err = Message;"}


In Ed's -TrajectoryControl structure LastError is a LPCSTR pointer. In C++/CLI I came up with:

   void SetMachError(LPCSTR Message){   
      LPCSTR err =   (LPCSTR)&MainPlanner->LastError;
      if(err != nullptr )
      err = Message;// Compiles NO OUTPUT

      //(LPCSTR)err = Message;  //Compiles NO OUTPUT
      // MainPlanner->LastError = Message; // Compiles but Mach ArtError9991
      //MainPlanner->LastError = err;   // Compiles but Mach locks up   

Has anybody figured this out?


SmoothStepper USB / Re: Smoothstepper and Joystick
« on: August 19, 2009, 01:14:44 AM »
I'm trying to figure out why the joystick.dll  doesn't working with Smoothstepper, at least not for me.  It's good to know that the Xbox controller does work.  Do you know if the .dll source code is available?  The joystick I bought is a 3 axis joystick (XY stick and knob turn for Z) with 12 buttons which I think is essentially the same as the joystick controller with a few more buttons. 

I can get it to work on the Parrallel Port with the joystick.dll plugin but not Smoothstepper.

SmoothStepper USB / Smoothstepper and Joystick
« on: August 18, 2009, 08:52:51 PM »
I'm trying to get a USB joystick to work with Smoothstepper using SS.dll version 015ogb on a mill.  I've tried the lockdown and  .43 development versions of MACH  but with the same results.   Using the SS plugin and the joystick plugin no XY jogging  is commanded to MACH.  If I remove the SS plugin and default to the PP driver,  the joystick does command motion to MACH  (no motion actually occurs since nothing is wired to the PP). 

I can still use the Suttle & Shuttle.dll  jogging  with the Smoothstepper, but I'm tired of the 1 wheel, 3 button axis jogging of the shuttle.  Eventually I move the wrong axis and damage the workpiece or tool or loose  a reference.

Does anybody have a Microsoft compatible joystick using joystick.dll working with SS?


Pages: 1 2 »