Welcome! Log In Create A New Profile

Advanced

M42 for hotend and heat bed pins

Posted by electrophile 
M42 for hotend and heat bed pins
July 27, 2020 11:51AM
Hi, I'm using Marlin 2.0.5.4 for controlling a PNP machine (Mega2560+ RAMPS 1.4). I could really use the MOSFET outputs (usually assigned for hotend and heat bed) to control solenoids and vacuum pumps. I know that D8, D9 and D10 are protected pins. Can anyone please let me know how to remove these from the protected pins? Till now, I've tried deleting them from the #define SENSITIVE_PINS block in sensitive_pins.h file but that did not work. I also tried defining the heater and heat bed pins as -1 but then the firmware would not compile. I've also tried M42 P8 I1 S255 and that momentarily switches on the MOSFET and then switches it off again.
Re: M42 for hotend and heat bed pins
July 27, 2020 02:23PM
In a any recent version of marlin simply define

#define RAMPS_D8_PIN -1
#define RAMPS_D9_PIN -1
#define RAMPS_D10_PIN -1

In your Configuration.h

then marlin will not use those pins and they are unprotected

Once they are unprotected you can use M42 P8 S255
Re: M42 for hotend and heat bed pins
July 28, 2020 08:24AM
Quote
Dust
In a any recent version of marlin simply define

#define RAMPS_D8_PIN -1
#define RAMPS_D9_PIN -1
#define RAMPS_D10_PIN -1

In your Configuration.h

then marlin will not use those pins and they are unprotected

Once they are unprotected you can use M42 P8 S255

Didn't work! sad smiley Got this error message:

In file included from Marlin\src\HAL\AVR\../../inc/MarlinConfig.h:40:0,
                 from Marlin\src\HAL\AVR\HAL_SPI.cpp:34:
Marlin\src\HAL\AVR\../../inc/SanityCheck.h:1553:4: error: #error "HEATER_0_PIN not defined for this board."
   #error "HEATER_0_PIN not defined for this board."
    ^
In file included from Marlin\src\HAL\AVR\../../inc/MarlinConfig.h:40:0,
                 from Marlin\src\HAL\AVR\HAL.cpp:25:
Marlin\src\HAL\AVR\../../inc/SanityCheck.h:1553:4: error: #error "HEATER_0_PIN not defined for this board."
   #error "HEATER_0_PIN not defined for this board."
    ^
In file included from Marlin\src\HAL\AVR\../../inc/MarlinConfig.h:40:0,
                 from Marlin\src\HAL\AVR\MarlinSerial.cpp:39:
Marlin\src\HAL\AVR\../../inc/SanityCheck.h:1553:4: error: #error "HEATER_0_PIN not defined for this board."
   #error "HEATER_0_PIN not defined for this board."
    ^
In file included from Marlin\src\HAL\AVR\../../inc/MarlinConfig.h:40:0,
                 from Marlin\src\HAL\AVR\Servo.cpp:56:
Marlin\src\HAL\AVR\../../inc/SanityCheck.h:1553:4: error: #error "HEATER_0_PIN not defined for this board."
   #error "HEATER_0_PIN not defined for this board."
    ^
*** [.pio\build\mega2560\src\src\HAL\AVR\HAL_SPI.cpp.o] Error 1
*** [.pio\build\mega2560\src\src\HAL\AVR\HAL.cpp.o] Error 1
*** [.pio\build\mega2560\src\src\HAL\AVR\MarlinSerial.cpp.o] Error 1
*** [.pio\build\mega2560\src\src\HAL\AVR\Servo.cpp.o] Error 1
================================================================================================== [FAILED] Took 13.61 seconds ==================================================================================================
Re: M42 for hotend and heat bed pins
July 28, 2020 09:08AM
that is because its a 3d printer firmware it expects there to be heater pins... (going to submit a PR so that this test is skipped if EXTRUDERS < 1)

Just disable that SanityCheck

find #error "HEATER_0_PIN not defined for this board." in SanityCheck.h and disable it by prefixing it with //

should be line 1553 for you
Re: M42 for hotend and heat bed pins
July 29, 2020 08:13AM
Thanks. It indeed was 1553 but it still does not compile. This is the error I see now,

In file included from Marlin/src/module/thermistor/../../inc/../HAL/./AVR/HAL.h:23:0,
                 from Marlin/src/module/thermistor/../../inc/../HAL/HAL.h:26,
                 from Marlin/src/module/thermistor/../../inc/MarlinConfig.h:30,
                 from Marlin/src/module/thermistor/thermistors.h:24,
                 from Marlin/src/module/temperature.h:28,
                 from Marlin/src/module/temperature.cpp:27:
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:76:41: error: pasting "DIO" and "-" does not give a valid preprocessing token
 #define _WRITE(IO,V)          do{ if (&(DIO ## IO ## _RPORT) < (uint8_t*)0x100) _WRITE_NC(IO,V); else _WRITE_C(IO,V); }while(0)
                                         ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:96:31: note: in expansion of macro '_WRITE'
 #define WRITE(IO,V)           _WRITE(IO,V)
                               ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1666:28: note: in expansion of macro 'WRITE'
 #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
                            ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1691:29: note: in expansion of macro 'WRITE_HEATER_0P'
   #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
                             ^
Marlin/src/module/temperature.cpp:2101:5: note: in expansion of macro 'WRITE_HEATER_0'
     WRITE_HEATER_##N(LOW);              \
     ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:459:3: note: in expansion of macro 'DISABLE_HEATER'
   _RPT_OP(_RPT_I)                                             \
   ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:474:38: note: in expansion of macro '_REPEAT'
 #define REPEAT_S(S,N,OP)        EVAL(_REPEAT(S,SUB##S(N),OP))
                                      ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:475:33: note: in expansion of macro 'REPEAT_S'
 #define REPEAT(N,OP)            REPEAT_S(0,N,OP)
                                 ^
Marlin/src/module/temperature.cpp:2105:5: note: in expansion of macro 'REPEAT'
     REPEAT(HOTENDS, DISABLE_HEATER);
     ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:66:14: error: pasting "DIO" and "-" does not give a valid preprocessing token
   if (V) SBI(DIO ## IO ## _WPORT, DIO ## IO ## _PIN); \
              ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:76:81: note: in expansion of macro '_WRITE_NC'
 #define _WRITE(IO,V)          do{ if (&(DIO ## IO ## _RPORT) < (uint8_t*)0x100) _WRITE_NC(IO,V); else _WRITE_C(IO,V); }while(0)
                                                                                 ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:96:31: note: in expansion of macro '_WRITE'
 #define WRITE(IO,V)           _WRITE(IO,V)
                               ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1666:28: note: in expansion of macro 'WRITE'
 #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
                            ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1691:29: note: in expansion of macro 'WRITE_HEATER_0P'
   #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
                             ^
Marlin/src/module/temperature.cpp:2101:5: note: in expansion of macro 'WRITE_HEATER_0'
     WRITE_HEATER_##N(LOW);              \
     ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:459:3: note: in expansion of macro 'DISABLE_HEATER'
   _RPT_OP(_RPT_I)                                             \
   ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:474:38: note: in expansion of macro '_REPEAT'
 #define REPEAT_S(S,N,OP)        EVAL(_REPEAT(S,SUB##S(N),OP))
                                      ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:475:33: note: in expansion of macro 'REPEAT_S'
 #define REPEAT(N,OP)            REPEAT_S(0,N,OP)
                                 ^
Marlin/src/module/temperature.cpp:2105:5: note: in expansion of macro 'REPEAT'
     REPEAT(HOTENDS, DISABLE_HEATER);
     ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:66:35: error: pasting "DIO" and "-" does not give a valid preprocessing token
   if (V) SBI(DIO ## IO ## _WPORT, DIO ## IO ## _PIN); \
                                   ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:76:81: note: in expansion of macro '_WRITE_NC'
 #define _WRITE(IO,V)          do{ if (&(DIO ## IO ## _RPORT) < (uint8_t*)0x100) _WRITE_NC(IO,V); else _WRITE_C(IO,V); }while(0)
                                                                                 ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:96:31: note: in expansion of macro '_WRITE'
 #define WRITE(IO,V)           _WRITE(IO,V)
                               ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1666:28: note: in expansion of macro 'WRITE'
 #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
                            ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1691:29: note: in expansion of macro 'WRITE_HEATER_0P'
   #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
                             ^
Marlin/src/module/temperature.cpp:2101:5: note: in expansion of macro 'WRITE_HEATER_0'
     WRITE_HEATER_##N(LOW);              \
     ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:459:3: note: in expansion of macro 'DISABLE_HEATER'
   _RPT_OP(_RPT_I)                                             \
   ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:474:38: note: in expansion of macro '_REPEAT'
 #define REPEAT_S(S,N,OP)        EVAL(_REPEAT(S,SUB##S(N),OP))
                                      ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:475:33: note: in expansion of macro 'REPEAT_S'
 #define REPEAT(N,OP)            REPEAT_S(0,N,OP)
                                 ^
Marlin/src/module/temperature.cpp:2105:5: note: in expansion of macro 'REPEAT'
     REPEAT(HOTENDS, DISABLE_HEATER);
     ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:67:14: error: pasting "DIO" and "-" does not give a valid preprocessing token
   else   CBI(DIO ## IO ## _WPORT, DIO ## IO ## _PIN); \
              ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:76:81: note: in expansion of macro '_WRITE_NC'
 #define _WRITE(IO,V)          do{ if (&(DIO ## IO ## _RPORT) < (uint8_t*)0x100) _WRITE_NC(IO,V); else _WRITE_C(IO,V); }while(0)
                                                                                 ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:96:31: note: in expansion of macro '_WRITE'
 #define WRITE(IO,V)           _WRITE(IO,V)
                               ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1666:28: note: in expansion of macro 'WRITE'
 #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
                            ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1691:29: note: in expansion of macro 'WRITE_HEATER_0P'
   #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
                             ^
Marlin/src/module/temperature.cpp:2101:5: note: in expansion of macro 'WRITE_HEATER_0'
     WRITE_HEATER_##N(LOW);              \
     ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:459:3: note: in expansion of macro 'DISABLE_HEATER'
   _RPT_OP(_RPT_I)                                             \
   ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:474:38: note: in expansion of macro '_REPEAT'
 #define REPEAT_S(S,N,OP)        EVAL(_REPEAT(S,SUB##S(N),OP))
                                      ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:475:33: note: in expansion of macro 'REPEAT_S'
 #define REPEAT(N,OP)            REPEAT_S(0,N,OP)
                                 ^
Marlin/src/module/temperature.cpp:2105:5: note: in expansion of macro 'REPEAT'
     REPEAT(HOTENDS, DISABLE_HEATER);
     ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:67:35: error: pasting "DIO" and "-" does not give a valid preprocessing token
   else   CBI(DIO ## IO ## _WPORT, DIO ## IO ## _PIN); \
                                   ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:76:81: note: in expansion of macro '_WRITE_NC'
 #define _WRITE(IO,V)          do{ if (&(DIO ## IO ## _RPORT) < (uint8_t*)0x100) _WRITE_NC(IO,V); else _WRITE_C(IO,V); }while(0)
                                                                                 ^
Marlin/src/module/thermistor/../../inc/../HAL/./AVR/fastio.h:96:31: note: in expansion of macro '_WRITE'
 #define WRITE(IO,V)           _WRITE(IO,V)
                               ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1666:28: note: in expansion of macro 'WRITE'
 #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
                            ^
Marlin/src/module/thermistor/../../inc/Conditionals_post.h:1691:29: note: in expansion of macro 'WRITE_HEATER_0P'
   #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
                             ^
Marlin/src/module/temperature.cpp:2101:5: note: in expansion of macro 'WRITE_HEATER_0'
     WRITE_HEATER_##N(LOW);              \
     ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:459:3: note: in expansion of macro 'DISABLE_HEATER'
   _RPT_OP(_RPT_I)                                             \
   ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:474:38: note: in expansion of macro '_REPEAT'
 #define REPEAT_S(S,N,OP)        EVAL(_REPEAT(S,SUB##S(N),OP))
                                      ^
Marlin/src/module/thermistor/../../inc/../core/macros.h:475:33: note: in expansion of macro 'REPEAT_S'
 #define REPEAT(N,OP)            REPEAT_S(0,N,OP)
                                 ^
Marlin/src/module/temperature.cpp:2105:5: note: in expansion of macro 'REPEAT'
     REPEAT(HOTENDS, DISABLE_HEATER);
     ^
compilation terminated due to -fmax-errors=5.
*** [.pio/build/mega2560/src/src/module/temperature.cpp.o] Error 1
=============================================================== [FAILED] Took 91.96 seconds ===============================================================
Re: M42 for hotend and heat bed pins
July 29, 2020 01:13PM
your reassigning the pins away from the hotend etc, you have to tell it you don't have any extruders

#define EXTRUDERS 0 in your configuration.h (is normally set to 1)
Re: M42 for hotend and heat bed pins
July 29, 2020 06:04PM
This worked! Thank you for all your support!

Another strange thing I noticed is that while D8, D9 and D10 were protected, I could still switch them ON using M42 P8 I1 S254 (not 255). If the S value was 255, the MOSFET would switch on momentarily and then switch off again within a fraction of second.

Edited 1 time(s). Last edit at 07/29/2020 06:07PM by electrophile.
Re: M42 for hotend and heat bed pins
July 29, 2020 11:20PM
Thats because the firmware was still controlling things, you set one thing the firmware immediately set something else.
Extruder + Heizbett Temperaturanzeige 0 in Repetier
July 15, 2021 07:00AM
Hallo RepRap-Freunde,
dank Eurer Hilfe konnte ich seit 2015 bis dato schöne Drucke mit meinem selbstgebauten Prusa i3 machen. Vielen Dank. Das muß auch mal sein.

Nun brauche ich aber wieder Eure Hilfe. Das Problem ist Folgendes:
In Repetier (Version 2.2.2, vorher 2.1.6) wird keine Temperatur mehr angezeigt für Heizbett + Extruder. Nur 0. Das Heizbett wird aber aufgeheizt. Ich kann nur die Temperatur nicht kontrollieren. Der Extruder heizt auch eine Weile, dann die Fehlermeldung: Sensor + Heizelement entkoppelt. Im Log steht noch: 12:46:25.902 : fatal:Heater/sensor error - Printer stopped and heaters disabled due to this error. Fix error and restart with M999.

Danach werden die Heizungen ausgeschaltet. Ich kann in der Config.h keine Änderungen feststellen. Ich hoffe, daß mir jemand weiterhelfen kann.


Hans

PRUSA i3, Diamond-Hotend + 3 Extruder, Arduino Mega 2560, Ramps 1.4, ATX PowerSupply 550W, Arduino 1.0, Repetier Host V2.2.2, Repetier Firmware, PCWindows10.
Attachments:
open | download - Configuration.h (37.9 KB)
Sorry, only registered users may post in this forum.

Click here to login