bdring / FluidNC

The next generation of motion control firmware
Other
1.58k stars 382 forks source link

Some codes suspend Bluetooth communication #482

Closed tuxcnc closed 2 years ago

tuxcnc commented 2 years ago

Controller Board

MKS DLC32

Help From Board Vendor

Machine Description

XYZ

Configuration file

board: MKS-DLC32
name: CNC6040
meta: 
stepping:
  engine: I2S_static
  idle_ms: 255
  pulse_us: 4
  dir_delay_us: 1
  disable_delay_us: 0

axes:
  shared_stepper_disable_pin: I2SO.0
  x:
    steps_per_mm: 200.000
    max_rate_mm_per_min: 3000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 345.000
    soft_limits: true
    homing:
      cycle: 2
      mpos_mm: 0
      feed_mm_per_min: 500.000
      seek_mm_per_min: 2000.000
      positive_direction: false
    motor0:
      limit_neg_pin: NO_PIN
      limit_pos_pin: NO_PIN
      limit_all_pin: gpio.36:low
      hard_limits: false
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.1
        direction_pin: I2SO.2:high
        disable_pin: NO_PIN
        ms1_pin: NO_PIN
        ms2_pin: NO_PIN
        ms3_pin: NO_PIN
        reset_pin: NO_PIN

  y:
    steps_per_mm: 200.000
    max_rate_mm_per_min: 3000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 550.000
    soft_limits: true
    homing:
      cycle: 2
      mpos_mm: 550
      feed_mm_per_min: 500.000
      seek_mm_per_min: 2000.000
      positive_direction: true
    motor0:
      limit_neg_pin: NO_PIN
      limit_pos_pin: NO_PIN
      limit_all_pin: gpio.35:low
      hard_limits: false
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.5
        direction_pin: I2SO.6:low
        disable_pin: NO_PIN
        ms1_pin: NO_PIN
        ms2_pin: NO_PIN
        ms3_pin: NO_PIN
        reset_pin: NO_PIN

  z:
    steps_per_mm: 200.000
    max_rate_mm_per_min: 3000.000
    acceleration_mm_per_sec2: 200.000
    max_travel_mm: 100.000
    soft_limits: true
    homing:
      cycle: 1
      mpos_mm: 0
      feed_mm_per_min: 500.000
      seek_mm_per_min: 2000.000
      positive_direction: true
    motor0:
      limit_neg_pin: NO_PIN
      limit_pos_pin: NO_PIN
      limit_all_pin: gpio.34:low
      hard_limits: false
      pulloff_mm: 1.000
      stepstick:
        step_pin: I2SO.3
        direction_pin: I2SO.4:low
        disable_pin: NO_PIN
        ms1_pin: NO_PIN
        ms2_pin: NO_PIN
        ms3_pin: NO_PIN
        reset_pin: NO_PIN

kinematics:
  Cartesian:

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

spi:
  miso_pin: gpio.12
  mosi_pin: gpio.13
  sck_pin: gpio.14

sdcard:
  cs_pin: gpio.15
  card_detect_pin: NO_PIN

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

coolant:
  flood_pin: gpio.5
  mist_pin: NO_PIN
  delay_ms: 0

probe:
  pin: gpio.22:low
  check_mode_start: false

macros:
  startup_line0: 
  startup_line1: 
  macro0: 
  macro1: 
  macro2: 
  macro3: 

start:
  must_home: false
  deactivate_parking: false
  check_limits: false

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

arc_tolerance_mm: 0.002
junction_deviation_mm: 0.010
verbose_errors: false
report_inches: false
enable_parking_override_control: false
use_line_numbers: false
PWM:
  pwm_hz: 5000
  direction_pin: NO_PIN
  output_pin: gpio.32
  enable_pin: I2SO.7
  disable_with_s0: false
  s0_with_disable: true
  spinup_ms: 0
  spindown_ms: 0
  tool_num: 0
  speed_map: 0=0.000% 24000=100.000%

Startup Messages

$SS
[MSG:INFO: FluidNC v3.4.7]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.1-1-gb8050b365e]
[MSG:INFO: Local filesystem type is SPIFFS]
[MSG:INFO: Configuration file:config.yaml]
[MSG:INFO: Machine CNC6040]
[MSG:INFO: Board MKS-DLC32]
[MSG:INFO: I2SO BCK:gpio.16 WS:gpio.17 DATA:gpio.21]
[MSG:INFO: SPI SCK:gpio.14 MOSI:gpio.13 MISO:gpio.12]
[MSG:INFO: SD Card cs_pin:gpio.15 detect:NO_PIN]
[MSG:INFO: Stepping:I2S_static Pulse:4us Dsbl Delay:0us Dir Delay:1us Idle Delay:255ms]
[MSG:INFO: Axis count 3]
[MSG:INFO: Shared stepper disable I2SO.0]
[MSG:INFO: Axis X (0.000,345.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     stepstick Step:I2SO.1 Dir:I2SO.2 Disable:NO_PIN]
[MSG:INFO:     All Limit gpio.36:low]
[MSG:INFO: Axis Y (0.000,550.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     stepstick Step:I2SO.5 Dir:I2SO.6:low Disable:NO_PIN]
[MSG:INFO:     All Limit gpio.35:low]
[MSG:INFO: Axis Z (-100.000,0.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     stepstick Step:I2SO.3 Dir:I2SO.4:low Disable:NO_PIN]
[MSG:INFO:     All Limit gpio.34:low]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: PWM Spindle Ena:I2SO.7 Out:gpio.32 Dir:NO_PIN Freq:5000Hz Res:13bits]
[MSG:INFO: Using spindle PWM]
[MSG:INFO: Flood coolant gpio.5]
[MSG:INFO: Probe Pin: gpio.22:low]
[MSG:INFO: BT Started with CNC6040]
ok
b'$G\n'
[GC:G0 G54 G17 G21 G90 G94 M5 M9 T0 F0 S0]
ok

User Interface Software

Does not matter

What happened?

Refers to execute g-code program, not using terminal. Here you are test.nc program :

$H $SS M3 G0X10 G0X0 M5 M30

It runs well from SD card. It runs well by USB connection. It hangs after $H by Bluetooth connection. To exclude the sender problem, I used Linux terminal only :

cat test.nc > /dev/ttyUSB0 cat test.nc > /dev/rfcomm0

By USB program is sent and works well, by Bluetooth program is sent, but does only homing, then stops and does nothing else. Do not ask why $H in the program, because it can be useful and can work. BTW. There is the same problem after M30 (Sender is waiting for program end to eternity).

Other Information

No response

MitchBradley commented 2 years ago

cat test.nc >/dev/rfcomm0 violates the Grbl flow control protocol. You cannot send an arbitrary amount of data at full speed without waiting for "ok" acknowledgments.

Do not ask why $H in the program, because it can be useful and can work.

The fact that it "can work" in some situations does not necessarily mean that it works in all situations, nor does it mean that it is supported.

tuxcnc commented 2 years ago

cat test.nc >/dev/rfcomm0 violates the Grbl flow control protocol. You cannot send an arbitrary amount of data at full speed without waiting for "ok" acknowledgments.

The program has 28 bytes length, and the size of the buffer is not a problem. The problem is how to finish some codes. On a machine without defined home switches, the program displays:

$H [MSG:ERR: No homing cycles defined] ok

And goes on. It only hangs on M30 and Sender is waiting forever at the end of the program, although the program is over ... Here you have the whole :

ok G90 [MSG:ERR: No homing cycles defined] ok $H [MSG:INFO: FluidNC v3.4.7] [MSG:INFO: Compiled with ESP32 SDK:v4.4.1-1-gb8050b365e] [MSG:INFO: Local filesystem type is SPIFFS] [MSG:INFO: Configuration file:config.yaml] [MSG:INFO: Machine CNC1310] [MSG:INFO: Board MKS-DLC32] [MSG:INFO: I2SO BCK:gpio.16 WS:gpio.17 DATA:gpio.21] [MSG:INFO: SPI SCK:gpio.14 MOSI:gpio.13 MISO:gpio.12] [MSG:INFO: SD Card cs_pin:gpio.15 detect:NO_PIN] [MSG:INFO: Stepping:I2S_static Pulse:4us Dsbl Delay:0us Dir Delay:1us Idle Delay:2ms] [MSG:INFO: Axis count 3] [MSG:INFO: Shared stepper disable I2SO.0] [MSG:INFO: Axis X (-1000.000,0.000)] [MSG:INFO: Motor0] [MSG:INFO: stepstick Step:I2SO.1 Dir:I2SO.2:low Disable:NO_PIN] [MSG:INFO: All Limit gpio.36:low] [MSG:INFO: Axis Y (-1000.000,0.000)] [MSG:INFO: Motor0] [MSG:INFO: stepstick Step:I2SO.5 Dir:I2SO.6 Disable:NO_PIN] [MSG:INFO: All Limit gpio.35:low] [MSG:INFO: Axis Z (-1000.000,0.000)] [MSG:INFO: Motor0] [MSG:INFO: stepstick Step:I2SO.3 Dir:I2SO.4:low Disable:NO_PIN] [MSG:INFO: All Limit gpio.34:low] [MSG:INFO: Kinematic system: Cartesian] [MSG:INFO: PWM Spindle Ena:gpio.27 Out:gpio.32 Dir:NO_PIN Freq:5000Hz Res:13bits] [MSG:INFO: Using spindle PWM] [MSG:INFO: Flood coolant gpio.5] [MSG:INFO: Mist coolant I2SO.7] [MSG:INFO: Probe Pin: gpio.22:low] [MSG:INFO: BT Started with FluidNC] ok $SS ok M3 ok G0X10 ok <Run|MPos:-9.998,0.000,0.000|FS:1320,0> <Run|MPos:-9.995,0.000,0.000|FS:1320,0> <Run|MPos:-9.993,0.000,0.000|FS:1320,0|WCO:-10.000,0.000,0.000> <Run|MPos:-9.988,0.000,0.000|FS:1320,0> <Run|MPos:-9.980,0.000,0.000|FS:1320,0> <Run|MPos:-9.975,0.000,0.000|FS:1320,0> <Run|MPos:-9.967,0.000,0.000|FS:1320,0> <Run|MPos:-9.945,0.000,0.000|FS:1320,0> <Run|MPos:-9.932,0.000,0.000|FS:1320,0|Ov:100,100,100|A:SM> <Run|MPos:-9.917,0.000,0.000|FS:1320,0> <Run|MPos:-9.910,0.000,0.000|FS:1320,0> <Run|MPos:-9.900,0.000,0.000|FS:1320,0|WCO:-10.000,0.000,0.000> <Run|MPos:-9.882,0.000,0.000|FS:1320,0> <Run|MPos:-9.608,0.000,0.000|FS:1500,0> G0X0 ok

tuxcnc commented 2 years ago

Again : USB - works Bluetooth - not works

bdring commented 2 years ago

The uncontrolled streaming of data violates the protocol. Bluetooth and USB are different with regards to the hardware and software buffers.

We have higher priorities to work on than this unsupported issue. If you can find a case of a compliant sender having trouble we will give it a higher priority.

We addressed your other issue quite quickly.

tuxcnc commented 2 years ago

The uncontrolled streaming of data violates the protocol.

What did you hitch on to this test from the Linux console? It was just a test to rule out the problem in Sender. I use bCNC and it's the same. In FluidNC in the Bluetooth protocol there is a bug. Again: The program works from the SD card. The program works via USB. The program does not work through Bluetooth, because in Bluetooth something is bad. Supported or unsupported - what does it matter? There is a Bluetooth error and should be fixed.

tuxcnc commented 2 years ago

Is M0 code suported ?

Well, the program is :

M0 G0X10 G0X0 M2 M30

WORKS via USB NOT WORKS via Bluetooth. Via bluetooth it hangs after M0. (I used bCNC)

Now it is a problem and worth to fix it?

bdring commented 2 years ago

OK

tuxcnc commented 2 years ago

Similar problem, in Fluidterm by Bluetooth I can't send file to SD card :

--- Fluidterm on /dev/rfcomm0 115200,8,N,1 --- --- Quit: Ctrl+] or Ctrl+Q | Upload: Ctrl+U | Reset: Ctrl+R --- ok path /opt/fluidnc-v3.4.7-posix/test.nc --- Sending file /opt/fluidnc-v3.4.7-posix/test.nc as /SD/test.nc --- [MSG:INFO: Reception failed or was canceled] error:160 send error: expected NAK, CRC, EOT or CAN; got b'o' send error: expected NAK, CRC, EOT or CAN; got b'k' send error: expected NAK, CRC, EOT or CAN; got b'\r' send error: expected NAK, CRC, EOT or CAN; got b'\n' send error: expected NAK, CRC, EOT or CAN; got b'o' send error: expected NAK, CRC, EOT or CAN; got b'k' XModem reception cancelled

Grbl 3.4 [FluidNC v3.4.7 (bt) '$' for help]

Grbl 3.4 [FluidNC v3.4.7 (bt) '$' for help] ok ok

Via USB no problem :

--- Fluidterm on /dev/ttyUSB0 115200,8,N,1 --- --- Quit: Ctrl+] or Ctrl+Q | Upload: Ctrl+U | Reset: Ctrl+R ---

ok path /opt/fluidnc-v3.4.7-posix/test.nc --- Sending file /opt/fluidnc-v3.4.7-posix/test.nc as /SD/test.nc --- $Xmodem/Receive=/SD/test.nc [MSG:INFO: Received 28 bytes to file /sd/test.nc] ok

Believe me, there is some bad code in Bluetooth...

bdring commented 2 years ago

Closing, user blocked.