Skip to content

Commit

Permalink
Update BTT002 platform (fixing SD init) (#16217)
Browse files Browse the repository at this point in the history
  • Loading branch information
chzj333 authored and thinkyhead committed Dec 15, 2019
1 parent a0badf5 commit 42a336f
Show file tree
Hide file tree
Showing 10 changed files with 1,229 additions and 44 deletions.
7 changes: 7 additions & 0 deletions Marlin/src/HAL/HAL_STM32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ void spiInit(uint8_t spiRate) {
}
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);

#if ENABLED(CUSTOM_SPI_PINS)
SPI.setMISO(MISO_PIN);
SPI.setMOSI(MOSI_PIN);
SPI.setSCLK(SCK_PIN);
SPI.setSSEL(SS_PIN);
#endif

SPI.begin();
}

Expand Down
53 changes: 15 additions & 38 deletions Marlin/src/pins/stm32/pins_BTT_BTT002_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#ifndef TARGET_STM32F4
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
#elif HOTENDS > 3 || E_STEPPERS > 3
#error "BIGTREE SKR Pro V1.1 supports up to 3 hotends / E-steppers."
#elif HOTENDS > 1 || E_STEPPERS > 1
#error "BIGTREE BTT002 V1.0 supports up to 1 hotends / E-steppers."
#endif

#define BOARD_INFO_NAME "BIGTREE Btt002 1.0"
Expand Down Expand Up @@ -87,22 +87,6 @@
#define E0_CS_PIN PD7
#endif

/*
//SKR_PRO_V1.1
#define E1_STEP_PIN PD15
#define E1_DIR_PIN PE7
#define E1_ENABLE_PIN PA3
#ifndef E1_CS_PIN
#define E1_CS_PIN PG15
#endif
#define E2_STEP_PIN PD13
#define E2_DIR_PIN PG9
#define E2_ENABLE_PIN PF0
#ifndef E2_CS_PIN
#define E2_CS_PIN PG12
#endif
*/
//
// Software SPI pins for TMC2130 stepper drivers
//
Expand Down Expand Up @@ -152,48 +136,41 @@
#define E0_SERIAL_TX_PIN PD7
#define E0_SERIAL_RX_PIN PD7

//#define E1_SERIAL_TX_PIN PD1
//#define E1_SERIAL_RX_PIN PD1

//#define E2_SERIAL_TX_PIN PD6
//#define E2_SERIAL_RX_PIN PD6

// Reduce baud rate to improve software serial reliability
#define TMC_BAUD_RATE 19200
#endif

//
// Temperature Sensors
//
#define TEMP_0_PIN PA2 // T1 <-> E0
#define TEMP_1_PIN PA0 // T2 <-> E1
//#define TEMP_2_PIN PC2 // T3 <-> E2 SKR_PRO
#define TEMP_BED_PIN PA1 // T0 <-> Bed
#define TEMP_0_PIN PA0 // T1 <-> E0
#define TEMP_1_PIN PA1 // T2 <-> E1
#define TEMP_BED_PIN PA2 // T0 <-> Bed

//
// Heaters / Fans
//
#define HEATER_0_PIN PE6 // Heater0
//#define HEATER_1_PIN PD14 // Heater1
//#define HEATER_2_PIN PB0 // Heater1
#define HEATER_0_PIN PE6 // Heater0
#define HEATER_BED_PIN PE5 // Hotbed
#define FAN_PIN PB9 // Fan0
#define FAN1_PIN PB8 // Fan1
//#define FAN2_PIN PE6 // Fan2

// HAL SPI pins group
#define SCK_PIN PA5 // SPI SCLK
#define MYSSEL PA4 // SPI SSEL
#define MISO_PIN PA6 // SPI MISO
#define MOSI_PIN PA7 // SPI MOSI
// HAL SPI1 pins
#define CUSTOM_SPI_PINS
#if ENABLED(CUSTOM_SPI_PINS)
#define SCK_PIN PA5 // SPI1 SCLK
#define SS_PIN PA4 // SPI1 SSEL
#define MISO_PIN PA6 // SPI1 MISO
#define MOSI_PIN PA7 // SPI1 MOSI
#endif

//
// Misc. Functions
//
#define SDSS PA4

/**
* -------------------------------------SKR_MK3-----------------------------------------------
* -------------------------------------BTT002 V1.0-----------------------------------------------
* _____ _____ |
* PA3 | · · | GND 5V | · · | GND |
* NRESET | · · | PC4(SD_DET) (LCD_D7) PE13 | · · | PE12 (LCD_D6) |
Expand Down
2 changes: 1 addition & 1 deletion buildroot/share/PlatformIO/boards/BigTree_Btt002.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"ldscript": "stm32f407xg.ld",
"mcu": "stm32f407vet6",
"variant": "BIGTREE_TBD"
"variant": "BIGTREE_BTT002"
},
"debug": {
"jlink_device": "STM32F407VE",
Expand Down
340 changes: 340 additions & 0 deletions buildroot/share/PlatformIO/variants/BIGTREE_BTT002/PeripheralPins.c

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions buildroot/share/PlatformIO/variants/BIGTREE_BTT002/PinNamesVar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* SYS_WKUP */
#ifdef PWR_WAKEUP_PIN1
SYS_WKUP1 = PA_0,
#endif
#ifdef PWR_WAKEUP_PIN2
SYS_WKUP2 = NC,
#endif
#ifdef PWR_WAKEUP_PIN3
SYS_WKUP3 = NC,
#endif
#ifdef PWR_WAKEUP_PIN4
SYS_WKUP4 = NC,
#endif
#ifdef PWR_WAKEUP_PIN5
SYS_WKUP5 = NC,
#endif
#ifdef PWR_WAKEUP_PIN6
SYS_WKUP6 = NC,
#endif
#ifdef PWR_WAKEUP_PIN7
SYS_WKUP7 = NC,
#endif
#ifdef PWR_WAKEUP_PIN8
SYS_WKUP8 = NC,
#endif
/* USB */
#ifdef USBCON
USB_OTG_FS_SOF = PA_8,
USB_OTG_FS_VBUS = PA_9,
USB_OTG_FS_ID = PA_10,
USB_OTG_FS_DM = PA_11,
USB_OTG_FS_DP = PA_12,
USB_OTG_HS_ULPI_D0 = PA_3,
USB_OTG_HS_SOF = PA_4,
USB_OTG_HS_ULPI_CK = PA_5,
USB_OTG_HS_ULPI_D1 = PB_0,
USB_OTG_HS_ULPI_D2 = PB_1,
USB_OTG_HS_ULPI_D7 = PB_5,
USB_OTG_HS_ULPI_D3 = PB_10,
USB_OTG_HS_ULPI_D4 = PB_11,
USB_OTG_HS_ID = PB_12,
USB_OTG_HS_ULPI_D5 = PB_12,
USB_OTG_HS_ULPI_D6 = PB_13,
USB_OTG_HS_VBUS = PB_13,
USB_OTG_HS_DM = PB_14,
USB_OTG_HS_DP = PB_15,
USB_OTG_HS_ULPI_STP = PC_0,
USB_OTG_HS_ULPI_DIR = PC_2,
USB_OTG_HS_ULPI_NXT = PC_3,
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#pragma once

#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
#define HAL_CRC_MODULE_ENABLED
#define HAL_DMA_MODULE_ENABLED
#define HAL_GPIO_MODULE_ENABLED
#define HAL_I2C_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED Real Time Clock...do we use it?
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
#define HAL_CORTEX_MODULE_ENABLED
//#define HAL_UART_MODULE_ENABLED // by default
//#define HAL_PCD_MODULE_ENABLED // Since STM32 v3.10700.191028 this is automatically added if any type of USB is enabled (as in Arduino IDE)

#undef HAL_SD_MODULE_ENABLED
#undef HAL_DAC_MODULE_ENABLED
#undef HAL_FLASH_MODULE_ENABLED
#undef HAL_CAN_MODULE_ENABLED
#undef HAL_CAN_LEGACY_MODULE_ENABLED
#undef HAL_CEC_MODULE_ENABLED
#undef HAL_CRYP_MODULE_ENABLED
#undef HAL_DCMI_MODULE_ENABLED
#undef HAL_DMA2D_MODULE_ENABLED
#undef HAL_ETH_MODULE_ENABLED
#undef HAL_NAND_MODULE_ENABLED
#undef HAL_NOR_MODULE_ENABLED
#undef HAL_PCCARD_MODULE_ENABLED
#undef HAL_SRAM_MODULE_ENABLED
#undef HAL_SDRAM_MODULE_ENABLED
#undef HAL_HASH_MODULE_ENABLED
#undef HAL_EXTI_MODULE_ENABLED
#undef HAL_SMBUS_MODULE_ENABLED
#undef HAL_I2S_MODULE_ENABLED
#undef HAL_IWDG_MODULE_ENABLED
#undef HAL_LTDC_MODULE_ENABLED
#undef HAL_DSI_MODULE_ENABLED
#undef HAL_QSPI_MODULE_ENABLED
#undef HAL_RNG_MODULE_ENABLED
#undef HAL_SAI_MODULE_ENABLED
#undef HAL_IRDA_MODULE_ENABLED
#undef HAL_SMARTCARD_MODULE_ENABLED
#undef HAL_WWDG_MODULE_ENABLED
#undef HAL_HCD_MODULE_ENABLED
#undef HAL_FMPI2C_MODULE_ENABLED
#undef HAL_SPDIFRX_MODULE_ENABLED
#undef HAL_DFSDM_MODULE_ENABLED
#undef HAL_LPTIM_MODULE_ENABLED
#undef HAL_MMC_MODULE_ENABLED
Loading

0 comments on commit 42a336f

Please sign in to comment.