-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🩹 Fix MINITRONICS v1 support #27150
🩹 Fix MINITRONICS v1 support #27150
Conversation
I've tried attaching I'm going to actually use the board with a 1602 (16x2) instead of the 2004 (20x4) display. |
You have changed Marlin/src/HAL/AVR/fastio/fastio_1281.h I am very concerned that this will break ever other board using it... |
It will affect every board. They're already all broken (since HAL numbering doesn't match MegaCore numbering), they'll just be broken differently. More precisely speaking, "every" board appears to be MINITRONICS and SILVER_GATE. I'm fixing up MINITRONICS in this patch set. Silver Gate seem to be broken in another way too:
Note the |
At present, I only see the 1 1281 board at least merged upstream.... But we definitely need to compare these changes to the MCU data sheet. It drastically changes the MCU port to dio numbering which should all coincide with the chip documentation. |
Yeah, Silver Gate is not building:
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 7effc47cf7..f7fb6da9c7 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -88,7 +88,7 @@
// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
- #define MOTHERBOARD BOARD_RAMPS_14_EFB
+ #define MOTHERBOARD BOARD_SILVER_GATE
#endif
/**
I guess I could fix it up blindly, but I have no way to test. |
It also disagree with changes, there is a provided Fastio.h information in https://reprap.org/wiki/Minitronics_10 File:Fastio.h.zip upload by The board developer themselves Brupje |
Yeah, as mentioned in the commit message: I have no idea where those numbers come from. They most certainly don't work with 2.1.x. They are not what megacore uses. Here's what it does use: https://github.com/MCUdude/MegaCore?tab=readme-ov-file#pinout |
You will need to target this PR to the |
I think thats the issue, you have presumed megacore "mega1281.build.core=arduino" not megacore (MCUdude_corefiles) |
4e109c6
to
e244af2
Compare
Retargeted it now.
Sorry, I'm not familiar with Arduino enough to comprehend this. I've presumed megacore, because that's what ended up being used, but I don't really understand why. What would be the most reasonable course of action here? Hope it doesn't involve relying on some ancient Arduino fork? |
use stock code apply this diff and build. I suspect it works fine diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index f88f5b9dbd..187b85f6b0 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -68,7 +68,7 @@
// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
- #define MOTHERBOARD BOARD_RAMPS_14_EFB
+ #define MOTHERBOARD BOARD_MINITRONICS
#endif
/**
diff --git a/Marlin/src/pins/mega/pins_MINITRONICS.h b/Marlin/src/pins/mega/pins_MINITRONICS.h
index e6e24f8886..383ea212c2 100644
--- a/Marlin/src/pins/mega/pins_MINITRONICS.h
+++ b/Marlin/src/pins/mega/pins_MINITRONICS.h
@@ -34,7 +34,7 @@
* Added pin definitions for M3, M4 & M5 spindle control commands
*/
-#if NOT_TARGET(__AVR_ATmega1281__)
+#if NOT_TARGET(__AVR_ATmega1280__)
#error "Oops! Select 'Minitronics' in 'Tools > Board.'"
#elif HOTENDS > 2 || E_STEPPERS > 2
#error "Minitronics supports up to 2 hotends / E steppers."
diff --git a/platformio.ini b/platformio.ini
index 76200cbbd5..10c822c908 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,7 +13,7 @@
[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
-default_envs = mega2560
+default_envs = mega1280
include_dir = Marlin
extra_configs =
Marlin/config.ini
|
Thanks for the response. With the patch, it builds, but the pin mapping is still entirely messed up:
This is the full diff: diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 7effc47cf7..f427455bbb 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -88,7 +88,7 @@
// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
- #define MOTHERBOARD BOARD_RAMPS_14_EFB
+ #define MOTHERBOARD BOARD_MINITRONICS
#endif
/**
@@ -2488,7 +2488,7 @@
* SD Card support is disabled by default. If your controller has an SD slot,
* you must uncomment the following option or it won't work.
*/
-//#define SDSUPPORT
+#define SDSUPPORT
/**
* SD CARD: ENABLE CRC
diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 82fd1be67b..b1776638d6 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -4228,18 +4228,18 @@
//
// M42 - Set pin states
//
-//#define DIRECT_PIN_CONTROL
+#define DIRECT_PIN_CONTROL
//
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
//
-//#define PINS_DEBUGGING
+#define PINS_DEBUGGING
// Enable Tests that will run at startup and produce a report
//#define MARLIN_TEST_BUILD
// Enable Marlin dev mode which adds some special commands
-//#define MARLIN_DEV_MODE
+#define MARLIN_DEV_MODE
#if ENABLED(MARLIN_DEV_MODE)
/**
diff --git a/Marlin/src/pins/mega/pins_MINITRONICS.h b/Marlin/src/pins/mega/pins_MINITRONICS.h
index c8828faea7..21fcac601f 100644
--- a/Marlin/src/pins/mega/pins_MINITRONICS.h
+++ b/Marlin/src/pins/mega/pins_MINITRONICS.h
@@ -36,7 +36,7 @@
* Added pin definitions for M3, M4 & M5 spindle control commands
*/
-#if NOT_TARGET(__AVR_ATmega1281__)
+#if NOT_TARGET(__AVR_ATmega1280__)
#error "Oops! Select 'Minitronics' in 'Tools > Board.'"
#elif HOTENDS > 2 || E_STEPPERS > 2
#error "Minitronics supports up to 2 hotends / E steppers."
diff --git a/platformio.ini b/platformio.ini
index e3bdb6f586..70038dae38 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,7 +13,7 @@
[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
-default_envs = mega2560
+default_envs = mega1280
include_dir = Marlin
extra_configs =
Marlin/config.ini |
Whats messed up? #define X_STEP_PIN 48
#define X_DIR_PIN 47
#define X_ENABLE_PIN 49
#define X_MIN_PIN 5
#define X_MAX_PIN -1 //2 //Max endstops default to disabled "-1", set to commented value to enable. From M43
and #define Y_STEP_PIN 39 // A6
#define Y_DIR_PIN 40 // A0
#define Y_ENABLE_PIN 38
#define Y_MIN_PIN 2
#define Y_MAX_PIN -1 //15
and #define Z_STEP_PIN 42 // A2
#define Z_DIR_PIN 43 // A6
#define Z_ENABLE_PIN 41 // A1
#define Z_MIN_PIN 6
#define Z_MAX_PIN -1
and #define E_STEP_PIN 45
#define E_DIR_PIN 44
#define E_ENABLE_PIN 27
and #define HEATER_0_PIN 9 //❓<= FAN0_PIN Marlin/src/pins/mega/pins_MINITRONICS.h
#define HEATER_1_PIN 8
#define HEATER_2_PIN 7 //❓<= HEATER_0_PIN in Marlin/src/pins/mega/pins_MINITRONICS.h
#define HEATER_3_PIN 3
#define TEMP_0_PIN 7 // ANALOG NUMBERING
#define TEMP_1_PIN 6 // ANALOG NUMBERING
Pins debugging doesnt know about 1280/1, and is using incorrect mega2560 port names |
schematic |
Let's start this one over from the beginning. The pins mapping in Marlin is based on the GPIO indexed pin mapping of Arduino, and the pin numbering is generally meant to make all the AVR boards map in a similar way to the 2560, and as long as our AVR pin numbering is internally consistent within Marlin, it doesn't need to correspond to anything else. As mentioned, our pin numbering is based on the There are some other "Fast I/O" solutions out there that we might look at adopting in future, but in the meantime we ought to document our FastIO headers with a little extra explanation as to why the logical (i.e., "GPIO") pin numbers are in the order that they appear, and not in some other order, and then make sure that ordering is simply internally consistent and adheres to our set rules.. |
Marlin pins debugging (and other things) use Arduino |
To use mappings for MCUs under PlatformIO we create a variant and then implement our own |
We're unable to make any changes or add commits to this PR, maybe due to a glitch in GitHub. Sometimes if a Marlin fork isn't named "Marlin" we encounter this problem. Anyway, if you see a checkbox on this page labeled "Allow edits by maintainers," then please make sure it is checked. If we still can't make any edits, then we can still submit changes to your branch using a PR targeted at your fork, but then you have to approve them. The other option is to add me and/or other Marlin maintainers to your fork as team members with edit permissions. Anyway, thanks for the contribution and we appreciate your patience with our review process! We would love to get that pins debugging output fixed as a part of this one. |
@thinkyhead @ellensp than you very much for your patience and an exhaustive explanation. I suspect there's more than just the pin debugging that's broken, because when I carried over my configuration to the original pin numbering, it no longer works -- display does not show anything. I wasn't able to debug further without knowing what's up with the pin debugging. I'm unable to look into what's wrong until the weekend, but I suspect your explanation will be of great help. |
Drop a comment when you're getting started on your research to get these pins consistent. I'd be interested to compare notes, and we can do our best to base the pin mapping on existing platforms and datasheets. I vaguely recall a long ago conversation where we decided to just map 1281/2561 to 1280/2560 for simplicity, but in the long run it would be nice to have a good canonical mapping for this MCU sub-family. |
|
Add env:mega1281 board, based on env:mega1280. Uses slightly different pin mapping, originally based on and used by the Mintronics v1 board. Needs -mcu=atmega1281 so that fastio picks the right pin mapping.
The 1281 support was bitrotten for some time. No more!
The MAX endstops are not there, the comments are wrong.
e244af2
to
08db255
Compare
Hey, how does it look now? Now the original Minitronics pin numbers work for me, and pin debugging looks okay too. Here's a couple of partial drawings I did along the way, may or may not be more legible that the original schematics: |
@thinkyhead @ellensp any chance this could get another look? I think I figured out how to make it work while remaining compatible with the original Minitronics support, using the same pin mapping. Thanks! |
c792921
to
37fb26b
Compare
Description
This restores support for bitrotten MINITRONICS (v1.0 and v1.1) support.
This is my first contribution to Marlin -- please be patient with me if I messed up something in the PR.
Requirements
The MINITRONICS v1 board.
Benefits
Everybody with a MINITRONICS board (which I imagine is millions of people) can upgrade to the best and latest Marlin firmware and impress everybody.
Configurations
With the most basic functionality, to build and run this one just needs to set
MOTHERBOARD
: