584,863 active members*
5,010 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Spindle PWM, issues changing PWM prescale, X-axis "rings"!
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2016
    Posts
    1

    Spindle PWM, issues changing PWM prescale, X-axis "rings"!

    I have a somewhat hacked K2CNC (3-axis, 2x3ft, 2.2kWspindle) system, could not figure out how to get the 0-10V analog spindle control signal out of their breakout board, so I worked around it with a standalone PWM-to-Analog board, attempting to use pin33(PWM7) to generate a 1-3kHz 3.3V PWM signal, converting it to 0-10V analog for the spindle VFD. That works great, spindlepwm.c does what it needs to do and I can control spindle RPM from Gcode.

    So... This all worked fine with no axis plugged in. With the axes plugged in, my X-axis "rings" as soon as I send an SXXXXX command, its a nice sharp and loud tone. The axis will move, but makes a pretty ugly noise in the process.

    With the standalone PWM->analog board completely removed from the system, I get the same result, its not a wiring issue, or is my logic here incorrect?

    If I comment out the scaler change line from spindlepwm.c, I dont get the ringing, but my PWM frequency is too high (I think?) and the board cannot detect the signal. So, in changing the prescale to get pin 33 to where I want it, something else is happening... not really sure where to go next.

    Questions:
    1. What could be causing X-axis to freak out? or what do I do next to troubleshoot?
    2. Any tips on learning more about FPGA() commands in use? Im a C novice and have not had luck in finding anything online that explains what this is doing to me, I dont know enough to really understand what the comments are trying to communicate, most of the FPGA() lines beyond "prescale" look like black boxes to me.
    3. Any workarounds? stepaspwm.c doesnt seem like it would work for me, and I would want to use it through one of the open IO pins not through an axis channel if possible...


    Thanks in advance!

    Here is my spindlepwm.c:

    #include "KMotionDef.h"


    #define MAX_RPM 18000.0f
    #define PWM_NUMBER 7 //0-7 pins 27-33
    #define pdSpindleRPM 35


    #define INVERT


    main()
    {
    int pwm;
    float speed = *(float *)&persist.UserData[pdSpindleRPM]; // value stored is actually a float

    pwm = speed/MAX_RPM * 255.0f;

    if (pwm > 255) pwm=255; // limit to max pwm value
    if (pwm < 85) pwm=0; // limit to min pwm value


    #ifndef INVERT
    pwm = 255 - pwm; // set the PWM


    #endif


    //pwm = 128;//165-175

    printf("Spindle Set to %f pwm %d\n",speed, pwm); // print the desired speed
    SetBitDirection(26+PWM_NUMBER,1); // Set bit PWM pin as an output
    FPGA(IO_PWMS_PRESCALE) = 33; // PWM approx 1 KHz
    FPGA(IO_PWMS+2*PWM_NUMBER+1) = 1; // enable the PWM
    FPGA(IO_PWMS+2*PWM_NUMBER) = pwm; // set the PWM
    }

  2. #2
    Join Date
    May 2006
    Posts
    4043

    Re: Spindle PWM, issues changing PWM prescale, X-axis "rings"!

    Hi durbs,

    I think K2CNC is probably using PWMs to drive their bridge drivers for your servo motors. KFLOP only has one Prescaler to set the frequency for all 8 PWM channels. The bridge drivers probably need a high frequency such as 20KHz to work properly (and above our hearing range). When you change the frequency to 1KHz they have problems.

    You might want to get a different module that can accept Step/Dir signals and use a spare Step/Dir output.

    Or figure out how to get the K2CNC converter you have to work.

    HTH
    Regards
    TK
    http://dynomotion.com

Similar Threads

  1. Replies: 17
    Last Post: 02-22-2014, 06:58 PM
  2. X Axis "Goes Off Pattern", "Awry", "Skewed", "Travels"
    By DaDaDaddio in forum Laser Engraving / Cutting Machine General Topics
    Replies: 1
    Last Post: 05-06-2013, 09:59 AM
  3. RFQ: Stainless Steel rings 2" OD 1.5" ID
    By bobber bill in forum RFQ (Request for Quote)
    Replies: 1
    Last Post: 06-18-2011, 08:27 PM
  4. Small batch of Acrylic 80mm-diameter "rings" needed
    By theorie in forum Employment Opportunity
    Replies: 8
    Last Post: 03-02-2011, 09:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •