Custom stepper motor configuration
I've Manta M8P v1.0 with Fysetc TMC5160 v1.2. And HRP-36-300 PSU for motors, i know that's better to use 48v, but i was not very sure in possibilities of Fysetc TMC5160.
I've all drivers TMC5160 on each motor.
Motors:
Rcoil: 1.69 Om
Inductance: 2.6 mH
Current: 1.8A
Trying to figure out how to properly make a profile for motors.
Can somebody explain me, please.
So
For example
[tmc5160 stepper_y]
cs_pin: y_uart_pin
spi_software_mosi_pin: stepper_spi_mosi_pin
spi_software_miso_pin: stepper_spi_miso_pin
spi_software_sclk_pin: stepper_spi_sclk_pin
run_current: 1.768
#( Blank time setting (0-3; default: 2)
driver_TBL: 1
#( Typical values are in the range 3 to 8. Duration of slow decay phase (twice per chopper cycle))
driver_TOFF: 3
driver_HEND: 3
driver_HSTRT: 3
According to a tmc table
Can anyone explain to me what the TBL / TOFF parameters are mainly responsible for and how to select the dependent HEND / HSTRT parameters
45 Replies
absent-sapphireβ’2y ago
As I understand it, the best option is to take an oscilloscope and empirically try to choose the parameters, looking at the waveform.
absent-sapphireβ’2y ago
absent-sapphireβ’2y ago
absent-sapphireβ’2y ago
=======================
Config error
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect
self._read_config()
File "/home/pi/klipper/klippy/klippy.py", line 141, in _read_config
self.load_object(config, section_config.get_name(), None)
File "/home/pi/klipper/klippy/klippy.py", line 130, in load_object
self.objects[section] = init_func(config.getsection(section))
File "/home/pi/klipper/klippy/extras/tmc2209.py", line 101, in load_config_prefix
return TMC2209(config)
File "/home/pi/klipper/klippy/extras/tmc2209.py", line 61, in init
self.mcu_tmc = tmc_uart.MCU_TMC_uart(config, Registers, self.fields, 3,
File "/home/pi/klipper/klippy/extras/tmc_uart.py", line 219, in init
self.instance_id, self.addr, self.mcu_uart = lookup_tmc_uart_bitbang(
File "/home/pi/klipper/klippy/extras/tmc_uart.py", line 191, in lookup_tmc_uart_bitbang
rx_pin_params = ppins.lookup_pin(config.get('uart_pin'), can_pullup=True,
File "/home/pi/klipper/klippy/configfile.py", line 57, in get
return self._get_wrapper(self.fileconfig.get, option, default,
File "/home/pi/klipper/klippy/configfile.py", line 32, in _get_wrapper
raise error("Option '%s' in section '%s' must be specified"
configparser.Error: Option 'uart_pin' in section 'tmc2209 stepper_x' must be specified
absent-sapphireβ’2y ago
foreign-sapphireβ’2y ago
Can you upload printer.cfg please
absent-sapphireβ’2y ago
A second
absent-sapphireβ’2y ago
absent-sapphireβ’2y ago
This is
absent-sapphireβ’2y ago
foreign-sapphireβ’2y ago
Line 46,57,58 try uncomment
absent-sapphireβ’2y ago
Option 'aliases' in section 'board_pins manta_m8p_tmc2209' must have 2 elements
Option 'uart_pin' in section 'tmc2209 stepper_x' must be specified π
Ok, than i'll try to comment it
foreign-sapphireβ’2y ago
But you are not using tmc2209?
absent-sapphireβ’2y ago
I'm using 5160 , but there no config file for 5160
As i understand 5160 inherits from 2209
I've comment it
And now i'me loose conection to MCU
mcu 'mcu': Starting serial connect
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/btt-manta-m8p: [Errno 2] No such file or directory: '/dev/btt-manta-m8p'
webhooks client 281473560382720: New connection
webhooks client 281473560382720: Client info {'program': 'Moonraker', 'version': 'v0.8.0-30-g110cbd1'}
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/btt-manta-m8p: [Errno 2] No such file or directory: '/dev/btt-manta-m8p'
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/btt-manta-m8p: [Errno 2] No such file or directory: '/dev/btt-manta-m8p'
foreign-sapphireβ’2y ago
What did you change?
I dont why you try to use both 2209 and 5169 configs at the same time π€·ββοΈ
absent-sapphireβ’2y ago
I've commented line 46/57/58
foreign-sapphireβ’2y ago
And that make you loose connection to MCU?
absent-sapphireβ’2y ago
Yes O_o
[ 315.671854] usb 2-1.4: USB disconnect, device number 4
[ 317.452877] usb 2-1.4: new full-speed USB device number 5 using ehci-platform
[ 317.683466] usb 2-1.4: New USB device found, idVendor=0483, idProduct=df11, bcdDevice= 2.00
[ 317.683496] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 317.683505] usb 2-1.4: Product: DFU in FS Mode
[ 317.683513] usb 2-1.4: Manufacturer: STMicroelectronics
[ 317.683520] usb 2-1.4: SerialNumber: 2087377A464B
[ 693.722091] usb 2-1.4: USB disconnect, device number 5
[ 695.523289] usb 2-1.4: new full-speed USB device number 6 using ehci-platform
[ 695.757903] usb 2-1.4: New USB device found, idVendor=1d50, idProduct=614e, bcdDevice= 1.00
[ 695.757935] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 695.757944] usb 2-1.4: Product: stm32g0b1xx
[ 695.757952] usb 2-1.4: Manufacturer: Klipper
[ 695.757959] usb 2-1.4: SerialNumber: m8p
[ 695.760295] cdc_acm 2-1.4:1.0: ttyACM0: USB ACM device
biqu@ratos:~$ ls /dev/ | grep m8
biqu@ratos:~$ find /dev/ -name m8*
biqu@ratos:~$ cd /dev
biqu@ratos:/dev$ ls serial/
by-id by-path
biqu@ratos:/dev$ ls serial/by-id/
usb-Klipper_stm32g0b1xx_m8p-if00
biqu@ratos:/dev$
Ok, ive fixed it
Now i've problem
Pin 'adxl345_cs_pin' is not a valid pin name on mcu 'mcu'
foreign-sapphireβ’2y ago
Uncomment adxl for now then
absent-sapphireβ’2y ago
The same thing, and i dont have adxl connected to motherboard , i've it on a toolboard
foreign-sapphireβ’2y ago
you have not selected a toolboard in your config
absent-sapphireβ’2y ago
selected , no changes
flashed it
absent-sapphireβ’2y ago
absent-sapphireβ’2y ago
Pin 'adxl345_cs_pin' is not a valid pin name on mcu 'mcu' again
absent-sapphireβ’2y ago
foreign-sapphireβ’2y ago
accel
adxl345_cs_pin=PB12, adxl345_miso=PB2, adxl345_mosi=PB11, adxl345_clk=PB10,
[adxl345]
spi_software_mosi_pin: stepper_spi_mosi_pin
spi_software_miso_pin: stepper_spi_miso_pin
spi_software_sclk_pin: stepper_spi_sclk_pin
cs_pin: adxl345_cs_pin
id try rework that and see if it fires up
not sure why its calling for adxl pin when its disabled in the first config tho
absent-sapphireβ’2y ago
That's for a toolboard ?
absent-sapphireβ’2y ago
I've deleted my board_pins aliases for motors and then it works
foreign-sapphireβ’2y ago
Nice π
Nvm the adxl pins then
absent-sapphireβ’2y ago
But i've to return my motor pins
[board_pins manta_m8p_tmc2209]
aliases:
z0_step_pin=PC9, z0_dir_pin=PC8, z0_enable_pin=PD1, z0_uart_pin=PD0, z0_diag_pin=null,
z1_step_pin=PA10, z1_dir_pin=PD15, z1_enable_pin=PA15, z1_uart_pin=PF8, z1_diag_pin=null,
z2_step_pin=PD12, z2_dir_pin=PD11, z2_enable_pin=PD14, z2_uart_pin=PD13, z2_diag_pin=null
accel
adxl345_cs_pin=PB12, adxl345_miso=PB2, adxl345_mosi=PB11, adxl345_clk=PB10
[adxl345]
spi_software_mosi_pin: stepper_spi_mosi_pin
spi_software_miso_pin: stepper_spi_miso_pin
spi_software_sclk_pin: stepper_spi_sclk_pin
cs_pin: adxl345_cs_pin
[tmc5160 stepper_z]
cs_pin: z0_uart_pin
run_current: 1.6
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 3
driver_HSTRT: 6
[tmc5160 stepper_z1]
cs_pin: z1_uart_pin
run_current: 1.6
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 3
driver_HSTRT: 6
[tmc5160 stepper_z2]
cs_pin: z2_uart_pin
run_current: 1.6
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 3
driver_HSTRT: 6
Like this ?
foreign-sapphireβ’2y ago
No clue rly
absent-sapphireβ’2y ago
Pin 'x_uartpin' is not a valid pin name on mcu 'mcu'
Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
Printer is halted >> what... ok for today
But i have other info in config file
absent-sapphireβ’2y ago
That's my current config...wtf
absent-sapphireβ’2y ago
I don't understand why this causes so many problems, I just need to change the position of the motor drivers, place Z0, Z1, Z2 on the 5,6,7 slot.
@miklschmidt I know it might be rude to ask you for help with such a simple problem, but I've spent all day today trying to figure out the error. But please, please help, can you point out what is wrong.
foreign-sapphireβ’2y ago
Id try specifically add steppers in override if i were you.
foreign-sapphireβ’2y ago
Mine looks like this
Do not override the board pin alias.
Advanced Stepper Configuration | RatOS
RatOS V1.1 introduced modularized stepper and driver configuration, this can be used for more fine grained control of your steppers. In your printer.cfg you might have noticed a section like this:
It's all there
in your case, you just replace the relevant stepper includes with your own tmc sections.
absent-sapphireβ’2y ago
It's just that it was not written anywhere that the pins of the board cannot be reassigned.
So it's easier for me to write the same thing, but just in the description of stepper drivers?
Ok, thank you
I'm sorry, I misunderstood your statement on the site specifically rewriting pins.
Those. in fact, there are other configs further down the line of inheritance that use the motherboard config. But it is very strange why something breaks conditionally that does not depend on it ...
Or does it in this case use only a part of the pins that are redefined and break from this?
Those. in theory, if you redefine all the pins, would it work? But I understand that this is not the way to do it. I was just trying to learn a python parser that generates a generic config file.
Those. in theory, if you redefine all the pins, would it work? But I understand that this is not the way to do it. I was just trying to learn a python parser that generates a generic config file.
There are no redefinitions. You can always resort to using the board's pin names. The board alias configuration is only there for board abstraction. As a user, you don't care about that, you're not switching boards all the time.
Eg. there's no benefit or reason for redefining the alias, just leave it be π
absent-sapphireβ’2y ago
Thank you for the explanation!
I still need to connect the ups board to the mainboard, but so far, as I understand it, there will be no support for it? In principle, my board works from ups for about two minutes without mains power.
Not out of the box support no, but you are free to do anything you want, so you can configure it yourself π
absent-sapphireβ’2y ago
I last used a klipper 4 years ago, now it's completely different, and I'm shooting myself in the legs trying to do it the way I used to. Yes, and old habits after Marlin, I still canβt figure out the structure, and what depends on what and how it works.
It's not very complicated, ignore the RatOS configuration, focus on the user override section and pretend like the rest doesn't exist. Then go to the klipper config reference and pick out what you need from there.