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.3k stars 19.25k forks source link

Issues with TMC2660 drivers and two extruders #12969

Closed andyman198 closed 5 years ago

andyman198 commented 5 years ago

Description

I am using an Azteeg X5 GT with TMC2660 drivers and two extruders. When compiling using the new version I initially get this:

Marlin\src\module/stepper_indirection.h:65:46: error: 'TMCTMC2660Stepper' was not declared in this scope

define __TMC_CLASS(MODEL, A, I) TMCMarlin<TMC##MODEL##Stepper, A, I>

Marlin\src\module/stepper_indirection.h:66:32: note: in expansion of macro '__TMC_CLASS'

define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L)

^~~

I can get past this by adding these lines to stepper_indirection.h

define ____TMC_CLASS(MODEL, A, I) TMCMarlin<TMC##MODEL##Stepper, A, I>

define _TMC_CLASS(MODEL, A, I) __TMC_CLASS(MODEL, A, I)

define TMCCLASS(MODEL, A, I) TMCCLASS(##MODEL, A, I)

define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L)

define TMC_CLASS(ST) _TMC_CLASS(ST##_DRIVERTYPE, TMC##ST##_LABEL)

But then I get errors with the E1 Axis

Marlin\src\feature\tmc_util.cpp: In function 'void init_tmc_section()': Marlin\src\feature\tmc_util.cpp:1015:36: error: 'E1_AXIS_N' was not declared in this scope stepperE1.init_lcd_variables(E1_AXIS_N(1)); ^~~~~ Marlin\src\feature\tmc_util.cpp:1015:36: note: suggested alternative: 'E_AXIS_N' stepperE1.init_lcd_variables(E1_AXIS_N(1));

Looking at the TMCStepper library it looks like it might not fully support multiple extruders.

If I set it to 1 extruder it will them compile with the fix above

Steps to Reproduce

Set X, Y, Z, E0 and E1 axis to TMC2660 Set Number of extruders = 2 Set thermistor 0 and 1 to >0

andyman198 commented 5 years ago

As a workaround to get it to compile, I changed tmc_util.cpp line 1015 to:

#if AXIS_IS_TMC(E1)
  //stepperE1.init_lcd_variables(E1_AXIS_N(1));
  stepperE1.init_lcd_variables(E_AXIS);
#endif

I'm sure @teemuatlut or one of the other TMC Sages will have a better idea for a solution.

teemuatlut commented 5 years ago

The first issue sure needs a fix as discussed elsewhere.

The second suggests changes on your own copy. This is what the code looks like upstream: https://github.com/MarlinFirmware/Marlin/blob/e1f951813a5552c202cd1d291dc8884af94c6a59/Marlin/src/feature/tmc_util.cpp#L1014-L1016

andyman198 commented 5 years ago

I have the same as the upstream? I made a change to allow it to compile. It won’t compile as it is from the copy. Says E_AXIS_N(1) undefined.


From: teemuatlut notifications@github.com Sent: Sunday, January 20, 2019 1:33 PM To: MarlinFirmware/Marlin Cc: Andy Vickers; Author Subject: Re: [MarlinFirmware/Marlin] Issues with TMC2660 drivers and two extruders (#12969)

The first issue sure needs a fix as discussed elsewhere.

The second suggests changes on your own copy. This is what the code looks like upstream: https://github.com/MarlinFirmware/Marlin/blob/e1f951813a5552c202cd1d291dc8884af94c6a59/Marlin/src/feature/tmc_util.cpp#L1014-L1016https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMarlinFirmware%2FMarlin%2Fblob%2Fe1f951813a5552c202cd1d291dc8884af94c6a59%2FMarlin%2Fsrc%2Ffeature%2Ftmc_util.cpp%23L1014-L1016&data=02%7C01%7C%7C16303bafb58f4044327008d67f05c196%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836060027028265&sdata=uAjrGLOpRaFl%2FmynkAacA9OSwiJAqixbEsYTXMS9BQM%3D&reserved=0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMarlinFirmware%2FMarlin%2Fissues%2F12969%23issuecomment-455890635&data=02%7C01%7C%7C16303bafb58f4044327008d67f05c196%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836060027028265&sdata=xoTOvFKcpkuu8RP8X5nu1jQTZSIAOSi5lj5yOkrLqc0%3D&reserved=0, or mute the threadhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARYSWRWccIh41XPczFhvqyEcYaka6tdUks5vFLZwgaJpZM4aJsdk&data=02%7C01%7C%7C16303bafb58f4044327008d67f05c196%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836060027028265&sdata=74dWedRACYPlCEeCnp82gkqrMyGOgC43oCVwOR61uSU%3D&reserved=0.

teemuatlut commented 5 years ago

Here's your compile error message: E1_AXIS_N was not declared in this scope Here's upstream: E_AXIS_N

andyman198 commented 5 years ago

I will check and get back to you. I wiped out the marlin directory and did a new clone before I compiled so not sure where the discrepancy would have come from.


From: teemuatlut notifications@github.com Sent: Sunday, January 20, 2019 5:59 PM To: MarlinFirmware/Marlin Cc: Andy Vickers; Author Subject: Re: [MarlinFirmware/Marlin] Issues with TMC2660 drivers and two extruders (#12969)

Here's your compile error message: E1_AXIS_N was not declared in this scope Here's upstream: E_AXIS_N

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMarlinFirmware%2FMarlin%2Fissues%2F12969%23issuecomment-455910817&data=02%7C01%7C%7C7dea7d2216314623ff4108d67f2aed8a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836219674451803&sdata=1oqfmt9vbkvek%2FZDz846lWBaxeT1kA90F52%2FLmoFDNM%3D&reserved=0, or mute the threadhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARYSWX7yFx1-Uxzu8v91nGewxT5egWxzks5vFPTOgaJpZM4aJsdk&data=02%7C01%7C%7C7dea7d2216314623ff4108d67f2aed8a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636836219674451803&sdata=DJyyUeS7FUxsvFjNnvzIcMG5d%2BJvJgdAsNXDy7Z9s20%3D&reserved=0.

andyman198 commented 5 years ago

I pulled the file again, and now get the error below. You were right before though, I think I had added a '1' in the code while playing around after seeing the initial error. Here is what I get. Its failing on r: invalid conversion from 'uint8_t {aka unsigned char}' to 'AxisEnum' [-fpermissive]. And this applies to every extruder above the primary. Compiler output below.

Compiling .pioenvs\LPC1768\src\src\feature\tmc_util.cpp.o Marlin\src\feature\tmc_util.cpp: In function 'void init_tmc_section()': Marlin\src\feature\tmc_util.cpp:1015:47: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'AxisEnum' [-fpermissive] stepperE1.init_lcd_variables(E_AXIS_N(1)); ^ In file included from Marlin\src\feature\tmc_util.cpp:27:0: Marlin\src\feature\tmc_util.h:200:19: note: initializing argument 1 of 'void TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID>::init_lcd_variables(AxisEnum) [with char AXIS_LETTER = 'E'; char DRIVER_ID = '1']' inline void init_lcd_variables(const AxisEnum spmm_id) { ^~~~~~ *** [.pioenvs\LPC1768\src\src\feature\tmc_util.cpp.o] Error 1

andyman198 commented 5 years ago

So from what I can see, init_lcd_variables requires AxisEnum:

inline void init_lcd_variables(const AxisEnum spmm_id)

Axis Enum only has the single E_AXIS specified:

enum AxisEnum : unsigned char { X_AXIS = 0, A_AXIS = 0, Y_AXIS = 1, B_AXIS = 1, Z_AXIS = 2, C_AXIS = 2, E_AXIS = 3, X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 6, ALL_AXES = 0xFE, NO_AXIS = 0xFF };

Another thing to note is obviously when I take out the LCD (in my case a VIKI2) it compiles fine.

andyman198 commented 5 years ago

Exact steps to reproduce below (only need to change 10 lines) - confirmed from a clean copy @teemuatlut . I can confirm that it compiles fine when using RAMPS, but not when using LPC1768 so maybe @p3p has some insight?

/Marlin/Configuration.h @@ -135 +135 @@

  • define MOTHERBOARD BOARD_RAMPS_14_EFB

  • define MOTHERBOARD BOARD_AZTEEG_X5_GT

    @@ -150 +150 @@ -#define EXTRUDERS 1 +#define EXTRUDERS 2 @@ -331 +331 @@ -#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_1 1 @@ -593,2 +593,2 @@ -//#define E0_DRIVER_TYPE A4988 -//#define E1_DRIVER_TYPE A4988 +//#define E0_DRIVER_TYPE TMC2660 +//#define E1_DRIVER_TYPE TMC2660 @@ -1767 +1767 @@ -//#define VIKI2 +#define VIKI2

/Marlin/Configuration_adv.h

@@ -1396,3 +1396,3 @@

  • define STEALTHCHOP_XY

  • define STEALTHCHOP_Z

  • define STEALTHCHOP_E

/platformio.ini -env_default = megaatmega2560 +env_default = LPC1768

boelle commented 5 years ago

@andyman198 problem solved?

boelle commented 5 years ago

@thinkyhead i think we can close this one

andyman198 commented 5 years ago

Confirmed that this was solved. Thanks All.

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.