|
| 1 | +/** |
| 2 | + * Marlin 3D Printer Firmware |
| 3 | + * Copyright (c) 2026 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] |
| 4 | + * |
| 5 | + * Based on Sprinter and grbl. |
| 6 | + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | + * |
| 21 | + */ |
| 22 | + |
| 23 | +/** |
| 24 | + * pins_PRUSA_BUDDY_common.h |
| 25 | + * Prusa Buddy Board common pin definitions |
| 26 | + * |
| 27 | + * This common file is shared by Buddy Mini and xBuddy board variants. |
| 28 | + * |
| 29 | + * MCU: STM32F407VGT6 (STM32F407VG, 100-pin LQFP) |
| 30 | + * Schematic: https://github.com/prusa3d/Buddy-board-MINI-PCB |
| 31 | + */ |
| 32 | + |
| 33 | +#pragma once |
| 34 | + |
| 35 | +#include "env_validate.h" |
| 36 | + |
| 37 | +// |
| 38 | +// EEPROM |
| 39 | +// |
| 40 | +#if NO_EEPROM_SELECTED |
| 41 | + #define FLASH_EEPROM_EMULATION |
| 42 | +#endif |
| 43 | +#if ENABLED(FLASH_EEPROM_EMULATION) |
| 44 | + #define FLASH_EEPROM_LEVELING |
| 45 | +#endif |
| 46 | + |
| 47 | +// |
| 48 | +// Servo pin |
| 49 | +// |
| 50 | +#define SERVO0_PIN PE14 |
| 51 | + |
| 52 | +// |
| 53 | +// Trinamic Stallguard / Diag pins |
| 54 | +// (Using the UART-based TMC2209 on this board, so diag pins used for endstops) |
| 55 | +// |
| 56 | +#define X_STOP_PIN PG3 |
| 57 | +#define Y_STOP_PIN PG4 |
| 58 | +#define Z_STOP_PIN PG5 |
| 59 | + |
| 60 | +// |
| 61 | +// Z Probe (when not Z_MIN_PIN) |
| 62 | +// |
| 63 | +#ifndef Z_MIN_PROBE_PIN |
| 64 | + #define Z_MIN_PROBE_PIN PG6 |
| 65 | +#endif |
| 66 | + |
| 67 | +// |
| 68 | +// Filament Runout |
| 69 | +// |
| 70 | +#define FIL_RUNOUT_PIN PE5 |
| 71 | +#define FIL_RUNOUT2_PIN PE6 |
| 72 | + |
| 73 | +// |
| 74 | +// Steppers |
| 75 | +// |
| 76 | +#define X_STEP_PIN PG1 |
| 77 | +#define X_DIR_PIN PB10 |
| 78 | +#define X_ENABLE_PIN PG0 |
| 79 | + |
| 80 | +#define Y_STEP_PIN PF14 |
| 81 | +#define Y_DIR_PIN PF15 |
| 82 | +#define Y_ENABLE_PIN PF13 |
| 83 | + |
| 84 | +#define Z_STEP_PIN PF11 |
| 85 | +#define Z_DIR_PIN PF12 |
| 86 | +#define Z_ENABLE_PIN PC5 |
| 87 | + |
| 88 | +#define E0_STEP_PIN PC14 |
| 89 | +#define E0_DIR_PIN PC13 |
| 90 | +#define E0_ENABLE_PIN PC15 |
| 91 | + |
| 92 | +// |
| 93 | +// TMC2209 UART Stepper Drivers |
| 94 | +// |
| 95 | +#if HAS_TMC_UART |
| 96 | + #ifndef X_SERIAL_TX_PIN |
| 97 | + #define X_SERIAL_TX_PIN PB2 |
| 98 | + #endif |
| 99 | + #ifndef Y_SERIAL_TX_PIN |
| 100 | + #define Y_SERIAL_TX_PIN PE2 |
| 101 | + #endif |
| 102 | + #ifndef Z_SERIAL_TX_PIN |
| 103 | + #define Z_SERIAL_TX_PIN PE3 |
| 104 | + #endif |
| 105 | + #ifndef E0_SERIAL_TX_PIN |
| 106 | + #define E0_SERIAL_TX_PIN PE4 |
| 107 | + #endif |
| 108 | + |
| 109 | + // Reduce baud rate to improve software serial reliability |
| 110 | + #ifndef TMC_BAUD_RATE |
| 111 | + #define TMC_BAUD_RATE 19200 |
| 112 | + #endif |
| 113 | +#endif |
| 114 | + |
| 115 | +// |
| 116 | +// UART connector (J7) - USART3 via alternate pins |
| 117 | +// PB10 is already used for X_DIR_PIN, so use alternate USART3 pins |
| 118 | +// |
| 119 | +#define BOARD_UART_TX_PIN PD8 // USART3_TX (alternate) |
| 120 | +#define BOARD_UART_RX_PIN PD9 // USART3_RX (alternate) |
| 121 | + |
| 122 | +// |
| 123 | +// Temperature Sensors |
| 124 | +// |
| 125 | +// TODO: Upstream Prusa firmware marks these as "Dummy, measured by puppy" |
| 126 | +// — indicating external measurement via a separate controller/daughter-board. |
| 127 | +// Verify whether local ADC reads are valid or if values come over I2C/CAN. |
| 128 | +// |
| 129 | +#define TEMP_0_PIN PC1 // Analog Input - THERM0 (Nozzle) |
| 130 | +#define TEMP_1_PIN PC2 // Analog Input - THERM1 |
| 131 | +#define TEMP_BED_PIN PC0 // Analog Input - BED_THERM |
| 132 | + |
| 133 | +// |
| 134 | +// Heaters / Fans |
| 135 | +// |
| 136 | +// TODO: Upstream Prusa firmware marks HEATER_0 and HEATER_BED as |
| 137 | +// "Dummy, measured by puppy" — heater PWM may be driven externally. |
| 138 | +// |
| 139 | +#define HEATER_0_PIN PA1 |
| 140 | +#define HEATER_BED_PIN PA2 |
| 141 | + |
| 142 | +// TODO: Upstream Prusa firmware has "#undef E0_AUTO_FAN_PIN" with the note |
| 143 | +// "no auto fan pin - handled by dwarf". The "dwarf" appears to be a |
| 144 | +// daughter-board or CANbus peripheral that manages fan control. |
| 145 | +// Investigate dwarf interface before enabling AUTO_FAN here. |
| 146 | +// |
| 147 | +#ifndef FAN0_PIN |
| 148 | + #define FAN0_PIN PF7 |
| 149 | +#endif |
| 150 | +#define FAN1_PIN PF6 |
| 151 | + |
| 152 | +// |
| 153 | +// Misc. Functions |
| 154 | +// |
| 155 | +#define PS_ON_PIN PA4 |
| 156 | +#define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT |
| 157 | + |
| 158 | +// |
| 159 | +// SD Card - SDIO |
| 160 | +// |
| 161 | +#define ONBOARD_SDIO |
| 162 | +#define SD_DETECT_PIN PA8 |
| 163 | + |
| 164 | +// |
| 165 | +// NeoPixel / LED |
| 166 | +// |
| 167 | +#define LED_PIN PA15 // Status LED |
| 168 | + |
| 169 | +// |
| 170 | +// I2C (ESP32 WiFi module on level converter) |
| 171 | +// |
| 172 | +#define I2C_SCL_PIN PB6 |
| 173 | +#define I2C_SDA_PIN PB7 |
| 174 | + |
| 175 | +// |
| 176 | +// SPI Flash (onboard W25Q128 via SPI1) |
| 177 | +// |
| 178 | +#define SPI_FLASH |
| 179 | +#if ENABLED(SPI_FLASH) |
| 180 | + #define SPI_DEVICE 1 // SPI1 |
| 181 | + #define SPI_FLASH_SIZE 0x1000000 // 16MB |
| 182 | + // SPI1 pins: PA5=SCK, PA6=MISO, PA7=MOSI |
| 183 | + #if !PIN_EXISTS(PS_ON) |
| 184 | + #define SPI_FLASH_CS_PIN PA4 // Flash CS (shares PS_ON_PIN - mutually exclusive) |
| 185 | + #endif |
| 186 | + #define SPI_FLASH_SCK_PIN PA5 |
| 187 | + #define SPI_FLASH_MISO_PIN PA6 |
| 188 | + #define SPI_FLASH_MOSI_PIN PA7 |
| 189 | +#endif |
| 190 | + |
| 191 | +// |
| 192 | +// Ethernet (LAN8742A RMII) |
| 193 | +// |
| 194 | +#if HAS_ETHERNET |
| 195 | + #ifndef ETH_PHY_TYPE |
| 196 | + #define ETH_PHY_TYPE LAN8742A |
| 197 | + #define ETH_PHY_ADDR 1 |
| 198 | + #endif |
| 199 | + // EPHY_RST via level converter - use PF2 (free GPIO, not conflicting with TMC serial) |
| 200 | + #define ETH_RESET_PIN PF2 |
| 201 | +#endif |
| 202 | + |
| 203 | +// |
| 204 | +// LCD / Controller (EXP1/EXP2 connectors) |
| 205 | +// |
| 206 | +#if IS_NEWPANEL |
| 207 | + #define BEEPER_PIN PC7 |
| 208 | + #define BTN_EN1 PG11 |
| 209 | + #define BTN_EN2 PG10 |
| 210 | + #define BTN_ENC PG9 |
| 211 | + #ifndef ENCODER_STEPS_PER_MENU_ITEM |
| 212 | + #define ENCODER_STEPS_PER_MENU_ITEM 2 |
| 213 | + #endif |
| 214 | +#endif |
0 commit comments