Topics

MKS Gen-L 1.0 and Foucser


Jamie Flinn
 

Can anyone confirm if running focuser is possible on MKS Gen-L V1.0…I thinik I heard NO somewhere – been trying with good old A4988 and can get a motor that is working well on DEC or RA to only move one direction (then it auto reverses itself after you stop depressing the button)

 

I suspect this is juts a THING about the 1.0 boards (my 2.1 board focuser is awsome!!!!)


Howard Dutton
 

That is strange, every once in a while I hear the... "focuser doesnt work" thing.

I've never seen it happen.

1. Post the Config.h focuser section.
2. Perhaps if you could describe the behavior in painful detail.  Including the position indication values in the web interface or elsewhere.
3. If using 3.16 switch to the master branch and see if it works.
4. If using the (latest) master branch turn on #define DEBUG VERBOSE in OnStep.ino.  Open the serial monitor and flash then post the log it spits out here before turning it back OFF again.


Jamie Flinn
 
Edited

using BOTH 3.16 and main branch (4.x) –

 

Using the pins under the board fully populated

 

Using the phone app to move focuser (which works fine on my V2.1 and V2.0 board)

 

I wonder if this is pin map thing since the V1.0 board needs for it’s regular drives the SPI pins UP to connect to elsewhere on the board (which V2 and up do not need) and the “good old” A4988 runs only native and not SPI with this board – the values I see in the app are actually OK and mostly match my working focuser numbers (range 0-50,000) – it is the LEFT key that cause action...the RIGHT key does nothing….

 

Press and hold the left key and let the numbers go from 0->15,000 lets say (a nice long move)…release…..the move goes in reverse and puts you back to 0!

 

I upped the limit_min_rate from 1 to 10 but other than that it is stock settings

 

// AXIS4 FOCUSER 1 ----------------------

#define FOCUSER1                       ON //    OFF, ON to enable this focuser.                                               Option

#define AXIS4_STEPS_PER_MICRON        0.5 //    0.5, n. Steps per micro-meter. Figure this out by testing or other means.     Adjust

#define AXIS4_STEP_RATE_MAX           8.0 //    8.0, n, (milli-sec.) Min. ms/step depends on processor. In DC mode, PWM freq. Adjust

 

#define AXIS4_DRIVER_MODEL            OFF //    OFF, TMC2130, TMC5160. Leave OFF for all drivers models except these.         Option

#define AXIS4_DRIVER_MICROSTEPS       OFF //    OFF, n. Microstep mode when tracking.                   For TMC2130, TMC5160. Option

#define AXIS4_DRIVER_IHOLD            OFF //    OFF, n, (mA.) Current standstill. OFF uses IRUN/2.0.                  "       Option

#define AXIS4_DRIVER_IRUN             OFF //    OFF, n, (mA.) Current tracking, appropriate for stepper/driver/etc.   "       Option

#define AXIS4_DRIVER_POWER_DOWN       OFF //    OFF, ON Powers off the motor at stand-still.                                  Option

#define AXIS4_DRIVER_REVERSE          OFF //    OFF, ON Reverses movement direction, or reverse wiring instead to correct.    Option

#define AXIS4_DRIVER_DC_MODE          OFF //    OFF, DRV8825 for pwm dc motor control on stepper driver outputs.              Option

 

#define AXIS4_LIMIT_MIN_RATE           10 //     10, n. Where n=1..1000 (um/s.) Minimum microns/second. In DC mode, min pwr.  Adjust

#define AXIS4_LIMIT_MIN                 0 //      0, n. Where n=0..500 (millimeters.) Minimum allowed position.               Adjust

#define AXIS4_LIMIT_MAX                50 //     50, n. Where n=0..500 (millimeters.) Maximum allowed position.               Adjust

 

 

Since I have no wifi in this one I don’t think I will get verbose logs anywhere…thanks for looking

J

 

 

Sent from Mail for Windows 10

 

From: Howard Dutton
Sent: Wednesday, September 9, 2020 4:21 PM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

That is strange, every once in a while I hear the... "focuser doesnt work" thing.

I've never seen it happen.

1. Post the Config.h focuser section.
2. Perhaps if you could describe the behavior in painful detail.  Including the position indication values in the web interface or elsewhere.
3. If using 3.16 switch to the master branch and see if it works.
4. If using the (latest) master branch turn on #define DEBUG VERBOSE in OnStep.ino.  Open the serial monitor and flash then post the log it spits out here before turning it back OFF again.

 

 


Howard Dutton
 

On Wed, Sep 9, 2020 at 01:43 PM, Jamie Flinn wrote:
Since I have no wifi in this one I don’t think I will get verbose logs anywhere…thanks for looking
DEBUG mode has nothing to do with WiFi.  It uses the SerialA command channel's port by default, again turn it back OFF after seeing what OnStep says.  So flash the Mega2560 and make sure the Serial Monitor is open and you'll see.  It will tell me if things in NV are corrupt/out of range.  Only the most recent master branch does checks of the focuser NV values.

Also, I don't see how the pinmap could possibly have anything to do with the focuser moving back to zero as described.


Jamie Flinn
 

Nothing so far – is there a command I can send in serial monitor to trigger a focuser move

 

Sent from Mail for Windows 10

 

From: Howard Dutton
Sent: Wednesday, September 9, 2020 4:59 PM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

On Wed, Sep 9, 2020 at 01:43 PM, Jamie Flinn wrote:

Since I have no wifi in this one I don’t think I will get verbose logs anywhere…thanks for looking

DEBUG mode has nothing to do with WiFi.  It uses the SerialA command channel's port by default, again turn it back OFF after seeing what OnStep says.  So flash the Mega2560 and make sure the Serial Monitor is open and you'll see.  It will tell me if things in NV are corrupt/out of range.  Only the most recent master branch does checks of the focuser NV values.

Also, I don't see how the pinmap could possibly have anything to do with the focuser moving back to zero as described.

 


Khalid Baheyeldin
 

On Wed, Sep 9, 2020 at 05:11 PM, Jamie Flinn wrote:
is there a command I can send in serial monitor to trigger a focuser move
You can do this:

:FA1#
Make the first focuser active (axis 4)

:FT#
Get focuser status

The rest of the commands are here:

http://www.stellarjourney.com/index.php?r=site/software_focuser


Jamie Flinn
 

Hi All…

 

Been testing around on this in a number of ways and my last tests give me some greater insight:

  1. I know the motors are wired correctly as I can flip connection with my focus/DEC/RA motors and wires and get same reversing behavior – and since the app can move the motor in one direction and SW is moving it back I know the  windings are correct or it would just stutter away
  2. With the phone app I can move the motore as indicated (one button/direction only) and then the motor will immediately reverse back to 0 position
  3. With ASCOM (new) I cannt get the focuser to connect – still trying
  4. With INDI I get some interesting results – INDI knows all the normal stuff about the focuser and it also knows the start point is 0…..with INDI you can tell the focuser to set at 0 or at MID which in this case is 25000 – now this is where it gets interesting – under INDI I cannot move it forward or backwards by IN OUT buttons…BUT if I set to MID of 25000, Onstep is immediately moving it BACK to 0 and the motor is in fact moving in that direction – I see warnings when trying to use IN OUT buttons that the limit is 0  …and it is moving at the expected speeds (um/sec) I have set

 

Have been traversing the code to see if I can identifiy something that looks like a limit that can cause a reversal (which would always be tripping for some reason)…but the more I look at this it appears to be some kind of false trigger.   Any hairbrained Ideas would be good 😊…..BTW when I connect the serial monitor I do not get movement on command, I do get some output but it does not seem to be correct: almost as if I am using the wrong commands…lol one of the focuser commands looks as if it returns the TIME…. 11:27:31…ummmm yeah was not asking for that 😊

 

I plan on testing the same driver and code on one of my Gen-L 2.x units and see what I get….but summary is that it is PARTIALLY working but either only some or wrongs instructions making it to the driver

 

 

From: main@onstep.groups.io On Behalf Of Khalid Baheyeldin
Sent: Wednesday, September 9, 2020 5:33 PM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

On Wed, Sep 9, 2020 at 05:11 PM, Jamie Flinn wrote:

is there a command I can send in serial monitor to trigger a focuser move

You can do this:

:FA1#
Make the first focuser active (axis 4)

:FT#
Get focuser status

The rest of the commands are here:

http://www.stellarjourney.com/index.php?r=site/software_focuser


Howard Dutton
 
Edited

On Wed, Sep 9, 2020 at 01:21 PM, Howard Dutton wrote:
4. If using the (latest) master branch turn on #define DEBUG VERBOSE in OnStep.ino.  Open the serial monitor and flash then post the log it spits out here before turning it back OFF again.
Get this working, latest master branch, edit OnStep.ino:

#define DEBUG VERBOSE

Open the serial monitor and copy/paste the output here.  If I see nothing interesting I can add more debug code to look deeper if necessary.
I can also, with debug mode on, have you dump the EEPROM contents so I can upload that into a Mega2560 here to come closer to exactly duplicating your setup.


Jamie Flinn
 

Ok…will give it a try – I think my 4.x is revision g which is a bit outdated….cheers

 

From: main@onstep.groups.io On Behalf Of Howard Dutton
Sent: Friday, September 11, 2020 11:13 AM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

On Wed, Sep 9, 2020 at 01:21 PM, Howard Dutton wrote:

4. If using the (latest) master branch turn on #define DEBUG VERBOSE in OnStep.ino.  Open the serial monitor and flash then post the log it spits out here before turning it back OFF again.

Get this working, latest master branch, edit OnStep.ino:

#define DEBUG VERBOSE

Open the serial monitor and copy/paste the output here.  If I see nothing interesting I can more debug code to look deeper if necessary.
I can also, with debug mode on, have you dump the EEPROM contents so I can upload that into a Mega2560 here to come closer to exactly duplicating your setup.


Howard Dutton
 

On Fri, Sep 11, 2020 at 08:21 AM, Jamie Flinn wrote:
Ok…will give it a try – I think my 4.x is revision g which is a bit outdated….cheers
It was not that long ago that I added code that validates (and debug mode reports errors for) focuser settings coming from EEPROM.

That is why I used the word "latest".


Jamie Flinn
 

cheers

 

From: main@onstep.groups.io On Behalf Of Howard Dutton
Sent: Friday, September 11, 2020 11:30 AM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

On Fri, Sep 11, 2020 at 08:21 AM, Jamie Flinn wrote:

Ok…will give it a try – I think my 4.x is revision g which is a bit outdated….cheers

It was not that long ago that I added code that validates (and debug mode reports errors for) focuser settings coming from EEPROM.

That is why I used the word "latest".


Jamie Flinn
 

Lol…. With latest it is now working!!!!!!! – I can control both direction via buttons – using same config as the earlier tests

 

But this is interesting via console and the inputs provided to me  - a load of commands are unknown – I also tried with and without : or # juts to see and those were not the problems…weird eh?

⸮⸮

 

MSG: OnStep 4.15h

MSG: Init HAL

MSG: Init serial

MSG: Init pins

MSG: Init TLS

MSG: Start NV 4096 Bytes

MSG: Init NV Axis1 defaults

MSG: Init NV Axis2 defaults

MSG: Init NV Axis3 defaults

MSG: Init NV Axis4 defaults

MSG: Init NV Axis5 defaults

MSG: Read NV settings

MSG: Allocated PEC buffer, 600 bytes

WRN, initReadNvValues(): NV maxRate (too low)

MSG: Init startup settings

MSG: Init library/catalogs

MSG: Init guiding

MSG: Init weather

MSG: Init sidereal timer

MSG: Init motor timers

MSG: Axis1/2 stepper drivers enabled

MSG: Setting up Axis1/2 TMC stepper drivers

MSG: Tracking autostart

MSG: Setting up Axis1/2 TMC stepper drivers

MSG: Init focuser1

MSG: Serial buffer flush

MSG: OnStep is ready

 

1S#MSG: CMD_CH_A "MI1500", Error command unknown

0MSG: CMD_CH_A "I1500:SZ", Error command unknown

0MSG: CMD_CH_A "SZ", Error command unknown

0MSG: CMD_CH_A "GI", Error command unknown

0MSG: CMD_CH_A "I", Error command unknown

006:44:15#None#MSG: CMD_CH_A "SH", Error command unknown

0MSG: CMD_CH_A "SI500", Error command unknown

0MSG: CMD_CH_A "MI", Error command unknown

0MSG: CMD_CH_C "GXY0", Error command unknown

 

 

 

Sent from Mail for Windows 10

 

From: Jamie Flinn
Sent: Friday, September 11, 2020 12:08 PM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

cheers

 

From: main@onstep.groups.io On Behalf Of Howard Dutton
Sent: Friday, September 11, 2020 11:30 AM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

On Fri, Sep 11, 2020 at 08:21 AM, Jamie Flinn wrote:

Ok…will give it a try – I think my 4.x is revision g which is a bit outdated….cheers

It was not that long ago that I added code that validates (and debug mode reports errors for) focuser settings coming from EEPROM.

That is why I used the word "latest".

 


Howard Dutton
 

On Fri, Sep 11, 2020 at 10:37 AM, Jamie Flinn wrote:
a load of commands are unknown – I also tried with and without : or # juts to see and those were not the problems…weird eh?
Not weird at all, OnStep is telling it like it is.

The only valid command of any listed was the :GXY0# which is the WiFi Addon checking to see if any auxiliary features are enabled, it really should be a different error return code that doesn't trigger a debug message but it's working correctly otherwise.  Takes time to work all those nuances out.

These commands all start with : and end with #.

I know the focuser commands are not documented outside of the source code but the source code is reasonably well commented (from Command.ino.)  The second focuser, if present uses a lower case "f" instead of an uppercase "F" and all commands are exactly the same otherwise.  The primary and secondary focusers can also be swapped with that :FA[n]# command.  Some commands can also work in units microns or steps (microns default but a lower case second letter denotes steps instead.)

// :FA[n]#    Select primary focuser where [n] = 1 or 2
//            Return: 0 on failure
//                    1 on success

// :FT#       Get status
//            Returns: M# (for moving) or S# (for stopped)

// :Fp#       Get mode
//            Return: 0 for absolute
//                    1 for pseudo absolute

// :FI#       Get full in position (in microns or steps)
//            Returns: n#

// :FM#       Get max position (in microns or steps)
//            Returns: n#

// :Ft#       Get focuser temperature
//            Returns: n# temperature in deg. C

// :Fu#       Get focuser microns per step
//            Returns: n.n#

// :FC#       Get focuser temperature compensation coefficient
//            Return: n.n#

// :FC[sn.n]# Set focuser temperature compensation coefficient in um per deg. C (+ moves out as temperature falls)
//            Return: 0 on failure
//                    1 on success

// :Fc#       Get focuser temperature compensation enable status
//            Return: 0 if disabled
//                    1 if enabled

// :Fc[n]#    Enable/disable focuser temperature compensation where [n] = 0 or 1
//            Return: 0 on failure
//                    1 on success

// :FP#       Get focuser DC Motor Power Level (in %)
//            Returns: n#

// :FP[n]#    Set focuser DC Motor Power Level (in %)
//            Return: 0 on failure
//                    1 on success

// :FQ#       Stop the focuser
//            Returns: Nothing

// :FF#       Set focuser for fast motion (1mm/s)
//            Returns: Nothing

// :FS#       Set focuser for slow motion (0.01mm/s)
//            Returns: Nothing

// :F[n]#     Set focuser move rate, where n = 1 for finest, 2 for 0.01mm/second, 3 for 0.1mm/second, 4 for 1mm/second
//            Returns: Nothing

// :F+#       Move focuser in (toward objective)
//            Returns: Nothing

// :F-#       Move focuser out (away from objective)
//            Returns: Nothing

// :FG#       Get focuser current position (in microns or steps)
//            Returns: sn#

// :FR[sn]#   Set focuser target position relative (in microns or steps)
//            Returns: Nothing

// :FS[n]#    Set focuser target position (in microns or steps)
//            Return: 0 on failure
//                    1 on success

// :FZ#       Set focuser position as zero
//            Returns: Nothing

// :FH#       Set focuser position as half-travel
//            Returns: Nothing

// :Fh#       Set focuser target position at half-travel
//            Returns: Nothing


Howard Dutton
 
Edited

On Fri, Sep 11, 2020 at 10:37 AM, Jamie Flinn wrote:
Lol…. With latest it is now working!!!!!!!
There was an NV structure re-design fairly recently in the master branch that required changing the NV key.

So NV (EEPROM) was possibly wiped and re-initalized with your update to the latest and with it the problem was solved.  If not perhaps the new validation code caught and fixed the issue.

Either way I would rather have seen an error message to help understand where the problem was... but at-least it's fixed.

Be sure to turn DEBUG OFF again and upload, all the same NV checks/corrections will still be made, just silently.


Jamie Flinn
 

Thanks for this…more stuff to play with

 

From: main@onstep.groups.io On Behalf Of Howard Dutton
Sent: Friday, September 11, 2020 2:07 PM
To: main@onstep.groups.io
Subject: Re: [onstep] MKS Gen-L 1.0 and Foucser

 

On Fri, Sep 11, 2020 at 10:37 AM, Jamie Flinn wrote:

a load of commands are unknown – I also tried with and without : or # juts to see and those were not the problems…weird eh?

Not weird at all, OnStep is telling it like it is.

The only valid command of any listed was the :GXY0# which is the WiFi Addon checking to see if any auxiliary features are enabled, it really should be a different error return code that doesn't trigger a debug message but it's working correctly otherwise.  Takes time to work all those nuances out.

These commands all start with : and end with #.

I know the focuser commands are not documented outside of the source code but the source code is reasonably well commented (from Command.ino.)  The second focuser, if present uses a lower case "f" instead of an uppercase "F" and all commands are exactly the same otherwise.  The primary and secondary focusers can also be swapped with that :FA[n]# command.  Some commands can also work in units microns or steps (microns default but a lower case second letter denotes steps instead.)

// :FA[n]#    Select primary focuser where [n] = 1 or 2
//            Return: 0 on failure
//                    1 on success

// :FT#       Get status
//            Returns: M# (for moving) or S# (for stopped)

// :Fp#       Get mode
//            Return: 0 for absolute
//                    1 for pseudo absolute

// :FI#       Get full in position (in microns or steps)
//            Returns: n#

// :FM#       Get max position (in microns or steps)
//            Returns: n#

// :Ft#       Get focuser temperature
//            Returns: n# temperature in deg. C

// :Fu#       Get focuser microns per step
//            Returns: n.n#

// :FC#       Get focuser temperature compensation coefficient
//            Return: n.n#

// :FC[sn.n]# Set focuser temperature compensation coefficient in um per deg. C (+ moves out as temperature falls)
//            Return: 0 on failure
//                    1 on success

// :Fc#       Get focuser temperature compensation enable status
//            Return: 0 if disabled
//                    1 if enabled

// :Fc[n]#    Enable/disable focuser temperature compensation where [n] = 0 or 1
//            Return: 0 on failure
//                    1 on success

// :FP#       Get focuser DC Motor Power Level (in %)
//            Returns: n#

// :FP[n]#    Set focuser DC Motor Power Level (in %)
//            Return: 0 on failure
//                    1 on success

// :FQ#       Stop the focuser
//            Returns: Nothing

// :FF#       Set focuser for fast motion (1mm/s)
//            Returns: Nothing

// :FS#       Set focuser for slow motion (0.01mm/s)
//            Returns: Nothing

// :F[n]#     Set focuser move rate, where n = 1 for finest, 2 for 0.01mm/second, 3 for 0.1mm/second, 4 for 1mm/second
//            Returns: Nothing

// :F+#       Move focuser in (toward objective)
//            Returns: Nothing

// :F-#       Move focuser out (away from objective)
//            Returns: Nothing

// :FG#       Get focuser current position (in microns or steps)
//            Returns: sn#

// :FR[sn]#   Set focuser target position relative (in microns or steps)
//            Returns: Nothing

// :FS[n]#    Set focuser target position (in microns or steps)
//            Return: 0 on failure
//                    1 on success

// :FZ#       Set focuser position as zero
//            Returns: Nothing

// :FH#       Set focuser position as half-travel
//            Returns: Nothing

// :Fh#       Set focuser target position at half-travel
//            Returns: Nothing