S42C CLosed Loop Servo Problem

Hey guys, would like some feedback on the S42C. So I bought s42C’s for my x and y motor on my core xy. In theory, it seemed like a great idea, In reality, it sucked, it seems like the motors are stuck between lagging and lurching. So bad to a point the sync is throwing off my coordinated movements. Any feedback would be greatly appreciated!

Printer Cfg

[stepper_x]                     # Define X stepper
step_pin: P2.2
dir_pin: P2.6
enable_pin: !P2.1                # Enable pin (default is enable high; use ! to indicate enable low).
microsteps: 16                  # The number of microsteps the stepper motor driver uses. 
rotation_distance: 32           # For 16T gear X 2mm pitch GT2 belt.
endstop_pin: ^P1.24
position_endstop: -25            # Location of the endstop (mm)-9.
position_max: 331               # Maximum valid distance (mm) the user may command.
position_min: -25               # Minimum valid distance (mm) the user may command.
homing_speed: 120               # Maximum velocity (in mm/s) of the stepper when homing.
homing_retract_dist: 5          # Distance to backoff (in mm) before homing a second time during homing. Set this to zero to disable the second home.
full_steps_per_rotation: 200 #400    # The number of full steps for one rotation of the stepper motor. 200 for 1.8 motor or 400 for 0.9 motor.
homing_positive_dir: false      # If true, homing will cause the stepper to move in a positive direction (away from zero); if false, home towards zero.
#step_pulse_duration:0.000003
#[tmc2209 stepper_x]       # Define X Driver
#uart_pin: P1.17            # Step GPIO pin (triggered high)
#run_current: 1.750        # The amount of current (in amps RMS) to configure the driver to use during stepper movement. NOTE: my defualt was 1.650 but changed for High speed mode.
#sense_resistor: 0.051     # The resistance (in ohms) of the motor sense resistor
#interpolate: true 
#stealthchop_threshold: 300 # If true, enable step interpolation (the driver will internally step at a rate of 256 micro-steps).

[stepper_y]     # Define Y stepper (check X description).
step_pin: P0.19
dir_pin: P0.20
enable_pin: !P2.8
microsteps: 16
rotation_distance: 32
endstop_pin: ^P1.26
position_endstop: 310
position_min: -15
position_max: 310
homing_speed: 120
homing_positive_dir: true
homing_retract_dist: 5
full_steps_per_rotation: 200 #400
#step_pulse_duration:0.000009

#[tmc2209 stepper_y]     # Define Y Driver (check X description).
#uart_pin: P1.15
#run_current: 1.750
#sense_resistor: 0.051
#interpolate: true
#stealthchop_threshold: 300

[stepper_z]             # Define Z steppers (check X description).
step_pin: P0.22
dir_pin: !P2.11
enable_pin: !P0.21
microsteps: 32
rotation_distance: 8
full_steps_per_rotation: 200
endstop_pin: probe:z_virtual_endstop
position_min: -5.0
position_max: 341
homing_speed: 10.0
homing_retract_dist: 3.0
homing_retract_speed: 20
second_homing_speed: 2.0

[tmc2209 stepper_z]       # Define Z Driver (check X description).
uart_pin: P1.10
run_current: 1.600
sense_resistor: 0.051
interpolate: true

[stepper_z1]            # Define Z1 (second) stepper (check X description).
step_pin: P0.1
dir_pin: !P0.0
enable_pin: !P0.10
microsteps: 32  
rotation_distance: 8
full_steps_per_rotation: 200

[tmc2209 stepper_z1]    # Define Z1 (second) driver (check X description).
uart_pin: P1.1
run_current: 1.600
sense_resistor: 0.051
interpolate: true

[extruder]                            # Define extruder
step_pin: P2.13
dir_pin: P0.11
enable_pin: !P2.12
microsteps: 16
rotation_distance: 4.75 #4.5477
nozzle_diameter: 0.400
filament_diameter: 1.750
full_steps_per_rotation: 200
heater_pin: P2.7
sensor_type: EPCOS 100K B57560G104F      # Type of sensor (Thermistor) NF-sunrise provided Thermistor.
sensor_pin: P0.24
smooth_time: 0.6                      # A time value (in seconds) over which temperature measurements will be smoothed to reduce the impact of measurement noise.
#control = pid                         # Control algorithm (either pid or watermark)
#pid_kp = 23.2
#pid_ki = 2.88  
#pid_kd = 46.7
min_temp: 0
max_temp: 260
min_extrude_temp: 180
max_extrude_only_distance: 500.0
max_extrude_only_velocity: 120
max_extrude_only_accel:    800
pressure_advance: 0.1
pressure_advance_smooth_time: 0.02

[firmware_retraction]
retract_speed: 60
unretract_extra_length: 0
retract_length: 0.5

[tmc2209 extruder]
uart_pin: P1.8
run_current: 0.5
sense_resistor: 0.051
interpolate: true

[heater_bed]
heater_pin: P2.5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: P0.23
#control: pid
#pid_Kp: 49.87
#pid_Ki: 6.4
#pid_Kd: 258.94
min_temp: 0
max_temp: 130
pwm_cycle_time: 0.02

[fan]                     # Print cooling fan
pin: P2.3                 # FAN0
kick_start_time: 0.500    # helps get the fan spinning

[heater_fan nozzle_cooling_fan]
pin: P2.4   #FAN1
max_power: 1.0
kick_start_time: 0.500
heater: extruder
heater_temp: 50
fan_speed: 1.0

[controller_fan my_controller_fan]
pin: mmboard:PC9
stepper:stepper_x

#[fan_generic Chamber_light] # Control the chamber lights: 2 x COB led's strips from the sides connected to FAN2 port.
#pin: PA0  #FAN2
#max_power: 1.0

[mcu] ###### DONT forget to edit the line below with the correct Device ID ######
#serial:/dev/serial/by-id/usb-Klipper_lpc1768_1D200114658C48AFB41B345DC42000F5-if00
serial: /dev/ttyAMA0
restart_method: command


[printer]
kinematics: corexy        #type of machine
max_velocity: 350      
max_accel: 5700          
max_z_velocity: 10  
max_z_accel: 75
max_accel_to_decel: 5700
square_corner_velocity: 5

[mcu rpi]
serial: /tmp/klipper_host_mcu

#[adxl345]
#cs_pin: rpi:None

#[resonance_tester]
#accel_chip: adxl345
#probe_points:
#    155,155,20

#[input_shaper]
#shaper_type_x = mzv
#shaper_freq_x = 71.8
#shaper_type_y = mzv
#shaper_freq_y = 43.8

[bltouch]                          
sensor_pin: ^P1.25
control_pin: P2.0
pin_move_time: 0.680
stow_on_each_sample: False
probe_with_touch_mode: True
pin_up_reports_not_triggered: True
pin_up_touch_mode_reports_triggered: True
set_output_mode: 5V
#x_offset: 0                 # The probe is from the left of the hotend - front look - BLV NF-Sunrise Hotend setup
y_offset: 20
#z_offset: 2.4
speed: 10                         # Probing speed
samples: 2                        # How many times to probe the same point
sample_retract_dist: 2.0          # How far to retract (in mm) from the probe point
samples_result: median
samples_tolerance: .02
samples_tolerance_retries: 5

[safe_z_home]
home_xy_position: 155,135     # (155,155) Change coordinates to the center of your print bed
speed: 200                            # speed of safe homing
z_hop: 10                             # Move up 10mm
z_hop_speed: 5                        # Speed of jump while homing jump


[bed_mesh]                   # mesh of 310x310 minus 5mm each size: 300x300
speed: 300                   # The speed (in mm/s) of non-probing moves during the calibration
horizontal_move_z: 3         # The height (in mm) that the head should be commanded to move to just prior to starting a probe operation
mesh_min: 30,30              # Defines the minimum x,y coordinate of the mesh (relative to the probe's location)
mesh_max: 280,280            # Defines the maximum x,y coordinate of the mesh (relative to the probe's location)
probe_count: 4,4             # defining the number of points to probe along each axis
fade_start: 1.0
fade_end: 10.0
split_delta_z: .01           # The amount of Z difference (in mm) along a move that will trigger a split
move_check_distance: 3
mesh_pps: 2,2
algorithm: bicubic
relative_reference_index: 12 # point index in the mesh to reference all z values to.

[z_tilt]      # Multiple Z stepper tilt adjustment
z_positions:-61,155 
            366,155
points: 10,135
        300,135
speed: 200
horizontal_move_z: 5
retries: 6
retry_tolerance: 0.015

[idle_timeout]
timeout: 1800

[display]
lcd_type: st7920
cs_pin: P1.19  #EXP1_4
sclk_pin: P1.20 #EXP1_5
sid_pin: P1.18 #EXP1_3
encoder_pins: ^P3.26, ^P3.25 #^EXP2_3, ^EXP2_5
click_pin: ^!P0.28 #^!EXP1_2
#kill_pin: ^!

[output_pin BEEPER_pin]
pin: P1.30
#   Beeper pin. This parameter must be provided.
#   ar37 is the default RAMPS/MKS pin.
pwm: True
#   A piezo beeper needs a PWM signal, a DC buzzer doesn't.
value: 0
#   Silent at power on, set to 1 if active low.
shutdown_value: 0
#   Disable at emergency shutdown (no PWM would be available anyway).
cycle_time: 0.001
#   Default PWM frequency : 0.001 = 1ms will give a tone of 1kHz
#   Although not pitch perfect.

#[temperature_sensor Raspberry_cpu] # Pi temperature monitoring
#sensor_type: rpi_temperature
#gcode_id: P

[virtual_sdcard] 
path:~/.octoprint/uploads

[display_status]

[pause_resume]

[save_variables]
filename:~/variables.cfg
    
[gcode_macro z_tilt]
gcode:
    CHECK_HOME 
    Z_TILT_ADJUST
    
[gcode_macro CHECK_HOME]
gcode:
    {% if printer.toolhead.homed_axes != 'xyz' %}
        G28
    {% endif %}

See Mechaduino experiment

All very intresting with the mechaadruino experment, the S42C’s (BIGTREETECH-Stepper-Motor-Driver/BIGTREETECH S42C user manual.pdf at master · bigtreetech/BIGTREETECH-Stepper-Motor-Driver · GitHub) are supposed to be a drop in for the standard A4988, as I understand the mechadruino project uses the feedback and control for the stepper and motor, The S42C it handles all the CSL functions independent of the main MCU. I did find an exerpt of 40ns step rising edge, hopefully changing step_pulse_duration to .00000004 with have some improvements. I was going the other way by making them longer. I’ll post updates sucessfull or not.

Nope, they still suck. Tried printing a benchy, came out like a sad picaso on settings that my previous steppers wouldn’t have struggled with.

This seems to be a Dead thread but I have so many questions and there are no posted answers and BTT seems unable to help me other than pointing me to here. The S42C is suppose to be UART so I am using BTT Octopus Pro V1.0 do I leave the jumper in for UART or pull all the jumpers like installing S42B? In the OP the driver is set up like a TMC2209 not like a standard Driver? Did anyone ever figure out how to make the S42C work?

1 Like

Hi. Did you figure out how to set up the S42C?
I spent a day trying to figure this out and nothing. At the moment stuck with the same question whether to puth the jumpers back in