MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.23k forks source link

TMC2130 driver error after update #10133

Closed sh4jonny closed 6 years ago

sh4jonny commented 6 years ago

hi after a long time work with 2130 i update to last 2.0 branch 2.2.0 lib. and have a error. Other hardware is Arduino DUE and RAMPS4DUE. X Y with tmc2130. here is a Pronterface output:

echo:SD card ok
¬ы;Hючjыёс driver error detected:
        ¬ы;Hючjыёс  ;Hючjыёс
Enabled     false   false
Set current 825 825
RMS current 1436    1436
MAX current 2025    2025
Run current 25/31   25/31
Hold current    12/31   12/31
CS actual       0/31    0/31
PWM scale   7   96
vsense      0=.325  0=.325
stealthChop false   false
msteps      256 256
tstep       6   128
pwm
threshold       0   0
[mm/s]      -   -
OT prewarn  false   false
OT prewarn has
been triggered  false   false
off time        0   0
blank time  16  16
hysteresis
-end        -3  -1
-start      1   1
Stallguard thrs 0   0
DRVSTATUS   ¬ы;Hючjыёс  ;Hючjыёс
stallguard
sg_result       0   0
fsactive
stst
olb
ola
s2gb
s2ga
otpw
ot
Driver registers:   ¬ы;Hючjыёс = 0x00:00:00:00
    ;Hючjыёс = 0x00:00:00:0F
Error:Printer halted. kill() called!
[ERROR] Error:Printer halted. kill() called!

also i have pins debug output

>>> m43
SENDING:M43
echo:SD card ok
PIN: 00        RXD                                    Input  = 1
PIN: 01        TXD                                    Input  = 1
PIN: 02        <unused/unknown>                       Input  = 1
PIN: 03        X_MIN_PIN                              protected
PIN: 04        <unused/unknown>                       Input  = 1
PIN: 05        <unused/unknown>                       Input  = 1
PIN: 06        <unused/unknown>                       Input  = 1
PIN: 07        <unused/unknown>                       Input  = 1
PIN: 08        HEATER_BED_PIN                         protected
.              RAMPS_D8_PIN                           protected
PIN: 09        FAN_PIN                                protected
.              RAMPS_D9_PIN                           protected
PIN: 10        HEATER_0_PIN                           protected
.              RAMPS_D10_PIN                          protected
PIN: 11        E0_AUTO_FAN_PIN                        protected
PIN: 12        FAN1_PIN                               protected
PIN: 13        LED_PIN                                Input  = 1
PIN: 14        <unused/unknown>                       Input  = 1
PIN: 15        Y_MAX_PIN                              protected
PIN: 16        LCD_PINS_RS                            Output = 0
PIN: 17        LCD_PINS_ENABLE                        Output = 0
PIN: 18        Z_MIN_PIN                              protected
PIN: 19        <unused/unknown>                       Input  = 1
PIN: 20        <unused/unknown>                       Input  = 1
PIN: 21        <unused/unknown>                       Input  = 1
PIN: 22        <unused/unknown>                       Input  = 1
PIN: 23        LCD_PINS_D4                            Output = 0
PIN: 24        E0_ENABLE_PIN                          protected
PIN: 25        LCD_PINS_D5                            Input  = 1
PIN: 26        E0_STEP_PIN                            protected
PIN: 27        LCD_PINS_D6                            Input  = 1
PIN: 28        E0_DIR_PIN                             protected
PIN: 29        LCD_PINS_D7                            Input  = 1
PIN: 30        E1_ENABLE_PIN                          Output = 0
PIN: 31        BTN_EN1                                Input  = 1
PIN: 32        <unused/unknown>                       Input  = 1
PIN: 33        BTN_EN2                                Input  = 1
PIN: 34        E1_DIR_PIN                             Output = 0
PIN: 35        BTN_ENC                                Input  = 1
PIN: 36        E1_STEP_PIN                            Output = 0
PIN: 37        BEEPER_PIN                             Output = 0
PIN: 38        X_ENABLE_PIN                           protected
PIN: 39        <unused/unknown>                       Input  = 1
PIN: 40        Y_CS_PIN                               protected
PIN: 41        KILL_PIN                               Input  = 1
PIN: 42        X_CS_PIN                               protected
PIN: 43        <unused/unknown>                       Input  = 1
PIN: 44        <unused/unknown>                       Input  = 1
PIN: 45        <unused/unknown>                       Input  = 1
PIN: 46        Z_STEP_PIN                             protected
PIN: 47        <unused/unknown>                       Input  = 1
PIN: 48        Z_DIR_PIN                              protected
PIN: 49        SD_DETECT_PIN                          Input  = 0
PIN: 50        <unused/unknown>                       Input  = 1
PIN: 51        <unused/unknown>                       Input  = 1
PIN: 52        SDSS                                   Output = 1
.              SS_PIN                                 Output = 1
PIN: 53        <unused/unknown>                       Input  = 1
PIN: 54 (A 0)  X_STEP_PIN                             protected
PIN: 55 (A 1)  X_DIR_PIN                              protected
PIN: 56 (A 2)  Y_ENABLE_PIN                           protected
PIN: 57 (A 3)  <unused/unknown>   Analog in =   909   Input  = 1
PIN: 58 (A 4)  <unused/unknown>   Analog in =   851   Input  = 1
PIN: 59 (A 5)  TEMP_0_PIN                             protected
PIN: 60 (A 6)  Y_STEP_PIN                             protected
PIN: 61 (A 7)  Y_DIR_PIN                              protected
PIN: 62 (A 8)  Z_ENABLE_PIN                           protected
PIN: 63 (A 9)  <unused/unknown>   Analog in =   934   Input  = 1
PIN: 64 (A10)  <unused/unknown>   Analog in =   987   Input  = 1
PIN: 65 (A11)  TEMP_BED_PIN                           protected
PIN: 66        MAX6675_SS                             Input  = 1
PIN: 67        <unused/unknown>                       Input  = 1
PIN: 68        <unused/unknown>                       Input  = 1
PIN: 69        <unused/unknown>                       Input  = 1
PIN: 70        <unused/unknown>                       Input  = 1
PIN: 71        <unused/unknown>                       Input  = 1
PIN: 72        <unused/unknown>                       Input  = 1
PIN: 73        <unused/unknown>                       Input  = 1
PIN: 74        MISO_PIN                               Input  = 1
PIN: 75        MOSI_PIN                               Input  = 1
PIN: 76        SCK_PIN                                Input  = 1
PIN: 77        <unused/unknown>                       Input  = 0
PIN: 78        <unused/unknown>                       Input  = 1

maybe i lost some definitions when merge configs? thank you!

MikeInNs commented 6 years ago

@Bob-the-Kuhn, that worked like a charm! The 10K pull down on the MISO line did the trick, SD working together with the MONITOR_DRIVER_STATUS flag!! You're a life saver, thanks so much Bob!

Bob-the-Kuhn commented 6 years ago

@sh4jonny - please see if this version of bugfix-2.0.x fixes your problem. I've closed several holes in the DUE code in PR #10299.

@teemuatlut - this PR makes the DUE hardware SPI play nicely with the TMC2130 library. After the SD card access is completed the next TMC2130 access sets the SPI back to 2 MHz, mode 3.

Bob-the-Kuhn commented 6 years ago

@MikeInNs - adding a pull down to the MISO pin may be a red herring. I'm wondering if it's really a power up issue.

I went back today to see if setting the TMC2130 SPI mode to 0 or 3 made any difference in the need for the pull down resistor. To my horror none of the five TMC2130s responded correctly. Sometimes after a power up a part would be dead (no response on the MISO line at all) , sometimes it responded with all high bits and sometimes it worked properly. Usually the five were a mixture of the two failing states. Never was there a functional unit along with failing units.

After one power up all five were functional. Once in that mode it didn't make any difference if the pull down was present or not or if the SPI mode was 0 or 3.

Pressing the reset button didn't affect anything. Only a power cycle changed things.

MikeInNs commented 6 years ago

@Bob-the-Kuhn, that is interesting, without the 10K pull-down I never had a successful boot with the SD Card inserted, always ended in 'Driver Error'. And believe me, I tried it many times, changing the configuration, trying different pins etc.

I am still running the same Marlin Dev version so the only thing I changed yesterday was adding the resistor and commenting out the 'MONITOR_DRIVER_STATUS' and my first successful boot was a fact.

If you want me to test something for you down the road just let me know, the least I can do.

teemuatlut commented 6 years ago

MONITOR_DRIVER_STATUS is the particular feature that will throw the "Driver error" message when it sees an error reported.

Bob-the-Kuhn commented 6 years ago

I had a couple of bad crimps in my daisy chain on different signals. For a half hour it worked great, wouldn't work for 6 hours, ...

I ended up throwing the daisy chain away and building a star. I super glued some headers to a perfboard and then bussed the signals via solder connections. Prettier than the daisy chain but still an ugly octopus.

DuoDreamer commented 6 years ago

I've been banging my head against a wall until I saw this thread today. Y driver would always fail when powered via PSU. I have a very short daisy-chained 5-driver cable (no pulldown). Turns out that disabling SD support (I never use it) and cutting the SPI speed to Quarter made everything work perfectly.

Bob-the-Kuhn commented 6 years ago

@DuoDreamer - what controller are you using?

DuoDreamer commented 6 years ago

Hi Bob, sorry about that, this one is a MKS Gen-L. I had the same problem with a plain RAMPS setup before I got these as well. I've also bought more 2130's to bash on a Cohesion3D Remix (LPC17xx) in the future.

Bob-the-Kuhn commented 6 years ago

I just moved my TMC2130s to my RE_ARM board. I had to use the TMC software SPI and, because I'm using a RepRap Full Graphic LCD, I had to use different pins for the TMC SPI.

I'm pretty sure you'll need to use the TMC software SPI on the Cohesion3D Remix. The RepRap Full Graphic LCD can't share SPI pins with the TMC2130s. The LCD will have garbage on the screen because that LCD doesn't respect the slave select goin to it.

I didn't try my 2560/ramps/TMC2130 system with an external supply. All I ever did was loop the *5V power (from the USB) back to the + motor terminal on the power connector.

sh4jonny commented 6 years ago

@Bob-the-Kuhn sorry for the long time reply... i check last bugfix-2.0.x branch today and it work for me! now i can to use a SD card and HW TMC2130 at the same time. thank you

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.