Fix SKR E3 board BLTOUCH + SPEAKER timer conflict (#15781)

This commit is contained in:
Miroslav Šustek 2019-11-07 00:34:29 +01:00 committed by Scott Lahteine
parent 814a2eaf8f
commit 9201197878
3 changed files with 21 additions and 3 deletions

View file

@ -53,7 +53,7 @@ static const spi_pins* dev_to_spi_pins(spi_dev *dev);
static void configure_gpios(spi_dev *dev, bool as_master);
static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq);
#if (BOARD_NR_SPI >= 3) && !defined(STM32_HIGH_DENSITY)
#if BOARD_NR_SPI >= 3 && !defined(STM32_HIGH_DENSITY)
#error "The SPI library is misconfigured: 3 SPI ports only available on high density STM32 devices"
#endif

View file

@ -57,7 +57,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
case 3: irq_num = NVIC_TIMER3; break;
case 4: irq_num = NVIC_TIMER4; break;
case 5: irq_num = NVIC_TIMER5; break;
#if ENABLED(STM32_HIGH_DENSITY)
#ifdef STM32_HIGH_DENSITY
// 6 & 7 are basic timers, avoid them
case 8: irq_num = NVIC_TIMER8_CC; break;
#endif

View file

@ -47,6 +47,20 @@ typedef uint16_t hal_timer_t;
#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
/**
* Note: Timers may be used by platforms and libraries
*
* FAN PWMs:
* With FAN_SOFT_PWM disabled the Temperature class uses
* FANx_PIN timers to generate FAN PWM signals.
*
* Speaker:
* When SPEAKER is enabled, one timer is allocated by maple/tone.cpp.
* - If BEEPER_PIN has a timer channel (and USE_PIN_TIMER is
* defined in tone.cpp) it uses the pin's own timer.
* - Otherwise it uses Timer 8 on boards with STM32_HIGH_DENSITY
* or Timer 4 on other boards.
*/
#if defined(MCU_STM32F103CB) || defined(MCU_STM32F103C8)
#define STEP_TIMER_NUM 4 // For C8/CB boards, use timer 4
#else
@ -58,7 +72,11 @@ typedef uint16_t hal_timer_t;
#if MB(BIGTREE_SKR_MINI_E3, BIGTREE_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE)
// SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM.
#define SERVO0_TIMER_NUM 8
#ifdef STM32_HIGH_DENSITY
#define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4
#else
#define SERVO0_TIMER_NUM 3 // tone.cpp uses Timer 8
#endif
#else
#define SERVO0_TIMER_NUM 1 // SERVO0 or BLTOUCH
#endif