For any product issues, please contact me first: hankecnc@gmail.com

M4, laser inline commands have poor performance. #977

未分类 bolang 7个月前 (09-22) 155次浏览
@V1EngineeringInc

Description

Wiki Search Terms

lightburn, M4, inline, Uart, RMT, RTM, i2s_static

Controller Board

Jackpot

Machine Description

MPCNC, Dual X, Dual Y, Single Z
TMC 2209, New UART code

Input Circuits

No response

Configuration file

board: Jackpot TMC2209
name: Jackpot TMC2209
meta: 06-20-2023 B. Dring

stepping:
  engine: I2S_STATIC
  idle_ms: 255
  pulse_us: 4
  dir_delay_us: 1
  disable_delay_us: 0
  
uart1:
  txd_pin: gpio.0
  rxd_pin: gpio.4
  rts_pin: NO_PIN
  baud: 115200
  mode: 8N1

axes:
  shared_stepper_disable_pin: NO_PIN
  
  x:
    steps_per_mm: 50.000
    max_rate_mm_per_min: 5000.000
    acceleration_mm_per_sec2: 180.000
    max_travel_mm: 1220
    soft_limits: false
    homing:
      cycle: 2
      positive_direction: false
      mpos_mm: 0
      feed_mm_per_min: 1200.000
      seek_mm_per_min: 300.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100
    #X
    motor0:
      limit_neg_pin: gpio.25:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 5.000
      tmc_2209:
        uart_num: 1
        addr: 0
        cs_pin: NO_PIN
        r_sense_ohms: 0.110
        run_amps: 0.500
        hold_amps: 0.400
        microsteps: 8
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        direction_pin: I2SO.1
        step_pin: I2SO.2
        disable_pin: I2SO.0
    
    #A
    motor1:
      limit_neg_pin: gpio.35:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 5.000
      tmc_2209:
        uart_num: 1
        addr: 3
        cs_pin: i2so.14
        r_sense_ohms: 0.110
        run_amps: 0.500
        hold_amps: 0.400
        microsteps: 8
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        step_pin: I2SO.13
        direction_pin: I2SO.12
        disable_pin: I2SO.15
        
        
  y:
    steps_per_mm: 50.000
    max_rate_mm_per_min: 5000.000
    acceleration_mm_per_sec2: 180.000
    max_travel_mm: 2440
    soft_limits: false
    homing:
      cycle: 2
      positive_direction: false
      mpos_mm: 0
      feed_mm_per_min: 1200.000
      seek_mm_per_min: 300.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100
    #Y
    motor0:
      limit_neg_pin: gpio.33:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 5.000
      tmc_2209:
        uart_num: 1
        addr: 1
        cs_pin: NO_PIN
        r_sense_ohms: 0.110
        run_amps: 0.500
        hold_amps: 0.400
        microsteps: 8
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        step_pin: I2SO.5
        direction_pin: I2SO.4
        disable_pin: I2SO.7
   
    #B
    motor1:
      limit_neg_pin: gpio.34:high
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 5.000
      tmc_2209:
        uart_num: 1
        addr: 3
        cs_pin: i2so.19
        r_sense_ohms: 0.110
        run_amps: 0.500
        hold_amps: 0.400
        microsteps: 8
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        step_pin: I2SO.18
        direction_pin: I2SO.17
        disable_pin: I2SO.16
  z:
    steps_per_mm: 200.000
    max_rate_mm_per_min: 1200.000
    acceleration_mm_per_sec2: 80.000
    max_travel_mm: 300.000
    soft_limits: false
    homing:
      cycle: 1
      positive_direction: true
      mpos_mm: 200.000
      feed_mm_per_min: 720.000
      seek_mm_per_min: 300.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.32:low
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 3.000
      tmc_2209:
        uart_num: 1
        addr: 2
        cs_pin: NO_PIN
        r_sense_ohms: 0.110
        run_amps: 0.500
        hold_amps: 0.400
        microsteps: 8
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        step_pin: I2SO.10
        direction_pin: I2SO.9
        disable_pin: I2SO.8
                 
  c:
    steps_per_mm: 80.000
    max_rate_mm_per_min: 5000.000
    acceleration_mm_per_sec2: 100.000
    max_travel_mm: 300.000
    soft_limits: false
    homing:
      cycle: 1
      positive_direction: true
      mpos_mm: 150.000
      feed_mm_per_min: 100.000
      seek_mm_per_min: 800.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      limit_neg_pin: gpio.39:low
      limit_pos_pin: NO_PIN
      limit_all_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 3.000
      tmc_2209:
        uart_num: 1
        addr: 3
        cs_pin: i2so.22
        r_sense_ohms: 0.110
        run_amps: 1.000
        hold_amps: 0.500
        microsteps: 16
        stallguard: 0
        stallguard_debug: false
        toff_disable: 0
        toff_stealthchop: 5
        toff_coolstep: 3
        run_mode: StealthChop
        homing_mode: StealthChop
        use_enable: false
        step_pin: I2SO.21
        direction_pin: I2SO.20
        disable_pin: I2SO.23


i2so:
  bck_pin: gpio.22
  data_pin: gpio.21
  ws_pin: gpio.17

spi:
  miso_pin: gpio.19
  mosi_pin: gpio.23
  sck_pin: gpio.18

sdcard:
  cs_pin: gpio.5
  card_detect_pin: NO_PIN
  frequency_hz: 20000000

probe:
  pin: gpio.36:low
  toolsetter_pin: NO_PIN
  check_mode_start: true

start:
  must_home: false

coolant:
  flood_pin: gpio.2
  mist_pin: gpio.16
  delay_ms: 0

control:
  safety_door_pin: NO_PIN
  reset_pin: NO_PIN
  feed_hold_pin: NO_PIN
  cycle_start_pin: NO_PIN
  macro0_pin: NO_PIN
  macro1_pin: NO_PIN
  macro2_pin: NO_PIN
  macro3_pin: NO_PIN  

macros:
  startup_line0:
  startup_line1:
  macro0:
  macro1:
  macro2:
  macro3:
  
user_outputs:
  analog0_pin: NO_PIN
  analog1_pin: NO_PIN
  analog2_pin: NO_PIN
  analog3_pin: NO_PIN
  analog0_hz: 5000
  analog1_hz: 5000
  analog2_hz: 5000
  analog3_hz: 5000
  digital0_pin: NO_PIN
  digital1_pin: NO_PIN
  digital2_pin: NO_PIN
  digital3_pin: NO_PIN

pwm:
  pwm_hz: 5000
  direction_pin: gpio.26
  output_pin: gpio.27
  enable_pin: NO_PIN
  disable_with_s0: false
  s0_with_disable: true
  spinup_ms: 0
  spindown_ms: 0
  tool_num: 0
  speed_map: 0=0.000% 255=100.000%
  off_on_alarm: false

# 5V out gpio.26/27
# VMot out gpoi.2/16
# In's left to right gpoi.25/33/32/35/34/39/36

Startup Messages

[MSG:INFO: FluidNC v3.0.x (noGit)]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.4]
[MSG:INFO: Local filesystem type is spiffs]
[MSG:INFO: Configuration file:config.yaml]
[MSG:INFO: Machine Jackpot TMC2209]
[MSG:INFO: Board Jackpot TMC2209]
[MSG:INFO: UART1 Tx:gpio.0 Rx:gpio.4 RTS:NO_PIN Baud:115200]
[MSG:INFO: I2SO BCK:gpio.22 WS:gpio.17 DATA:gpio.21]
[MSG:INFO: SPI SCK:gpio.18 MOSI:gpio.23 MISO:gpio.19]
[MSG:INFO: SD Card cs_pin:gpio.5 detect:NO_PIN freq:20000000]
[MSG:INFO: Stepping:I2S_static Pulse:4us Dsbl Delay:0us Dir Delay:1us Idle Delay:255ms]
[MSG:INFO: Axis count 6]
[MSG:INFO: Axis X (0.000,1220.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:0 CS:NO_PIN Step:I2SO.2 Dir:I2SO.1 Disable:I2SO.0 R:0.110]
[MSG:INFO:  X Neg Limit gpio.25]
[MSG:INFO:   Motor1]
[MSG:INFO:     tmc_2209 UART1 Addr:3 CS:I2SO.14 Step:I2SO.13 Dir:I2SO.12 Disable:I2SO.15 R:0.110]
[MSG:INFO:  X2 Neg Limit gpio.35]
[MSG:INFO: Axis Y (0.000,2440.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:1 CS:NO_PIN Step:I2SO.5 Dir:I2SO.4 Disable:I2SO.7 R:0.110]
[MSG:INFO:  Y Neg Limit gpio.33]
[MSG:INFO:   Motor1]
[MSG:INFO:     tmc_2209 UART1 Addr:3 CS:I2SO.19 Step:I2SO.18 Dir:I2SO.17 Disable:I2SO.16 R:0.110]
[MSG:INFO:  Y2 Neg Limit gpio.34]
[MSG:INFO: Axis Z (-100.000,200.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:2 CS:NO_PIN Step:I2SO.10 Dir:I2SO.9 Disable:I2SO.8 R:0.110]
[MSG:INFO:  Z Neg Limit gpio.32:low]
[MSG:INFO: Axis A (-1000.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO: Axis B (-1000.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO: Axis C (-150.000,150.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     tmc_2209 UART1 Addr:3 CS:I2SO.22 Step:I2SO.21 Dir:I2SO.20 Disable:I2SO.23 R:0.110]
[MSG:INFO:  C Neg Limit gpio.39:low]
[MSG:INFO: X Axis driver test passed]
[MSG:INFO: X2 Axis driver test passed]
[MSG:INFO: Y Axis driver test passed]
[MSG:INFO: Y2 Axis driver test passed]
[MSG:INFO: Z Axis driver test passed]
[MSG:ERR: C Axis TMC driver not detected - expected 0x0x21 got 0x0x0]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: PWM Spindle Ena:NO_PIN Out:gpio.27 Dir:gpio.26 Freq:5000Hz Period:8191]
[MSG:INFO: Using spindle PWM]
[MSG:INFO: Flood coolant gpio.2]
[MSG:INFO: Mist coolant gpio.16]
[MSG:INFO: Probe Pin: gpio.36:low]
[MSG:INFO: STA SSID is not set]
[MSG:INFO: AP SSID FluidNC IP 192.168.0.1 mask 255.255.255.0 channel 1]
[MSG:INFO: AP started]
[MSG:INFO: WiFi on]
[MSG:INFO: Captive Portal Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]

User Interface Software

lightburn, or wifi microsd-esp3dui

What happened?

Extremely poor performance of inline commands. With the all new setup I am using (new hardware, and new firmware), inline commands are causing severe stuttering and obvious slow down at each power level change. (“S” command). ((It looks almost like it is accelerating for the power changes, this exact thing happen in Marlin at one point. I am unsure if it is this or the new hardware))

Same resolution setting in other firmware have proved to work at 20mm/s and 80mm/s. This is showing issues even at 5mm/s.

Lightburn settings.
Screenshot 2023-07-19 072933

GCode File

raster test.zip

Other Information

I have verified all the same settings as the FluidNC lightburn settings, Vector burn files work fine.
I tried different microstepping. 8 and 16th
I tried mapping the power level standard 1000, and 255.

The version shown in the MSG section seems odd but it is from last night’s DevT branch, the only one with the UART settings needed for this board

Activity

V1EngineeringInc

V1EngineeringInc commented on Jul 19, 2023

SponsorAuthor

If I run from the microSD,
“[MSG:WARN: Low memory: 12884 bytes]
[MSG:INFO: Channel auto report interval set to 50 ms]”

Shows up in the terminal, I suspect that is normal.

V1EngineeringInc

V1EngineeringInc commented on Jul 19, 2023

SponsorAuthor

Changing the mapping back to 1000 per discord user suggestion.

MitchBradley

MitchBradley commented on Jul 20, 2023

Collaborator

First of all, let’s setup some procedures to make debugging possible. The “nogit” in the version message suggests that the source code was downloaded as a zip ( I wish github could be configured to turn off that feature). It is much better to fork the repository and make your own working branch. Every time that you report a result, make sure that any code changes are committed and pushed to the fork branch. Then the version number will reflect the source code via the commit hash, and you can point to your fork so we can see your actual code. If we can’t see your code, every hypothesis has to be sandwiched with “I wonder if …. but there is no quick way to find out”, which is inefficient to the point of being intolerable.

Also let’s keep this entirely on GitHub. Having to consult two different channels is similarly inefficient.

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

Okay, understood. Let me get a few orders out and then I can spend some more time and focus again this afternoon.

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

” It is much better to fork the repository and make your own working branch.”

I am not really understanding what it takes to make this happen. I am not understanding everything that needs to be modified in the workflow file. Other than the version number, does something else change. I am pretty fluent in compiling several types of firmware and making some edit but workflows are still a bit of a magical to me.

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

Is there another way I can confidently compile the devt branch to prove to both of us I am using the right one?

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

” Every time that you report a result, make sure that any code changes are committed and pushed to the fork branch.”
At this point I have made no changes, Bart has made all the UART changes.

MitchBradley

MitchBradley commented on Jul 20, 2023

Collaborator

The first step is to create a fork with the Fork button. That will make a copy of the git repository in your github account.

image

The next step depends on the tools that you use. Do you use the VsCode IDE? If so you can do the next step directly from VsCode.

MitchBradley

MitchBradley commented on Jul 20, 2023

Collaborator

Assuming VsCode, do File>New Window and then under Start, hit Clone Git Repository, then Clone from GitHub, then start typing v1engineering and choose v1engineering/FluidNC when it comes up.

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

I use vscode, I have forked this repo. I am just not understanding how to get the workflow file to use the devt branch and spit out all the files to my fork not try to use your and barts repos.

MitchBradley

MitchBradley commented on Jul 20, 2023

Collaborator

The workflow file is irrelevant. You need to select the Devt branch in the Git extension, then use the platformio upload button to build and upload to the esp32

MitchBradley

MitchBradley commented on Jul 20, 2023

Collaborator

Or better yet, “Create new branch from …” and choose origin/Devt as the starting point. Give it a new name for your work.

MitchBradley

MitchBradley commented on Jul 20, 2023

Collaborator

The workflows are for creating release bundles. You don’t need to do that at all.

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

Instead of just downloading, and compiling it? Okay that will have to wait for tomorrow I guess. I am not at that computer that is near the connected board.
I just downloaded and compiled then I tried pio direct to the board, fluidterm ctrl-u, then ctrl-r, and the update from esp3dui. If you think it will make a difference, I will do it that way. Learning something new is always good.

V1EngineeringInc

V1EngineeringInc commented on Jul 20, 2023

SponsorAuthor

I am confident I did compile and flash the right branch, but I understand wanting to see the correct numbers for troubleshooting’s sake.

I am just concerned the new UART controls are causing some issues, since no one seems to be having issues with M4 other than me.

15 remaining items

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

Sorry I just turned off AP STA. I will try again.

The machine was running smooth at about 70mm/s (as compared to grbl-hal hits 80 at the same settings on a different board). The freeze happened all the way down to 20mm/s it would just say busy after a a few mm worth of burn. It does seem like a memory thing but what do I really know. Testing again with AP/STA off from the lightburn panel.

MitchBradley

MitchBradley commented on Jul 21, 2023

Collaborator

Is WebUI running at the same time as lightburn? If so, is auto-reporting enabled? Auto-reporting at high refresh rates can use up a lot of I/O bandwidth. It is okay for milling but not for lasering.

MitchBradley

MitchBradley commented on Jul 21, 2023

Collaborator

Are you using lightburn over USB or TCP? TCP sucks compared to USB because of packet latency.

MitchBradley

MitchBradley commented on Jul 21, 2023

Collaborator

TCP has good bandwidth for large packets, but rather high latency. For small packets the bandwidth drops off severely. The GRBL protocol was heavily tuned toward the characteristics of serial ports – very small packet sizes due to limitations in AVR serial receive buffers, coupled with low and predictable latency for single characters.

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

USB.

So it looks like I can run about 35-38mm/s with smooth running no signs of stuttering at power changes with STA off. (same .19line interval 134dpi). Marlin hits 22 at best with 8 bit and 26mm/s with a 32 bit chip. That is great.
I can try turning AP back on with auto reporting off…just need to figure out how to enable it again.

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

What else might affect the speed? I have 8th microstepping, figured less pulses was better, what about”pwm_hz: 5000″ try dropping to 2000?

Just looking to see an ultimate max here before I set up a normal parameters for users.

MitchBradley

MitchBradley commented on Jul 21, 2023

Collaborator

38 mm/sec is 26 ms/mm or 5 ms/ .19 mm . 5 ms is 57 characters at 11500 baud (87 us/char). So, unless there is some inefficiency in the way that lightburn manages buffers, the UART bandwidth is probably not the limiting factors. You could test that by shortening the GCode lines. After one G1 line, the next line need not say G1, so

G1 X0.19S108.2
G1 X9.098S80
G1 X4.5S0
G1 Y0.189S0
G1 X-4.5S0
G1 X-9.098S80
G1 X-0.19S820
G1 X-0.189S192.8
G1 X-0.19S80
G1 X-0.19S830.5
G1 X-0.189S80

could be shortened to:

G1
X0.19S108.2
X9.098S80
X4.5S0
Y0.189S0
X-4.5S0
X-9.098S80
X-0.19S820
X-0.189S192.8
X-0.19S80
X-0.19S830.5
X-0.189S80

In hand-coded GCode, it is not unusual to first say

G1 F1000

to establish the mode and feedrate, then on following lines you just mention the x and y coordinates.

Another trick is to ensure that lines end with only linefeed, not CR-LF, thus saving one character per line.

Yet another trick is to set the maximum S value to a small integer like 9, using the speed map to associate that with the desired pwm values. Then instead of saying S80, S192.8, S830.5, etc, you can say S1, S2, S9

A final trick would be to cheat on the steps_per_mm so that instead of saying “X-.189”, you could say “X-1”. With all those tricks you could reduce the typical line length from 16 characters to 6 – e.g. “X-1S5”

But even without doing all the tricks, you can find out if line bandwidth is a limiting factor. Just do the easy tricks like omitting the “G1 ” and see if you can go a little faster.

MitchBradley

MitchBradley commented on Jul 21, 2023

Collaborator

Another thing to try is increasing planner_blocks http://wiki.fluidnc.com/en/config/top_level_config_items

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

Direct from the MicroSD in STA mode should be the fastest then? Skip the whole USB thing and no AP mode Memory bottleneck?

MitchBradley

MitchBradley commented on Jul 21, 2023

Collaborator

In principle, yes. Give it a try.

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

If I enable STA mode, still running off USB, It will eventually freeze. Depending on speed in can take 30 seconds or less. I don’t think I can test it from the Micro SD.

I am going to turn up the buffer size, 32, maybe 48. Not sure what else to try if that doesn’t help.

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

Doubling the planner got me above 100mm/s, not bad at 120mm/s, before stuttering with the wifi still off.

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

Well Mitch I have done a ton of learning today. Thanks for being so patient with me.

How about some great news….in AP mode I am still getting very little hesitation with M4 from the Micro SD. So from lightburn wired wifi off and AP mode direct from MicroSD is the same.

The only issues are M4 with wifi on while directly connected to lightburn (a common use as it has all the laser calibrations built in). Maybe add the command to temporarily turn it off to the wiki $WiFi/Mode=off? I might be totally wrong.

When I disconnected from the AP is hesitated for a long while then resumed. I am guessing STA mode fixes that? Last thing for me to test as I get a poor signal by my CNC.

Should I close this issue?

V1EngineeringInc

V1EngineeringInc commented on Jul 21, 2023

SponsorAuthor

I guess I need to retest to see how much added planner/memory helps, but it definitely does with M4. If there is not a huge downside, I will leave the public config set to 32 for my users.

喜欢 (0)