Closed rlwoodjr closed 5 years ago
Here is my add to the CPU_MAP file.
`#ifdef CPU_MAP_2560_BOBSCNC // (Arduino Mega 2560) FOR KL7 SERIES BobsCNC
// Serial port interrupt vectors
// Define ports and pins
// Define step pulse output pins.
// Define step direction output pins.
// Define stepper driver enable/disable output pin.
// Define homing/hard limit switch input pins and limit interrupt vectors.
// #define LIMIT_INT PCIE0 // Pin change interrupt enable pin // #define LIMIT_INT_vect PCINT0_vect // #define LIMIT_PCMSK PCMSK0 // Pin change interrupt register // #define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
// Define spindle enable and spindle direction output pins.
// Define flood and mist coolant enable output pins.
// Define user-control CONTROLs (cycle start, reset, feed hold) input pins. // NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
// Define probe switch input pin.
// Advanced Configuration Below You should not need to touch these variables // Set Timer up to use TIMER4B which is attached to Digital Pin 8 - Ramps 1.4 12v output with heat sink
//Control Digital Pin 6 which is Servo 2 signal pin on Ramps 1.4 board
// 1/8 Prescaler, 16-bit Fast PWM mode
// Define spindle output pins.
Hey @rlwoodjr, I don't really understand what you're up to, but I don't think that changing the port makes any difference, unless you change the code itself… Cheers Raphael
Please use the "Insert code" button ("<>") for inserting code. 😎
Hello @RaphaelDives, thanks for the reply.
My thought is if all the step pins were on the same port, then it would save a clock cycle or two. each step signal. In the CPU_MAP.h it states:
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
Hi @rlwoodjr,
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
The comment you talk about is for non RAMP mapping. This constraint was from original grbl-Mega before the RAMP version. The RAMP version add new pin definition method wich freed this constraint. It just affect the pin definition, the step pulse are sended by the same interrupt handler routine, independently of the pin definition. You can found more info about the max step frequency of GRBL here : (https://github.com/grbl/grbl/issues/41)
@++;
Gauthier.
Hello @fra589
It might be interesting to note that the grbl1.1e on the Uno will run 36kHz max step frequency. I can run the Mega code at 23 kHz max step frequency. Not sure if it is the added axes or if it is something I am doing wrong, but 750 inches per minute (23kHz) is top speed.
Here is a video link of the CNC moving 1200 inches per minute. https://www.youtube.com/watch?v=0lUSA1DxqGQ
Hi @rlwoodjr, See also in the stepper.c file, the max step frequency ans speed limitation are explained in comments... Sure, the added axis also add computing cycles CPU, but I can't explain myself the big difference you have. Perhaps you can search in the stepper.c file where to optimize the pulse frequency? @++; Gauthier.
Hi @fra589 Thanks for the information.
I am not very good at programming but I did edit the CPU_MAP in hopes to increase the jitter-free pulse generation frequency. The pin changes seem t work, but sadly it did not seem to help.
Should any of the pins or ports be off limits? Or does it not help to have these on the same port?
Description | D Pin | Pin | Address X1 step | D24 | 24 | A2 Y step | D25 | 25 | A3 Z step | D26 | 26 | A4 X2 Step | D27 | 27 | A5 A Step | D28 | 28 | A6 B Step | D29 | 29 | A7 X1 direction | D30 | 30 | C7 Y direction | D31 | 31 | C6 Z direction | D32 | 32 | C5 X2 direction | D33 | 33 | C4 A Direction | D34 | 34 | C3 B direction | D35 | 35 | C2 X1 enable | D44 | 44 | L5 Y enable | D45 | 45 | L4 Z enable | D46 | 46 | L3 X2 enable | D47 | 47 | L2 A enable | D48 | 48 | L1 B enable | D49 | 49 | L0 Spindle enable | D4 | 4 | G5 Spindle direction | D5 | 5 | E3 Spindle PWM | D8 | 8 | H5 Coolant mist | D9 | 9 | H6 Coolant flood | D6 | 6 | B4 X1 Max | A0 | 54 | F0 X1 Min | A1 | 55 | F1 Y Max | A2 | 56 | F2 Y Min | A3 | 57 | F3 Z Max | A4 | 58 | F4 Z Min | A5 | 59 | F5 X2 Max | A6 | 60 | F6 X2 Min | A7 | 61 | F7 A Max | D10 | 10 | B4 A Min | D11 | 11 | B5 B Max | D12 | 12 | B6 B Min | D13 | 13 | B7 Probe | A15 | 69 | K7 Reset switch (soft reset) | A9 | 63 | K1 Feed hold | A10 | 64 | K2 Cycle start | A11 | 65 | K3 Safety door | A12 | 66 | K4