Need Help! K2cnc spindle stopped for KG-4925 - Page 2


Page 2 of 8 FirstFirst 12345 ... LastLast
Results 21 to 40 of 158

Thread: K2cnc spindle stopped for KG-4925

  1. #21
    Member
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    355
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Quote Originally Posted by Rob505 View Post
    m_c,

    Thank you for your reply. I'm starting to get a better picture as to how to understand the Cprogram tab. So, flash "User Memory" is just used by K2? If I understand it correctly, most Dynomotion users only need to "compile/download" in Cprograms but K2 users need to also open the "Config/flash" tab and apply the "User Memory" flash button.

    Flash User Memory can be used by anyone, but it's generally not recommended for 'normal' use.
    Another way to think of it, is rather than whatever software you're using compiling/downloading each C/user program as the software requires it i.e. like when using KMotionCNC and you hit the Init button, the relevant init.c file is compiled/downloaded and run in the KFlop, the C/user program is physically stored within the KFlop and can either be set to run immediately when the KFlop is powered up, or just stored ready to be run as soon as the controlling software requests it.

    Storing the programs within the KFlop does reduce data transfer between the PC and KFlop, but for normal use, it's not noticeable by the operator. The functionality was aimed more at users who wanted to embed the KFlop within machines that ran standalone (i.e. without being attached to a computer), such as a machine that does repetitive tasks where the actual programming/required motion never changes.



  2. #22
    Member
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    355
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Quote Originally Posted by CNCMAN172 View Post
    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+2*PWM_NUMBER+1) = 1; // enable the PWM
    FPGA(IO_PWMS+2*PWM_NUMBER) = pwm; // set the PWM
    }

    This file seems to imply that PWM sign comes out of 26 + 5 = 31. If you look at bit 31 that should be changing. Tom can probably explain exactly where you can look for this signal. They use two commands to the FPGA to enable the PWM output.

    Tom can you detail how this works in more detail?

    Russ
    KMotionDef.h has the basic explanation, although Robert probably wants to ignore this to avoid any further confusion, as it's not really something that normal users need to worry about.
    Code:
    // Digital I/O bit PWM control (4 I/O bits 16-19 may be pulsed)
    
    #define N_IO_PWMS 4				// Number of pwms that may be assigned to GPIO bits		
    #define IO_PWMS 0x20  			// FPGA offset to IO PWM registers (2 bytes each - value, enable(bit0))
    #define IO_PWMS_PRESCALE 0x2f  	// FPGA offset to IO PWM Pre-Scale clock divider 0-255, 0 = 16.6MHz, 1=8.33MHz, ...
    #define IO_PWM_MAX_VALUE 255    // 0 = 0%, 255 = 100 % duty cycle
    Code:
    SetBitDirection(26+PWM_NUMBER,1);  		// Set bit PWM pin as an output
    Does what it says. Sets bit 31 aka Aux1 pin 11 aka PWM 5 as an output.

    Code:
    FPGA(IO_PWMS+2*PWM_NUMBER+1) = 1;    // enable the PWM
    FPGA(IO_PWMS+2*PWM_NUMBER) = pwm; 	// set the PWM
    As per the KMotionDef comment, IO_PWMS contains the offset to the PWM registers, which have 2 bytes per PWM. So the first line enables the PWM5, and the second line sets the PWM5 value.
    I'm guessing there are default settings for the Pre-scaler and max values, given they're not included within the K2 code.

    A crude way to test the output, which may or may not work depending on the multimeter, is to measure the DC voltage from the PWM. As the PWM increases, the voltage shown on the multimeter should increase. The accuracy of this depends on how much the multimeter smooths the input when on VDC, but I'd imagine the default PWM frequency should be high enough to give a reasonable reading on most multimeters.



  3. #23
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Thanks M_C,

    Robert as he shared you can measure the voltage between ground and AUX1 - Pin 11. This should have a PWM signal coming out that pin and the pulse width should vary when you issue various M3 S3000, M3 S6000, M3 S10000, type commands. This will make a small voltage change, but a much better way to see this would be to put an oscilloscope on that pin, then you could watch the pulse width actually change. Because of how the board is pressed into the KFLOP with those three connectors you might need to trace where the signal from AUX1 - PIN-11 comes up to the K2CNC breakout board. I know it will head over to the parts identified earlier near the spindle connector but a quick check with an ohm meter can confirm a good spot to test from while running those experiments.

    Russ



  4. #24
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Quote Originally Posted by m_c View Post
    Flash User Memory can be used by anyone, but it's generally not recommended for 'normal' use.
    Another way to think of it, is rather than whatever software you're using compiling/downloading each C/user program as the software requires it i.e. like when using KMotionCNC and you hit the Init button, the relevant init.c file is compiled/downloaded and run in the KFlop, the C/user program is physically stored within the KFlop and can either be set to run immediately when the KFlop is powered up, or just stored ready to be run as soon as the controlling software requests it.
    m-c,

    OK, so just so that I clear on this, what program files are being flashed into Flashed User Memory when you hit the button? Would it be everything compiled and downloaded from the Thread lines and into KFLOP? or just the Thread line(s) that are checked Launch on StartUp? or something else? I am still getting caught up on the rolls played by the "Init" button in KMotionCNC, C program Threads, and Flashed User Memory. It sounds like I could choose not to use the Flash User Memory option and use the "Init" button instead at start up. But then I would need to have that tab set up properly. The "Init" button does not seem to do anything.

    Some thing that I just seemed to notice.......Dynomotion's manual states:
    The integrated C compiler allows with a single pushbutton to save, compile, link, download, and execute all within a fraction of a second.
    This is the button with all the arrows pointing everywhere.
    This does not seem to work as I expect it to. I seem to have to use this button for each Thread individually.

    The good news is, when I compile all the Threads in this manner the "Home" function returns. I am beginning to feel that all my problems are related to figuring out exactly how to set up the Kmotion.exe, the KmotionCNC tool step up tab and which Threads should be downloaded and how to download them.

    Here are some questions that may help me better understand this system.
    1. Is what is flashed into User Memory and are the C programs Threads downloaded into the KFLOP the same thing?
    2.If I Flash New Version and re-flash the 4.32, will everything in the KFLOP's user memory be erased? Thus allowing me to load new Threads to the KFLOP.
    3.Is this the best way to erase Threads from the KFLOP? or should I use the Recovery button instead?
    4,When loading Threads does it matter which Thread number you use? I assume, yes.

    One last note, we have always seem to have some quirks in our system and I thought I would mention them just in case these things are related. When the machine moves an axis outside its limits, that axis stops working but the others continue. To engage the axis I have to cycle the KFLOP. Stopping the machine and restarting using the two green button doesn't work. Also, the Homing function stops working if the stop button (physical, computer screen or hot key) is used. I have just discovered that if I go back into Cprograms and re-compile the Homing thread, it works again. Also, we have a tool touch pad that we have never been able to operate but that is the least of my problems.

    One more step closer! and thank you all for your patience!
    Robert



  5. #25
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Quote Originally Posted by CNCMAN172 View Post
    Thanks M_C,

    Robert as he shared you can measure the voltage between ground and AUX1 - Pin 11. This should have a PWM signal coming out that pin and the pulse width should vary when you issue various M3 S3000, M3 S6000, M3 S10000, type commands. This will make a small voltage change, but a much better way to see this would be to put an oscilloscope on that pin, then you could watch the pulse width actually change. Because of how the board is pressed into the KFLOP with those three connectors you might need to trace where the signal from AUX1 - PIN-11 comes up to the K2CNC breakout board. I know it will head over to the parts identified earlier near the spindle connector but a quick check with an ohm meter can confirm a good spot to test from while running those experiments.

    Russ
    Hi Russ,

    I don't have an Oscilloscope but I do have an ohm meter. But I put everything back together the other day to start messing with the Threads. I am beginning to think how the Threads are loaded and other memory flashed may be the issue. After I feel that I've loaded the memory and programs correctly and if things still aren't working, then I will start to focus again on the hardware side of things. The spindle program seems to be in the files but I don't see it in the Threads. I see it referenced in the user tab setup in KMotionCNC but I'm not sure if my "Init" button works. or for that matter how any of that relates. So, I'm going to focus more on this part.

    Thanks,
    Robert



  6. #26
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    Keep in mind NOTHING has to be FLASHED in the KFLOP to get this stuff to work. If you have compiled the C programs and downloaded them into the KFLOP from a given thread they will run will called.

    Your screen shot on the Tool Setup tab shows the K2_M3.c file and the K2spindlePWM.c file both listed for thread 2. We already know the the M3 command is working you have already proven that fact. You probably just need to start up Kmotion.exe and examine each thread to make sure they are compiled and downloaded into KFLOP.

    You might want to do some screen shots inside of KMOTION not KmotionCNC and look at each thread one at a time. Especially thread 2.

    Don't get hung up on the flashing aspect until you know everything works manually.

    Russ



  7. #27
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    I understand you don't have an oscilloscope, but when you say you have an ohm meter I am assuming you mean a multimeter so you can also measure voltage. If that is the case you can at least see if you have a voltage on that AUX pin. First check that the C program is listed in KMOTION.exe in thread 2 and that it is compiled and downloaded. Then if you do all that you can start up kmotioncnc again and run the tests with M3 S8000 etc.

    Russ



  8. #28
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Russ,

    Keep in mind NOTHING has to be FLASHED in the KFLOP to get this stuff to work. If you have compiled the C programs and downloaded them into the KFLOP from a given thread they will run will called.
    OK. But I'm still not sure what should be in the Threads or the best way to clear the Threads to load new configurations like the one Tom suggested. I tried clearing by re-flashing the new version but I don't know if that is correct.

    Where do you think the spindle program should be located? Threads? or "Init" tab? or can they be in both? You mentioned screen shots of KMotion. Which ones may be helpful?

    Sorry, but I'm more used to working with things I can hammer.

    Robert



  9. #29
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Russ, I did not see this part of your post.

    Yes, I will locate the AUX pin and check it.

    First check that the C program is listed in KMOTION.exe in thread 2
    Yes, there is a program in thread 2. this is how it is listed at the top of the screen:

    #include "KMotionDef.h"
    // Defines axis 0, 1, 2 as simple step dir outputs
    // enables them
    // sets them as an xyz coordinate system for GCode

    And I have compiled and downloaded it.

    Robert



  10. #30
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    OK, how about a few basics to start. The threads all run at the same time, the best way to think about them is Round Robin. First thread 1 runs for a few milliseconds, then thread 2, then thread 3, etc. You DO NOT need to have anything in some threads. The reason it is setup this way is a method of multitasking, doing several things at the same time. While they are not really all at the same time from our perspective they are all happening so fast we think of them happening all at the same time.

    The Initialization tab or program is normally only called once, if you actual examine sample initialization programs they initialize key information and then they are done. In some cases the program is written to initialize key elements like the axis parameters, motors, etc. and some programmers actually have the program loop after these to handle things like MPG pendants, etc. Normal is you press the init button once when you first start, in the case of K2CNC they had that program flashed so it initialized automatically, again not a requirements.

    The homing function is normally on a separate thread, the spindle is on a separate thread, etc.

    How to you change what is on a given thread? Highlight all the text while in kmotion.exe on a given thread and press the delete key. The c code will disappear and you can paste in new code or load a file. Once you load the given file into a given thread you can compile that code and then after it compiles successfully you can download the compiled code into KFLOP where it can be executed. In KmotionCNC when you see a C program listed next to say a KEY function like S, it is telling you when you use an "S" command it will call that given program. When you press the "M3" or use it in a command it will call that C program listed, etc.

    Provide some screen shot of each thread using Kmotion.exe and we can guide you.

    Russ



  11. #31
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    Screenshot work better, but this looks like the beginning of the initialization code which does not seem to match watch has been populated in KmotionCNC, so that would example why the spindle commands are not working. Do a screenshot on each thread and we can get you fixed.

    Russ


    Yes, there is a program in thread 2. this is how it is listed at the top of the screen:

    #include "KMotionDef.h"
    // Defines axis 0, 1, 2 as simple step dir outputs
    // enables them
    // sets them as an xyz coordinate system for GCode

    And I have compiled and downloaded it.

    Robert



  12. #32
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Thanks Russ.



  13. #33
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Quote Originally Posted by CNCMAN172 View Post
    Thanks M_C,

    Robert as he shared you can measure the voltage between ground and AUX1 - Pin 11. This should have a PWM signal coming out that pin and the pulse width should vary when you issue various M3 S3000, M3 S6000, M3 S10000, type commands. This will make a small voltage change, but a much better way to see this would be to put an oscilloscope on that pin, then you could watch the pulse width actually change. Because of how the board is pressed into the KFLOP with those three connectors you might need to trace where the signal from AUX1 - PIN-11 comes up to the K2CNC breakout board. I know it will head over to the parts identified earlier near the spindle connector but a quick check with an ohm meter can confirm a good spot to test from while running those experiments.

    Russ
    Hi Russ,

    I've been working on some of the things that you had mentioned. So, I found where the AUX1-Pin 11 joins the K2 breakout board and made my measurements directly from there. If you think that I need to trace it to where the spindle wires attach I can do the test again. The results yield no changes in DCV when the S number is changed 3000/6000/10000. I'm getting -.5 DCV. Even if I turn off BIT 31 it still reads -.5 DCV. If I reverse the testing probes I will get +.5 DCV


    This file seems to imply that PWM sign comes out of 26 + 5 = 31. If you look at bit 31 that should be changing. Tom can probably explain exactly where you can look for this signal. They use two commands to the FPGA to enable the PWM output.
    I also, watched the I/O Bits to see what happens when I activated/pushed the screen buttons. BIT 31 OutPut and State boxes start out unchecked.
    BIT 34 OutPut box is checked at power up and the State Box Checks on with "M3" and unchecks with "M5" and "OFF" buttons.
    Results:
    "M4" button checks BIT 31 OutPut and State Boxes but leaves Bit 34 State box unchecked.
    "ON CW" button checks BIT 31 OutPut and State boxes and also checks BIT 34 State box.
    Once the boxes of BIT 31 are activated the stay activated. The only box that can be unchecked through KMotionCNC is BIT 34 State box using "M5" or "OFF" button.

    Robert



  14. #34
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    The voltage on a PWM signal is a little tricky. Keep in mind the PWM signal is a square type wave, meaning it has a voltage that turns on and off very quickly. This pulse train never ends, the width of the pulse is controlled by software. I would have expected that voltage to be closer to 2.5 to 3VDC. This seems to point back to the thought that the program that controls that signal is not running correctly.

    If you look in kmotion.ext you should find one thread the the program K2_SpindlePWM.c. KmotionCNC expected that to be in thread 2. You can see the entire program listed below. Check all the threads and see if this program is listed anywhere when using kmotion.exe. The initialization program should also be in a thread and you can look in the C programs to see the name but if you do some screen shots we can pin point your issue.

    Russ




    K2_SpindlePWM.c File


    #include "KMotionDef.h"

    #define MAX_RPM 18000.0f
    #define PWM_NUMBER 5 //0-7
    #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
    #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+2*PWM_NUMBER+1) = 1; // enable the PWM
    FPGA(IO_PWMS+2*PWM_NUMBER) = pwm; // set the PWM
    }



  15. #35
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Quote Originally Posted by CNCMAN172 View Post
    If you look in kmotion.ext you should find one thread the the program K2_SpindlePWM.c. KmotionCNC expected that to be in thread 2. You can see the entire program listed below. Check all the threads and see if this program is listed anywhere when using kmotion.exe. The initialization program should also be in a thread and you can look in the C programs to see the name but if you do some screen shots we can pin point your issue.
    Russ,

    I took some screen shots. See attached. It doesn't look like the spindle program is in the threads. Also, you will notice that the init.c program in listed in thread 6 and 7.

    Robert

    Attached Files Attached Files


  16. #36
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    Thanks for the screenshots, I have a two hour meeting this afternoon, but will investigate this issue. You are correct the Spindle PWM program is not in any of the threads. I need to look at the ones listed to see if any of those call these routines. This would be my guess that they are no longer loaded. These were probably initially flashed and when you upgrade they got killed. More to follow... Thanks

    Russ



  17. #37
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Tom,

    Regarding your question, I'm starting to get a better understanding on how to clear Threads and load new ones. I tried the configuration you had suggested but it did not seem to change anything.

    In my effort to better understand the KMotion.exe I'm hoping you can shed some light on some questions.
    In the CProgram screen there is a "New" button. When do you use this? If I press it it states that it will overwrite something. What does that mean? Overwrite what I see on the screen or overwrite the program in the computer files?

    Also, I've noticed that if I highlighted and deleted anything that is on the CProgram Threads screen, it not only clears the screen it also clears program from the computer file location. The name of the file is still listed but it contains no coding. Why is that? Normal?

    One more question. Do you know if K2 flashed into memory any of the other Threads besides the K2mc_driver.c?

    Thanks,
    Robert


    Quote Originally Posted by TomKerekes View Post
    Hi Robert,

    From K2CNC's comment in:

    \KFLOP rob505\KFLOP\Driver\k2mc_driver.c

    It seems they are expecting this arrangement of User Programs being Flashed in KFLOP.

    //----------------------------------------------------------------
    // KFLOP Initialize program
    // K2CNC - Copyright 2013
    // Version: 2.0.4
    //
    // - K2mc_driver.c -> Thread 6
    // - homing.c -> Thread 5
    // - toolchange.c -> Thread 4
    // - bitJog_sLimit.c -> Thread 1

    Have you tried that?

    You should realize that the programs loaded and shown in the KMotion.exe Threads are not necessarily the Programs actually downloaded or Flashed into KFLOP.

    Regards




  18. #38
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    I have looked at all the files you included in the KFLOP_Rob505.zip. The interesting thing is there are far more C programs than you have threads. I did not find an include file that might have added several C programs into a given thread. Tom will probably need to comment on how this is accomplished. The file "bitlog_slimit.c does check the spindle speed to see it it is spinning prior to tool changes. Thread #2 is the initialization thread initstepdir3axis.c, thread #4 is the tool changer, #5 is the homing routines, #6 is the drivers. Also looking at some of the header files it seems to suggest they are indeed using one of the servo motor channels to control the spindle, please check the settings in the fifth channel, thing they start as channel 0,1,2,3,4,5, so the number would probably be #4. You can see this in Kmotion.exe. Will need to study this in more detail, to understand exactly how they got all this stuff to work.

    Russ



  19. #39
    Registered
    Join Date
    Jul 2015
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Russ,

    I wonder why the tool changer thread is listed. We don't have a tool changer.

    I checked the axis screen and it looks as though only 0-3 have positions listed but 0-5 are checked as enabled. I took some screen shots. I uploaded each channels configuration and 4 is the same as 0-3 except for the output channel number.

    Robert

    Attached Files Attached Files


  20. #40
    Member
    Join Date
    Jun 2005
    Location
    USA
    Posts
    1723
    Downloads
    0
    Uploads
    0

    Default Re: K2cnc spindle stopped for KG-4925

    Robert,

    Each channel is setup to have a motor, so they are not using any channel to handle the PWM at all. Do you just have a three axis machine or do you also have a 4th axis which is rotary?

    Russ



Page 2 of 8 FirstFirst 12345 ... LastLast

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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

K2cnc spindle stopped for KG-4925

K2cnc spindle stopped for KG-4925