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.16k stars 19.21k forks source link

[BUG] TMC2209 UART connection error #15012

Closed salacpavel closed 4 years ago

salacpavel commented 5 years ago

Description

TMC UART seems to be broken with 2.0.X bugfix build pulled today from Marlin official repository, at least on BIGTREE_SKR_MINI env. The build compiles all right, but there is now "TMC CONNECTION ERROR" displayed on info screen once this FW image is flashed onto the board. Adittionally, M122 issues "Bad response" for all TMC drivers: Driver registers: X 0x00:00:00:00 Bad response! Y 0x00:00:00:00 Bad response! Z 0x00:00:00:00 Bad response! E 0x00:00:00:00 Bad response! Testing X connection... Error: All LOW Testing Y connection... Error: All LOW Testing Z connection... Error: All LOW Testing E connection... Error: All LOW

Same configuration, is working with image build some two weeks ago.

Steps to Reproduce

Download current build, replace platformio.ini, configuration.h and configuration_adv.h with those attached. Build and flash image on Bigtreetech Mini DIP board, with 4x TMC2209 in UART mode.

Expected behavior: No rerror message on screen, normal response from M122

Actual behavior: as above

Additional Information

platformio.zip Configuration.zip

antibyte commented 5 years ago

I am facing the same errors, tried with TMC2208 and TMC2209 on SKR1.1 On the Scope i can see data beeing sent to the drivers, but LCD says connection error.

antibyte commented 5 years ago

Installed Klipper on the same Board, 2 x TMC2209 + 1X TMC2208 on a single wire working without problems. So it is a bug in Marlin.

GizmoTheGreen commented 5 years ago

afaik SKR Mini baords and btt boards with stm32 mcus need BTT version of TMCStepper. what exactly it changed I don't know but I know it works on my SKR Mini e3 DIP when the normal one does not... https://github.com/bigtreetech/TMCStepper/ also to compile with that lib you need to ass -DHAVE_SW_SERIAL to build flags.

ManuelMcLure commented 5 years ago

Hmmm... I’m having a similar problem on RAMPS/Re-ARM but since this is the first time I’ve used TMC drivers I don’t know if it’s a bug or something I’m doing wrong. I’m using a single pin for both RX and TX which should work...

ManuelMcLure commented 5 years ago

My problem seemed to involve using 1-wire. It didn't work for me at all - I had to use a Y lead and two separate pins on the board for the connection to succeed.

TheZoker commented 5 years ago

+1

If I replace TMCSteppers with the one from BigTreeTech, I get an error and the build fails:

collect2: error: ld returned 1 exit status
*** [.pio/build/BIGTREE SKR MINI/firmware.elf] Error 1
GizmoTheGreen commented 5 years ago

+1

If I replace TMCSteppers with the one from BigTreeTech, I get an error and the build fails:

collect2: error: ld returned 1 exit status
*** [.pio/build/BIGTREE SKR MINI/firmware.elf] Error 1

did you also add -DHAVE_SW_SERIAL to build flags? this seems to be a must if you have bigtreetechs tmcstepper lib

TheZoker commented 5 years ago

No with the flag it worked, thank you :)

matheusmbar commented 5 years ago

The TMCStepper library from BTT implements the software serial library methods. This is required to comunicate with the TMC uart drivers I their boards. The HAL STM32F1 in Marlin firmware implements dummy methods for this library.

Adding -DHAVE_SW_SERIAL to build flags as stated earlier in this issue ignores the Dummy software serial library from Marlin so the build works and the TMC Connection error goes away.

Should Marlin implement the real software serial library for STM32F1 ?

PS: my test case is running SKR E3 DIP with tmc2208s

Grogyan commented 5 years ago

I followed the same steps. Get the same errors

SKR1.3 + 2209

lightface79 commented 5 years ago

Same error on SKR 1.3 lcd says tmc connection error If i do a M122 It reads the 2208 drivers but get X 0x00:00:00:00 Bad response! Testing X connection... Error: All LOW

only have 1 2208 driver in my test bench

and cant jog my X axis from lcd.

Latest build of today fresh DL

lightface79 commented 5 years ago

What is the solution?

Grogyan commented 5 years ago

I don't know There are the same issues raised on teemuatlut's GitHub

As well as on the Discord channel

Grogyan commented 5 years ago

@lightface79 Board needs to be powered externally not from USB

samnangor commented 5 years ago

SKR1.3 + 2209 Same problem 0x00:00:00:00 Bad response!

samnangor commented 5 years ago

SKR1.3 + 2209 Same problem 0x00:00:00:00 Bad response! with 24V external power supply.

Grogyan commented 5 years ago

@samnangor Please provide configs. I tested the SKR 1.3 + 2209 last night with the Marlin Bug Fix from that time

samnangor commented 5 years ago

Here is my config Thanks for your help. Marlin.zip

Grogyan commented 5 years ago

ZIP is invalid

samnangor commented 5 years ago

Configuration.zip Here is a compress file

Grogyan commented 5 years ago

Configuration_ADV.h is needed too

samnangor commented 5 years ago

Configuration.zip This one include Configuration.h Configuration_adv.h

Grogyan commented 5 years ago

define SERIAL_PORT 0

Should be -1

samnangor commented 5 years ago

Thanks Grogyan, How about SERIAL_PORT 2?

samnangor commented 5 years ago

Compile with SERIAL_PORT_0 -1 Run Pronterface command M122 Driver registers: X 0x00:00:00:00 Bad response! Y 0x00:00:00:00 Bad response!

Grogyan commented 5 years ago

Watterot or BTT 2209?

On Fri, 30 Aug 2019, 12:14 samnangor, notifications@github.com wrote:

Compile with SERIAL_PORT_0 -1 Run Pronterface command M122 Driver registers: X 0x00:00:00:00 Bad response! Y 0x00:00:00:00 Bad response!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/15012?email_source=notifications&email_token=ABSQWGWR75CFF3J5ZTTPTJLQHBQ63A5CNFSM4IN5B6H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QFE4A#issuecomment-526406256, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSQWGXK3H2SZXV3LYCNHHLQHBQ63ANCNFSM4IN5B6HQ .

samnangor commented 5 years ago

This is what it prints on the PCB ACCA 1929 FYSETC Silent 2209 V2.1

Grogyan commented 5 years ago

Make sure the PDN UART jumper is soldered

On Fri, 30 Aug 2019, 12:26 samnangor, notifications@github.com wrote:

This is what it prints on the PCB ACCA 1929 FYSETC Silent 2209 V2.1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/15012?email_source=notifications&email_token=ABSQWGXJ42SRIK43RBSITQTQHBSMDA5CNFSM4IN5B6H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QFU4I#issuecomment-526408305, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSQWGQFGGNLYJHEKVN7ZHTQHBSMDANCNFSM4IN5B6HQ .

samnangor commented 5 years ago

I am still looking for PDN UART jumper location on my TMC2209 PCB Thanks again Grogyan.

samnangor commented 5 years ago

Found it, I have to short between Tx and Rx

Exioncore commented 5 years ago

I've just received my SKR 1.3 board and 4 GEEETECH TMC2208 and I'm also getting "Bad response" on all 4. I have soldered the jumper pad for the UART on the drivers, set all the jumpers correctly on the SKR and the drivers do work as I can manually move them via the LCD. How to fix this?

lightface79 commented 5 years ago

Erik9519 I solved my problem om ny stepper errors. Need to power the board externaly from 12 or 24v so no USB powereing the board. Set the dip to ext power.

Second thing That was wrong was i had 3 pads on my 2208 and u should Only have the middle pad and one or the other left or right pads solderd together with the middle one. I had mine solderd go the wrong pad. So the uart was in the wrong pin to the skr1.3

lightface79 commented 5 years ago

So when i changed the pads the uart was working perfect.

lightface79 commented 5 years ago

Then came the second issue. Since my drivers worked like yours in standalone mode.

When the uart mode worked i could not move my steppers..

Found out that i needed to disabel software_enable

Then everything worked like a charm

Exioncore commented 5 years ago

@lightface79 After some extensive debugging over the Marlin Discord we came to the conclusion that to solve my problem I had to solder together the unmarked pin on my drivers with the PDN pin on top of soldering the uart pad (my drivers have only 2 pads not 3 for the UART). Once I did that they worked just fine in UART mode.

These were the drivers: GEEETECH TMC2208 https://www.amazon.de/GEEETECH-TMC2208-Stepstick-Heatsink-Screwdriver/dp/B07MZTCSZY

boelle commented 4 years ago

@salacpavel still having problems?

samnangor commented 4 years ago

Not the same problem though  I  cannot make my extruder fan come on automatically It should come on when extruder temperature goes above 50 I have tried to raise the temperature to 80 and it still won't run.  It will turn on and off manually when I send Gcode command. Attached is the file Thanks

TheZoker commented 4 years ago

So I updated to the latest commit today and get this issue with the bigtreetech TMCStepper library:

In file included from Marlin\src\module/stepper/indirection.h:44:0,
                 from Marlin\src\module/stepper.h:47,
                 from Marlin\src\Marlin.cpp:37:
Marlin\src\module/stepper/trinamic.h:31:4: error: #error "Update TMCStepper library to 0.5.0 or newer."
   #error "Update TMCStepper library to 0.5.0 or newer."
    ^~~~~
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\abl\abl.cpp.o
In file included from Marlin\src\feature\../module/stepper/indirection.h:44:0,
                 from Marlin\src\feature\../module/stepper.h:47,
                 from Marlin\src\feature\babystep.cpp:30:
Marlin\src\feature\../module/stepper/trinamic.h:31:4: error: #error "Update TMCStepper library to 0.5.0 or newer."
   #error "Update TMCStepper library to 0.5.0 or newer."
    ^~~~~
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\bedlevel.cpp.o
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\mbl\mesh_bed_leveling.cpp.o
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\ubl\ubl.cpp.o
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\ubl\ubl_G29.cpp.o
*** [.pio\build\STM32F103R_bigtree\src\src\Marlin.cpp.o] Error 1
*** [.pio\build\STM32F103R_bigtree\src\src\feature\babystep.cpp.o] Error 1

Does anyone got a clue about that?

boelle commented 4 years ago

Not the same problem though  I  cannot make my extruder fan come on automatically It should come on when extruder temperature goes above 50 I have tried to raise the temperature to 80 and it still won't run.  It will turn on and off manually when I send Gcode command. Attached is the file Thanks

you can not attach files from email, you have to use github website

boelle commented 4 years ago

So I updated to the latest commit today and get this issue with the bigtreetech TMCStepper library:

In file included from Marlin\src\module/stepper/indirection.h:44:0,
                 from Marlin\src\module/stepper.h:47,
                 from Marlin\src\Marlin.cpp:37:
Marlin\src\module/stepper/trinamic.h:31:4: error: #error "Update TMCStepper library to 0.5.0 or newer."
   #error "Update TMCStepper library to 0.5.0 or newer."
    ^~~~~
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\abl\abl.cpp.o
In file included from Marlin\src\feature\../module/stepper/indirection.h:44:0,
                 from Marlin\src\feature\../module/stepper.h:47,
                 from Marlin\src\feature\babystep.cpp:30:
Marlin\src\feature\../module/stepper/trinamic.h:31:4: error: #error "Update TMCStepper library to 0.5.0 or newer."
   #error "Update TMCStepper library to 0.5.0 or newer."
    ^~~~~
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\bedlevel.cpp.o
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\mbl\mesh_bed_leveling.cpp.o
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\ubl\ubl.cpp.o
Compiling .pio\build\STM32F103R_bigtree\src\src\feature\bedlevel\ubl\ubl_G29.cpp.o
*** [.pio\build\STM32F103R_bigtree\src\src\Marlin.cpp.o] Error 1
*** [.pio\build\STM32F103R_bigtree\src\src\feature\babystep.cpp.o] Error 1

Does anyone got a clue about that?

look for this in your error: Update TMCStepper library to 0.5.0 or newer

it might give you a clue :-D

TheZoker commented 4 years ago

@boelle But are the issues with the original TMCStepper library fixed?

boelle commented 4 years ago

i have no clue, that is why i ask

personally i use DRV8825 and TMC2100 and those dont require drivers at all

TheZoker commented 4 years ago

I changed the library back to the original library and uploaded the firmware to my ender 3 and the TMC connection error is still present.

So now the issue is:

boelle commented 4 years ago

and you did update to version 0.5.0 ?

TheZoker commented 4 years ago

I used the original library annotation and from the .pio/libdeps/TMCStepper folder I can see, that pio installed version 0.5.0: Screenshot_2019 09 25_21h09m30s_003_

boelle commented 4 years ago

very strange that says to update to 0.5.0 :-/

TheZoker commented 4 years ago

@thinkyhead Any idea about this error?

randellhodges commented 4 years ago

@TheZoker There is 2 TMCStepper folders in your screenshot. Maybe removed the one without a suffix, or the entire libdeps folder and let it download fresh again?

TheZoker commented 4 years ago

Just tried that (removing the whole folder and let it download all the libs again) but same, TMC connection error: 20190925_221023

This seems to be the explanation of the TMC connection issue: https://github.com/MarlinFirmware/Marlin/issues/15012#issuecomment-525572365

It was possible to work around this by using the bigtreetech TMCStepper library, but yeah, that one does not compile anymore...

randellhodges commented 4 years ago

Oh sorry, I didn't realize you were talking about a runtime error, I thought it was the compile error people were getting. Good to know because I have a SKR 1.3 that I was getting ready to put in my 2209 steppers. I have the firmware compiled, just haven't gotten around to updating yet. I guess I'll wait :)