Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laser head is slowing down during rastering #14

Open
drom89 opened this issue Nov 26, 2021 · 33 comments
Open

Laser head is slowing down during rastering #14

drom89 opened this issue Nov 26, 2021 · 33 comments

Comments

@drom89
Copy link

drom89 commented Nov 26, 2021

Hi,

another "problem" when engraving/rastering with higher speeds the laser head is slowing down considerably, is this normal ?
I thought that laser head should be running with consistent speed and only change the power of the laser.

See video below
https://photos.app.goo.gl/U3dMczxaXWyc69ma8

@terjeio
Copy link
Contributor

terjeio commented Nov 26, 2021

Yes, it is normal because lots of short movements causes the planner buffer to limit the feed rate. Try with a larger planner buffer. Each entry requires around 40 bytes of RAM.

FYI the iMXRT1062 driver, which has a 600MHz processor with FPU and plenty of RAM, can be tuned to feedrates > 50.000 mm/min for laser engraving.

Some info here and here.

@drom89
Copy link
Author

drom89 commented Dec 3, 2021

So i boosted the planner buffer from 36 to 180.
Im using lightburn and with synchronous transfer mode its still almost same.
With buffered mode its ok but only like 10 sec and after that laser head stop moving and just fire in place.

I think USB communication is too slow...
Is there any way to boost USB baud rate from default 115200 to higher ?

@terjeio
Copy link
Contributor

terjeio commented Dec 3, 2021

zip and attach a file that shows the symptom to acomment so I can check here.

Is there any way to boost USB baud rate from default 115200 to higher ?

Which board map are you using?

@drom89
Copy link
Author

drom89 commented Dec 3, 2021

SKR 1.4 Turbo board.
Tomorrow i will record video.

@drom89
Copy link
Author

drom89 commented Dec 3, 2021

When trying to go with 200 buffer size i run our of memory.
laser error

@terjeio
Copy link
Contributor

terjeio commented Dec 3, 2021

Tomorrow i will record video.

I do not need one, I would rather have a file showing the symptoms so I have something to test with.

When trying to go with 200 buffer size i run our of memory.

Not much I can do about that, it is an old processor with limited RAM. I do not know if the AHB region can be made accessible by tweaking the linker script, you can look into that? And perhaps it is not something that will gain you any speed - there is no FPU (floating point unit) in this processor so too many entries in the buffer may start to slow it down instead.

Can you run a program in Check mode and time that? That will give you the raw transfer speed. With a native USB connection (IIRC the SKR 1.4 uses that) the configured speed does not matter, AFAIK the max speed available will be used anyway. At least it is for the iMXRT1062 driver.

@drom89
Copy link
Author

drom89 commented Dec 3, 2021

Tomorrow i will record video.

I do not need one, I would rather have a file showing the symptoms so I have something to test with.

Do you want G code file ?

When trying to go with 200 buffer size i run our of memory.

Not much I can do about that, it is an old processor with limited RAM. I do not know if the AHB region can be made accessible by tweaking the linker script, you can look into that? And perhaps it is not something that will gain you any speed - there is no FPU (floating point unit) in this processor so too many entries in the buffer may start to slow it down instead.

What boards do you recommend performance/cost wise ? For lasers, cnc mills etc.

Can you run a program in Check mode and time that? That will give you the raw transfer speed. With a native USB connection (IIRC the SKR 1.4 uses that) the configured speed does not matter, AFAIK the max speed available will be used anyway. At least it is for the iMXRT1062 driver.

How can i run it in Check mode ?

@terjeio
Copy link
Contributor

terjeio commented Dec 3, 2021

Do you want G code file ?

Yes please.

What boards do you recommend performance/cost wise ? For lasers, cnc mills etc.

That is a hard one to answer - the iMXRT1062 (Teensy 4) driver and board is the fastest and most expandable you can get but needs external drivers as there is currently no boards available for Polulu style drivers. A processor with FPU is IMO preferable, but the Pi Pico is interesting due to its PIO peripherals. I have not checked what its limits are though. More info here. BTT SKR Pro 1.1/1.2 boards will hopefully soon be programmable via SD card - I had a breaktrough yesterday with a dev board that brings that closer.

How can i run it in Check mode ?

By sending $C before starting. Some senders has a button or a checkbox for enabling Check mode.

@drom89
Copy link
Author

drom89 commented Dec 3, 2021

Ok thanks, i will test it tomorrow and send the files.

@drom89
Copy link
Author

drom89 commented Dec 5, 2021

files are here: gcode foto.zip

@terjeio
Copy link
Contributor

terjeio commented Dec 5, 2021

I have tested the largest file (grey scale engraving) with ioSender, aggressive buffering enabled.

150 steps/mm, max speed 25000mm/min, acceleration 1000 mm/sec2

iMXRT1062 (Teensy 4) controller, planner buffer set to 1000:

  • Check mode streaming: 1:53, from SD card 0:11 (uses DMA).
  • Run: 11:02, I've seen momentary feed rates above 17000mm/min.

LPC176x with BTT SKR 1.3 controller, planner buffer set to 150:

  • Check mode streaming: 1:54, SD card not checked.
  • Run: I've seen a few momentary feed rates above 10000mm/min, I canceled the job at 40:00 due to the pauses (see below).

There was several pauses during the run, the job restarted by itself after a little while (a little less than 3 minutes). This is likely due to missed stepper interrupts causing the 32 bit timer used to not firing a new until the next wrap around. The timer runs at 24MHz so that matches well with 3 minutes. Most of these were at the end of the job.

After increasing the stepper interrupt priority, lowering the USB priority and fixing a bug in the SD card driver code I get these results:

  • Check mode streaming: 1:58, from SD 2:45 (no DMA, single byte reads).
  • Run: 13:42, I've seen a few momentary feed rates above 10000mm/min at the start of the job, many peaking at 18000 at the last 3rd of it. No pauses.
  • SD card run: 13:52, I've seen a few momentary feed rates above 15000mm/min.

Not bad compared with the iMXRT1062 results.

Note that I have performed these tests without motors connected!

@drom89
Copy link
Author

drom89 commented Dec 5, 2021

There was several pauses during the run, the job restarted by itself after a little while (a little less than 3 minutes).

I didnt wait for the resume, so i dont know if it will resume or not. Some times it stops and laser is still firing.

After increasing the stepper interrupt priority, lowering the USB priority and fixing a bug in the SD card driver code I get these results:

How can i do that ?

@terjeio
Copy link
Contributor

terjeio commented Dec 5, 2021

How can i do that ?

Change priority in this line from 2 to 0.

NVIC_SetPriority(STEPPER_TIMER_INT0, 2);

Add this line before line 330:
NVIC_SetPriority(USB_IRQn, 1);

LPC176x/src/usb_serial.c

Lines 329 to 330 in 929596c

/* enable USB interrupts */
NVIC_EnableIRQ(USB_IRQn);

What is your steps/mm setting for X? Number of microsteps per step? More is not necessarily better as it increases processor load.

@drom89
Copy link
Author

drom89 commented Dec 5, 2021

I have 80 steps per mm

@readeral
Copy link

Reading through this thread, with the changes, are raster engravings now viable on the SKR 1.4T?

@drom89
Copy link
Author

drom89 commented Jan 20, 2022

To be honest i still didnt try it. I was busy with new version of mechanics.
EDIT: i will try to test it next week and let you know the results.

@drom89
Copy link
Author

drom89 commented Feb 14, 2022

I have some troubles with TMC2130 overheating so im not sure if it is working as intended.
So no results yet.

@terjeio
Copy link
Contributor

terjeio commented Feb 16, 2022

I have some troubles with TMC2130 overheating

From the manual:
"The driver integrates a two level temperature sensor (120°C pre-warning and 150°C thermal shutdown) for diagnostics and for protection of the IC against excess heat."

When you write "overheating" do you mean thermal shutdown causing the motor(s) to stop moving?

I have now run a motor at 500mA for 1hr30 and the motor and the driver heatsink are both warm to the touch, I guess around 50°C. Will try a larger current setting later.

@drom89
Copy link
Author

drom89 commented Mar 4, 2022

Hi again,
im back with some new info.
Switched back to TMC2209 and i get much better temperature.

@drom89
Copy link
Author

drom89 commented Mar 4, 2022

So current situation when i try to engrave in black and white threshold mode in Lightburn.
https://user-images.githubusercontent.com/5219063/156813970-b725f0a7-ecbc-4f25-b1e2-3ec48ffb91b9.mp4

gcode in zip file below
speed 300mm/s

GrblHAL 1.1f ['$' or '$HELP' for help]
[MSG:'$H'|'$X' to unlock]
error:9
G-code locked out during alarm or jog state.
[MSG:Caution: Unlocked]
ok
$$
$0=10.0
$1=250
$2=0
$3=1
$4=7
$5=7
$6=1
$7=0
$10=4095
$11=0.010
$12=0.002
$13=0
$14=7
$15=0
$16=0
$17=0
$18=0
$19=0
$20=0
$21=0
$22=9
$23=3
$24=25.0
$25=1000.0
$26=250
$27=1.000
$28=0.000
$29=0.0
$30=1000.000
$31=0.000
$32=1
$33=50000.0
$34=0.0
$35=0.0
$36=100.0
$37=0
$39=1
$40=1
$43=1
$44=3
$45=0
$46=0
$62=0
$63=3
$64=0
$65=0
$100=80.000
$101=80.000
$102=80.000
$110=66000.000
$111=30000.000
$112=10000.000
$120=6000.000
$121=4000.000
$122=1000.000
$130=600.000
$131=300.000
$132=200.000
$140=2000
$141=1000
$142=1000
$150=8
$151=16
$152=16
$200=0.0
$201=22.0
$202=50.0
$210=25
$211=50
$212=50
$220=0.0
$221=22.0
$222=50.0
$338=0
$339=0
$341=0
$342=30.0
$343=25.0
$344=200.0
$345=100.0
$384=0
ok

image
test_engrave.zip
image
image

@drom89
Copy link
Author

drom89 commented Mar 4, 2022

@drom89
Copy link
Author

drom89 commented Mar 4, 2022

EDIT: videos above are with default BLOCK_BUFFER_SIZE

Below i will upload with #define BLOCK_BUFFER_SIZE 150

Memory region Used Size Region Size %age Used
MFlash512: 168304 B 496 KB 33.14%
RamLoc32: 29708 B 32 KB 90.66%
RamAHB32: 0 GB 32 KB 0.00%

image
https://user-images.githubusercontent.com/5219063/156820069-5660c448-aefe-46e5-a4ad-8cc0a2784509.mp4
image

VID20220304192452.mp4

@terjeio
Copy link
Contributor

terjeio commented Mar 4, 2022

I'll take a look at this tomorrow.
Have you tried to lower the feed rate and/or lowering the acceleration?
X-axis acceleration looks a bit high to me - is the machine able to handle rapid (G0) motions without issues?

@drom89
Copy link
Author

drom89 commented Mar 4, 2022

Machine can take 1100mm/s on X Axis.
On lower feedrates it looks almost same.

@terjeio
Copy link
Contributor

terjeio commented Mar 6, 2022

When I test with your settings for the x-axis my motor stalls. I have to reduce the acceleration substantially to make it work. At 500 mm/s2 the motor starts to sound ok and I can reach around 7000 mm/min feed rate with planner buffer size set to 150.
Note that this is with no load on the motor.

FYI running with your settings and counting step pulses with my CNC machine simulator no pulses are lost and the pulse train looks ok on my scope - albeit with a bit of jitter.

@drom89
Copy link
Author

drom89 commented Mar 7, 2022

I have around 1500mA on motors with 24V.
That was a problem with 2208 overheating :)

I would be happy for at least black and white (threshold) engraving/dithering to be faster.

@drom89
Copy link
Author

drom89 commented Mar 11, 2022

This Is when i have speed set to 1100mm/s, i just wanted to test machine limits... https://user-images.githubusercontent.com/5219063/157903487-96d6b137-623c-46df-87d3-69300f4cb57d.mp4

EDIT:
fw version for new laser:

[VER:1.1f.20220131:]
[OPT:VNMZSL,149,1024,3,0]
Target buffer size found
[NEWOPT:ENUMS,RT+,HOME,TC,SED,SD]
[FIRMWARE:grblHAL]
[NVS STORAGE:*FLASH]
[DRIVER:LCP1769]
[DRIVER VERSION:220126]
[BOARD:BTT SKR V1.4 Turbo]
[PLUGIN:Trinamic v0.08]
[PLUGIN:SDCARD v1.05]

@drom89
Copy link
Author

drom89 commented Mar 11, 2022

I just tried it on second laser with older firmware and i dont get that stopping.

[VER:1.1f.20210928:]
[OPT:VNMSL,49,1024,3,0]
Target buffer size found
[NEWOPT:ENUMS,RT+,TC,SED,SD]
[FIRMWARE:grblHAL]
[NVS STORAGE:*FLASH]
[DRIVER:LCP1769]
[DRIVER VERSION:210908]
[BOARD:BTT SKR V1.4 Turbo]
[PLUGIN:Trinamic v0.05]
[PLUGIN:SDCARD v1.02]

Video is with 300mm/s speed, but i can go to 700mm/s with black and white (threshold setting).
If i try grayscale i need to lower speed to 30mm/s at max.
image

VID20220311171120.mp4

setting for older laser:
$0=10.0 $1=25 $2=0 $3=0 $4=7 $5=0 $6=1 $7=0 $10=511 $11=0.010 $12=0.002 $13=0 $14=7 $15=0 $16=0 $17=0 $18=0 $19=0 $20=0 $21=0 $22=0 $23=0 $24=25.0 $25=500.0 $26=250 $27=1.000 $28=0.100 $29=0.0 $30=1000.000 $31=1.000 $32=1 $33=20000.0 $34=0.0 $35=15.0 $36=100.0 $37=0 $39=1 $40=0 $43=1 $44=5 $45=0 $46=0 $62=0 $63=3 $64=0 $65=0 $80=1.000 $81=0.010 $82=0.000 $84=0.000 $85=10.000 $90=0.000 $91=0.000 $92=0.000 $95=0.000 $100=80.000 $101=80.000 $102=40.000 $110=72000.000 $111=20000.000 $112=500.000 $120=2000.000 $121=600.000 $122=10.000 $130=600.000 $131=600.000 $132=200.000 $140=1200 $141=1200 $142=500 $150=16 $151=16 $152=16 $160=0.000 $161=0.000 $162=0.000 $200=50.0 $201=50.0 $202=22.0 $210=50 $211=50 $212=50 $338=0 $339=0 $341=0 $342=30.0 $343=25.0 $344=200.0 $345=100.0 $347=5.0 $348=2.500 $349=25.000 $384=0

@drom89
Copy link
Author

drom89 commented Mar 11, 2022

Any suggestions what should i try to do ?
Thank you.

@terjeio
Copy link
Contributor

terjeio commented Mar 12, 2022

$120 is 6000 for the new, the old 2000. Did you try reducing it for the new?

@drom89
Copy link
Author

drom89 commented Mar 22, 2022

So i tried cohesion3d smoothie cluster firmware and it seems i can get up to 300mm/s with grayscale engraving.
Link: https://forum.cohesion3d.com/t/improved-raster-speed-firmware-update-for-cohesion3d-boards/850

There is a link with changes to standard smoothie firmware https://www.dropbox.com/s/bk44snjpu03dju1/SmooChanges.zip?dl=0 dont know if you can use any ideas from it to GrblHAL.

@terjeio
Copy link
Contributor

terjeio commented Sep 27, 2022

An experimental plugin for cluster unpacking has been added to the laser plugins repo. An ongoing related discussion here.

@drom89
Copy link
Author

drom89 commented Sep 28, 2022

Hello Terjeio, i already read about it, i catch the info in discussion of development of a new raster protocol. But thank you very much for letting me know.
Im testing ESP-WROOM-32 MCU for laser. Its quite cheap and it should be faster then LPC1769, we will see how it goes.
If it is possible to use it with GrblHAL i would be happy to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants