Shop OBEX P1 Docs P2 Docs Learn Events
L6470 Microstepper (128 step) sample Forth code - Page 3 — Parallax Forums

L6470 Microstepper (128 step) sample Forth code

13»

Comments

  • Greg NuspelGreg Nuspel Posts: 1
    edited 2012-10-16 15:45
    Peter I'd love to buy three where do I send the money?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-10-16 16:27
    Peter I'd love to buy three where do I send the money?
    Like many people of this forum we love to play but with juggling many jobs and projects at the same time and "real work" some little things don't get the attention they need. I finally finally got around to getting a batch of these made as I mentioned so just email me with your details and I will get back to you with a PayPal invoice including shipping costs (normally $10 by airmail).
    Ditto for anyone who has been waiting in the past and if you are still interested.
  • idbruceidbruce Posts: 6,197
    edited 2012-10-27 04:18
    Hey Peter

    Here is some information that may interest you. If you are already aware of it, then sorry: Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-11-21 19:25
    Peter

    What is the smallest step angle you have tested these drivers wit?

    Bruce
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-21 22:50
    idbruce wrote: »
    Peter

    What is the smallest step angle you have tested these drivers wit?

    Bruce
    I normally use the microstep for smooth stepping but the only real way to try this I guess is to setup some sort of linear actuator. I do have some inkjet printer mechanisms I could try it out on. BTW, I've ordered the only high-current L6480 eval board I've seen available from any supplier and that was from Mouser, should be here Monday!. Eight week lead-time now.
  • TonyDTonyD Posts: 210
    edited 2012-11-22 02:47
    ...
    Oh, and for anyone who might be waiting on some of these modules sorry but please give me a nudge, I've been way too distracted to catch-up and ship these modules off. I do have plenty of stock so if anyone wants to purchase them I am happy to sell the L6470 modules to forum members for $29 USD each + $10 airmail.

    Hi Peter, have you any L6470 modules left or just blank PCB's which would be better for me?
  • idbruceidbruce Posts: 6,197
    edited 2012-11-22 03:39
    Peter

    I won't give you too hard a time :), because I know you know this and you must have had something else on your mind :) Perhaps a woman. Yep, that would explain it :)

    I normally use stepper motors with a 1.8 degree step angle (200 full steps per revolution), but I am currently thinking of a rotary actuator application, in which the distance between the angles become larger as the diameter grows. For instance, with the combination of a Gecko G251X and a stepper motor having a 1.8 degree step angle, I get a resolution of 2000 uSteps per revolution ( 0.18 degree step angle). Now if I mount a 5" diameter disc to a stepper motor with a 2000 uStep resolution, as the step angles extend outward from the center of the motor shaft to the outer circumferance of the disc, I will get a distance of 0.0078539816339744825" between angles as measured around the circumference. Of course this distance is too large for high accuracy applications, so I need to break this distance down as economically as possible, and there are several ways to accomplish this.
    • Use a stepper motor with higher resolution (e.g. 0.9 degree step angle, 0.45 degree step angle, etc...)
    • Use a stepper driver with higher resolution
    • Gear reduction
    • Pulley reduction
    • Or a combination of the above
    Lin Engineering makes a stepper with a 0.45 degree step angle, and ebay has several available with a shaft attachment (http://www.ebay.com/itm/Lin-Engineering-5704-High-Accuracy-High-Torque-Stepper-Motor-CUI-Encoder-/160913429393?pt=LH_DefaultDomain_0&hash=item2577301391&ssPageName=RSS:B:SHOP:US:101). If I use one of these motors in combination with the G251X, I will get a resolution of 8000 uSteps per revolution, as compared to the 2000 uSteps when using a stepper motor with a 1.8 degree step angle. This type of setup would give me a distance of 0.001963495408493620625" between angles as measured around the circumference. Of course, this is now much more accurate than the 0.0078539816339744825" that I previously stated. However, when rounded, that is still 0.002" between angles, and that is still a bit to large for me.

    As you might have guessed, the idea of pulley or gear reduction doesn't quite appeal to me, because then the mechanical aspect of my project gets more complicated.

    Now let's look at a combination of a 1.8 degree step angle along with a L6470 stepper driver in comparison, with the same 5" diameter disc. Since the L6470 has the potential of 128 uSteps per full step, this equates to 25,600 uSteps in conjunction with a stepper motor having a 1.8 degree step angle. When applying this to the 5" diameter circle, this gives a distance of 0.0006135923151542564453125" between angles as measured around the circumference. Well now..... that certainly is in the realm of acceptability. However, if I remember correctly, these stepper drivers are a bit more difficult to control, then simply setting the direction and sending a pulse.

    Is FORTH the only driver you have available, or do you also have SPIN code?

    I think you will do well with the L6480, because of the operating amperage and voltage, but I also think it will have to be easy to setup and run. I know there are a lot of options available, but I think if you could get the chip to operate in a basic fashion with simple direction, enable, and step, I believe it would sell much easier than trying to provide all the options, which make it more complicated to use. Just my opinion.

    I will have to take a look at your documentation again to see how your drivers would work out for me.

    Bruce
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-22 04:50
    TonyD wrote: »
    Hi Peter, have you any L6470 modules left or just blank PCB's which would be better for me?
    I have both ready to go, just let me know which and just PM me your details, I can send them off tomorrow.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-22 05:03
    idbruce wrote: »
    Peter


    Now let's look at a combination of a 1.8 degree step angle along with a L6470 stepper driver in comparison, with the same 5" diameter disc. Since the L6470 has the potential of 128 uSteps per full step, this equates to 25,600 uSteps in conjunction with a stepper motor having a 1.8 degree step angle. When applying this to the 5" diameter circle, this gives a distance of 0.0006135923151542564453125" between angles as measured around the circumference. Well now..... that certainly is in the realm of acceptability. However, if I remember correctly, these stepper drivers are a bit more difficult to control, then simply setting the direction and sending a pulse.

    Is FORTH the only driver you have available, or do you also have SPIN code?

    I think you will do well with the L6480, because of the operating amperage and voltage, but I also think it will have to be easy to setup and run. I know there are a lot of options available, but I think if you could get the chip to operate in a basic fashion with simple direction, enable, and step, I believe it would sell much easier than trying to provide all the options, which make it more complicated to use. Just my opinion.

    I will have to take a look at your documentation again to see how your drivers would work out for me.

    Bruce

    There's no problem running this in step clock mode where the Prop supplies the step clock and any other parameters including direction are sent via SPI. There's nothing really complicated about that and I am using that mode in one of my designs. A lot of the Forth code I did is made up of useful references and diagnostic words which may not be of any use in a running program but sure is useful in getting it running. Some of the other register settings are for over-current and step modes and frequencies etc whereas there are quite a few registers just to set the optional self-stepping modes for acceleration etc.

    So you can just view it as a simple chip if you like but with lots of extra little "dip switches" and "trim pots" accessible via SPI.

    Since I'm sending off some stuff tomorrow how about I send you a board to play with.
  • TonyDTonyD Posts: 210
    edited 2012-11-23 03:05
    I have both ready to go, just let me know which and just PM me your details, I can send them off tomorrow.
    Hi Peter, I've PM you.
  • MonotobaMonotoba Posts: 9
    edited 2013-01-03 06:40
    Has anyone here used the ST L6474?

    I am working up a 6 axis stepper controller board design using it. I plan on building the board to operate in two modes. A basic mode that will allow Mach3 to apply the step and direction signals to the L6474 and a more advanced mode that will allow control over USB.

    I have considered incorporating MODBUS as well. I am not sure if MODBUS works well for stepper motor control or not. It seem to slow to me... However, it would be very useful for other I/O devices. Anyone have an opinion on using MODBUS for stepper motor control on multi-axis CNC machines?

    Thanks for the feedback
  • propelliflypropellifly Posts: 25
    edited 2013-07-11 13:24
    @Peter I've picked up an EVAL6470PD kit from ST so I can evaluate it for a low-cost stepper controller board. I am currently not using my propeller chip and am using an mbed board since I am more familiar with it. Figured I should first learn how to operate the L6470 first. :)

    In any case, I started with simple functions to read and write 8, 16, and 24 bit parameters from/to the L6470, and as far as I can tell my functions are working properly. For example, I started by resetting the chip, confirming that the FLAG output is asserted, then sent GetStatus and confirmed that this clears the FLAG output. Likewise, I read the default values for parameters like ACC, KVAL_RUN, and ABS_POS after reset and they matched up.

    Feeling pretty good with my progress, I started to move my motor (Lin Engineering 4218L-01-11) and that's where things fell apart. I know my motor works fine because I have hooked it up to two other motion controllers and they had no problems driving the mechanical system (and in fact right now I've disconnected the load). I got paranoid and even tried swapping A1/A2 and B1/B2 and all permutations within those pairs, and got the same result.

    The issue is that I'm getting an overcurrent error, regardless of my setting for OCD_TH. The motor can handle 2A and I've even set the L6470 to 6A, and I still get an OCD error. I am using the RUN command, and have tried very low values for ACC and SPD, to no avail.

    I was hoping that you or any others on this forum with L6470 experience could offer me some debugging tips or strategies? Thank you!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-07-11 22:01
    @Peter I've picked up an EVAL6470PD kit from ST so I can evaluate it for a low-cost stepper controller board. I am currently not using my propeller chip and am using an mbed board since I am more familiar with it. Figured I should first learn how to operate the L6470 first. :)

    In any case, I started with simple functions to read and write 8, 16, and 24 bit parameters from/to the L6470, and as far as I can tell my functions are working properly. For example, I started by resetting the chip, confirming that the FLAG output is asserted, then sent GetStatus and confirmed that this clears the FLAG output. Likewise, I read the default values for parameters like ACC, KVAL_RUN, and ABS_POS after reset and they matched up.

    Feeling pretty good with my progress, I started to move my motor (Lin Engineering 4218L-01-11) and that's where things fell apart. I know my motor works fine because I have hooked it up to two other motion controllers and they had no problems driving the mechanical system (and in fact right now I've disconnected the load). I got paranoid and even tried swapping A1/A2 and B1/B2 and all permutations within those pairs, and got the same result.

    The issue is that I'm getting an overcurrent error, regardless of my setting for OCD_TH. The motor can handle 2A and I've even set the L6470 to 6A, and I still get an OCD error. I am using the RUN command, and have tried very low values for ACC and SPD, to no avail.

    I was hoping that you or any others on this forum with L6470 experience could offer me some debugging tips or strategies? Thank you!

    Well I manage to match the motor by interacting with it through Tachyon. Have you tried tweaking the PWM frequency itself? I just sit at the console and change a parameter and test it out interactively otherwise you are stuck in a guess-edit-compile-download&wonder cycle.
  • D.PD.P Posts: 790
    edited 2013-07-12 09:38
    If you join the Tachyon thread, grab your prop, download the latest Tachyon and bring up a terminal you can work this this chip as if you had an in circuit debugger and much more. I just got a very flakey touch screen async driver working doing exactly what Peter described. Beware FORTH-ish programming ahead, very addicting.
  • propelliflypropellifly Posts: 25
    edited 2013-07-15 09:34
    I haven't tried to mess with the PWM frequency. Thanks for the tip -- I just wasn't sure where to start. I'll give that a shot!
  • propelliflypropellifly Posts: 25
    edited 2013-07-15 09:35
    D.P wrote: »
    If you join the Tachyon thread, grab your prop, download the latest Tachyon and bring up a terminal you can work this this chip as if you had an in circuit debugger and much more. I just got a very flakey touch screen async driver working doing exactly what Peter described. Beware FORTH-ish programming ahead, very addicting.

    I'll check it out soon! Need to find my quickstart board. :) I remember really liking FORTH in school for debugging hardware, but it's been a very long time for me.
  • propelliflypropellifly Posts: 25
    edited 2013-07-17 10:12
    Well I manage to match the motor by interacting with it through Tachyon. Have you tried tweaking the PWM frequency itself? I just sit at the console and change a parameter and test it out interactively otherwise you are stuck in a guess-edit-compile-download&wonder cycle.

    Peter, on my board I am running two loops -- the outer one increments F_PWM_INT from 0 to 7, and the inner increments F_PWM_DEC from 0 to 7. I get a status of 0x4E03 (lost steps and OCD) regardless of the setting. Is there a chance that my board is just bad? Can you recommend anything else to try when I modify the PWM frequency?

    EDIT -- I have just tried to use the Move(DIR, N_STEP) command and it seems to get the motor going. I have also tried using the step input pin, and when I do that I get a status of 0x8E03 (stall + OCD) after the first step. This just doesn't seem right -- why would I get those errors from pulsing the step input line?
  • rylangraystonrylangrayston Posts: 1
    edited 2013-07-29 00:05
    // there has been alot of discussion as to where or not you can use the L6470 driver
    // for milling machines and many other purposes where 2 or more motors
    // need to be synchronized as well as have dynamically assigned speeds.
    // the problem is there is no clear/actual way to change the speed register wile the motor
    //is running, some have suggested to just use the L6470 in step at a time mode
    // but I feel this is a waste of allot of great features ie stall detection.
    // So without further adue here is a solution ( sorry this is code from an arduion
    but it shuld get the point across)
    void loop()
    {
      // 200 steps is one revolution on a 1.8 deg/step motor.
      dSPIN_Move(FWD, 40);
      while (digitalRead(dSPIN_BUSYN) == LOW);  // wait Until the movement completes, the
      dSPIN_SetParam(dSPIN_MAX_SPEED, MaxSpdCalc(max_speed_rise)); 
      max_speed_rise += acceleration_rate; 
      if (max_speed_rise > 100){
        acceleration_rate = -1;
        
      }
      if (max_speed_rise < 1){
        acceleration_rate = 1;
        delay (1000);
      }
    
    }
    


    if you run this you will see that the stepper s acceleration
    //is nice and smooth while still being controlled dynamicaly ( wile the motor is
    // running ) It is a very simple work around ...

    In truth the motors speed is changing inbetween move commands,

    but this is happening so often that it is very smooth!


    // now the comes the part thats not done yet ... daisy chaining,
    // using the method dynamic speed method combined with daisy chaining
    // one more thing ... load all the bits but one on the daisy chain while the
    // motor is finishing the previous command then using an interrupt as soon as
    // the L6470 busy pins are all low load the last bit in the daisy ..
    // this should reduce any delays that could cause motor noise!


    again this code is from an arduino but I hope it is helpful here ..

    Shoot me a message if you improve on it, or the methods iv spoken of.

    Some links to my project related to this post

    https://github.com/Rylangrayston/arduino-blend/tree/Daisy-L6470

    http://www.blenderartists.org/forum/showthread.php?298691-working-blender-motion-control-camera-rig!-Suzans-Dolly

    http://rylangrayston.github.io/arduino-blend/
Sign In or Register to comment.