aboutsummaryrefslogtreecommitdiff
path: root/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
blob: 8668e1defd2d4cf2292d05e5ae854443eb73cc99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/**
 * Marlin 3D Printer Firmware
 * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 *
 * Based on Sprinter and grbl.
 * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */
#pragma once

#if NOT_TARGET(TARGET_STM32F1)
  #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
#endif

#define BOARD_INFO_NAME "BTT SKR Mini V1.1"

//#define DISABLE_DEBUG
#define DISABLE_JTAG

// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD    2000

#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
  #define FLASH_EEPROM_EMULATION
  #define EEPROM_PAGE_SIZE     (0x800U)           // 2KB
  #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
  #define MARLIN_EEPROM_SIZE    EEPROM_PAGE_SIZE  // 2KB
#endif

//
// Limit Switches
//
#define X_MIN_PIN                           PC2
#define X_MAX_PIN                           PA2
#define Y_MIN_PIN                           PC1
#define Y_MAX_PIN                           PA1
#define Z_MIN_PIN                           PC0
#define Z_MAX_PIN                           PC3

//
// Steppers
//

#define X_STEP_PIN                          PC6
#define X_DIR_PIN                           PC7
#define X_ENABLE_PIN                        PB15

#define Y_STEP_PIN                          PB13
#define Y_DIR_PIN                           PB14
#define Y_ENABLE_PIN                        PB12

#define Z_STEP_PIN                          PB10
#define Z_DIR_PIN                           PB11
#define Z_ENABLE_PIN                        PB2

#define E0_STEP_PIN                         PC5
#define E0_DIR_PIN                          PB0
#define E0_ENABLE_PIN                       PC4

#if ENABLED(TMC_USE_SW_SPI)
  #ifndef TMC_SW_SCK
    #define TMC_SW_SCK                      PB3
  #endif
  #ifndef TMC_SW_MISO
    #define TMC_SW_MISO                     PB4
  #endif
  #ifndef TMC_SW_MOSI
    #define TMC_SW_MOSI                     PB5
  #endif
#endif

//
// Heaters / Fans
//
#define HEATER_0_PIN                        PA8
#define FAN_PIN                             PC8
#define HEATER_BED_PIN                      PC9

//
// Temperature Sensors
//
#define TEMP_BED_PIN                        PB1   // Analog Input
#define TEMP_0_PIN                          PA0   // Analog Input

//
// LCD Pins
//

/**
 *                _____                                             _____
 *            NC | · · | GND                                    5V | · · | GND
 *         RESET | · · | PB9 (SD_DETECT)             (LCD_D7) PC14 | · · | PC15 (LCD_D6)
 *  (MOSI)   PB5 | · · | PB8 (BTN_EN2)               (LCD_D5)  PB7 | · · | PC13 (LCD_D4)
 * (SD_SS)  PA15 | · · | PD2 (BTN_EN1)               (LCD_RS) PC12 | · · | PB6  (LCD_EN)
 *   (SCK)   PB3 | · · | PB4 (MISO)                 (BTN_ENC) PC11 | · · | PC10 (BEEPER)
 *                -----                                             -----
 *                EXP2                                              EXP1
 */

#if HAS_WIRED_LCD
  #define BEEPER_PIN                        PC10
  #define BTN_ENC                           PC11

  #if ENABLED(CR10_STOCKDISPLAY)
    #define LCD_PINS_RS                     PC15

    #define BTN_EN1                         PB6
    #define BTN_EN2                         PC13

    #define LCD_PINS_ENABLE                 PC14
    #define LCD_PINS_D4                     PB7

  #elif IS_TFTGLCD_PANEL

    #undef BEEPER_PIN
    #undef BTN_ENC

    #if ENABLED(TFTGLCD_PANEL_SPI)
      #define TFTGLCD_CS                    PD2
    #endif

    #define SD_DETECT_PIN                   PB9

  #else

    #define LCD_PINS_RS                     PC12

    #define BTN_EN1                         PD2
    #define BTN_EN2                         PB8

    #define LCD_PINS_ENABLE                 PB6

    #if ENABLED(FYSETC_MINI_12864)

      #define LCD_BACKLIGHT_PIN             -1
      #define LCD_RESET_PIN                 PC13
      #define DOGLCD_A0                     PC12
      #define DOGLCD_CS                     PB6
      #define DOGLCD_SCK                    PB3
      #define DOGLCD_MOSI                   PB5

      #define FORCE_SOFT_SPI                      // SPI MODE3

      #define LED_PIN                       PB7   // red pwm
      //#define LED_PIN                     PC15  // green
      //#define LED_PIN                     PC14  // blue

      //#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
      //  #ifndef RGB_LED_R_PIN
      //    #define RGB_LED_R_PIN PB7
      //  #endif
      //  #ifndef RGB_LED_G_PIN
      //    #define RGB_LED_G_PIN PC15
      //  #endif
      //  #ifndef RGB_LED_B_PIN
      //    #define RGB_LED_B_PIN PC14
      //  #endif
      //#elif ENABLED(FYSETC_MINI_12864_2_1)
      //  #define NEOPIXEL_PIN    PB7
      //#endif

    #else                                         // !FYSETC_MINI_12864

      #define LCD_PINS_D4                   PC13
      #if IS_ULTIPANEL
        #define LCD_PINS_D5                 PB7
        #define LCD_PINS_D6                 PC15
        #define LCD_PINS_D7                 PC14

        #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
          #define BTN_ENC_EN         LCD_PINS_D7  // Detect the presence of the encoder
        #endif

      #endif

    #endif // !FYSETC_MINI_12864

    #if HAS_MARLINUI_U8GLIB
      #ifndef BOARD_ST7920_DELAY_1
        #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
      #endif
      #ifndef BOARD_ST7920_DELAY_2
        #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
      #endif
      #ifndef BOARD_ST7920_DELAY_3
        #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
      #endif
    #endif

  #endif

#endif // HAS_WIRED_LCD

//
// SD Card
//

// By default the onboard SD is enabled.
// Change SDCARD_CONNECTION from 'ONBOARD' to 'LCD' for an external (LCD module) SD
#ifndef SDCARD_CONNECTION
  #define SDCARD_CONNECTION              ONBOARD
#endif

#if SD_CONNECTION_IS(LCD)
  #define SPI_DEVICE                           3
  #define SD_DETECT_PIN                     PB9
  #define SD_SCK_PIN                        PB3
  #define SD_MISO_PIN                       PB4
  #define SD_MOSI_PIN                       PB5
  #define SD_SS_PIN                         PA15
#elif SD_CONNECTION_IS(ONBOARD)
  #define SD_DETECT_PIN                     PA3
  #define SD_SCK_PIN                        PA5
  #define SD_MISO_PIN                       PA6
  #define SD_MOSI_PIN                       PA7
  #define SD_SS_PIN                         PA4
#endif
#define ONBOARD_SPI_DEVICE                     1  // SPI1
#define ONBOARD_SD_CS_PIN                   PA4   // Chip select for "System" SD card