Skip to content
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

New HardwareTimer for STM32 5.7.0 #15655

Merged
merged 26 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f70374b
STM32 update to HardwareTimer 1.7.0
Oct 24, 2019
0a57b79
Removed unused variable and assert
LinoBarreca Nov 5, 2019
23cadf4
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into NewTimer
LinoBarreca Nov 6, 2019
b6199f8
fix build
LinoBarreca Nov 6, 2019
ccdbb2f
Ignore SoftwareSerialM again
LinoBarreca Nov 6, 2019
cbea0f8
TIM4 in SoftSerial conflicts with PWM output
LinoBarreca Nov 6, 2019
5113044
Disable PWM on everything but surely needed
LinoBarreca Nov 6, 2019
1e215ee
SoftwareSerial Timer = 13
LinoBarreca Nov 6, 2019
d557a25
Merge branch 'bugfix-2.0.x' into NewTimer
thinkyhead Nov 7, 2019
6a36af2
Added SoftwareSerial by @sjasonsmith
sjasonsmith Nov 7, 2019
9e5d85c
Modify @sjasonsmith 's implementation
LinoBarreca Nov 7, 2019
fd7fb51
Faster force update (test)
LinoBarreca Nov 7, 2019
14e880d
Revert changes to BTT002 for now.
LinoBarreca Nov 7, 2019
36d0253
Minimize changes with base branch
LinoBarreca Nov 7, 2019
7ef68e4
IRQ enable/disable without timer re-init.
LinoBarreca Nov 8, 2019
1169ae1
Better instruction order in case of multi IRQ
LinoBarreca Nov 8, 2019
e8668d5
Remove un-needed define FORCE_BAUD_RATE
LinoBarreca Nov 8, 2019
56a7fd4
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into NewTimer
LinoBarreca Nov 9, 2019
8c09d3b
Revert F4_F7 timers
LinoBarreca Nov 9, 2019
ffc41d0
DIsable travis on F4 & F7 since SPI is broken
LinoBarreca Nov 9, 2019
2fde417
Improved variant pins for SKR Pro 1.1
LinoBarreca Nov 12, 2019
7840493
Update HAL.cpp
thinkyhead Nov 13, 2019
6cc2a1a
Formatting, spelling, etc.
thinkyhead Nov 13, 2019
9f359f3
Update SoftwareSerial.h
thinkyhead Nov 13, 2019
19d3490
Update timers.cpp
thinkyhead Nov 13, 2019
362288c
Update hal_conf_extra.h
thinkyhead Nov 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,34 @@ env:
- TEST_PLATFORM="sanguino_atmega1284p"
- TEST_PLATFORM="sanguino_atmega644p"

# Broken Extended STM32 Environments
#- TEST_PLATFORM="ARMED"
#- TEST_PLATFORM="BIGTREE_BTT002"
#- TEST_PLATFORM="BIGTREE_SKR_PRO"

# Extended STM32 Environments
- TEST_PLATFORM="STM32F103RC_bigtree"
- TEST_PLATFORM="STM32F103RC_bigtree_USB"
- TEST_PLATFORM="STM32F103RC_fysetc"
- TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="STM32F103VE_longer"
- TEST_PLATFORM="STM32F407VE_black"
- TEST_PLATFORM="BIGTREE_SKR_PRO"
- TEST_PLATFORM="mks_robin"
- TEST_PLATFORM="ARMED"

# STM32 with non-STM framework. both broken for now. they should use HAL_STM32 which is working.
#- TEST_PLATFORM="STM32F4"
#- TEST_PLATFORM="STM32F7"

# Put lengthy tests last
- TEST_PLATFORM="LPC1768"
- TEST_PLATFORM="LPC1769"

# Non-working environment tests
#- TEST_PLATFORM="BIGTREE_BTT002" this board isn't released yet. we need pinout to be sure about what we do
#- TEST_PLATFORM="at90usb1286_cdc"
#- TEST_PLATFORM="at90usb1286_dfu"
#- TEST_PLATFORM="STM32F103CB_malyan"
#- TEST_PLATFORM="mks_robin_lite"
#- TEST_PLATFORM="mks_robin_mini"
#- TEST_PLATFORM="mks_robin_nano"
#- TEST_PLATFORM="SAMD51_grandcentral_m4"
#- TEST_PLATFORM="STM32F103RC_bigtree"
#- TEST_PLATFORM="STM32F103RC_bigtree_USB"
#- TEST_PLATFORM="STM32F103RC_fysetc"
#- TEST_PLATFORM="STM32F4"
#- TEST_PLATFORM="STM32F7"

before_install:
#
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_ESP32/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ typedef uint64_t hal_timer_t;
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25
#else
#define STEPPER_TIMER_PRESCALE 40
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer, 2MHz
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
#define STEPPER_TIMER_RATE ((HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE)) // frequency of stepper timer, 2MHz
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
#endif

#define STEP_TIMER_MIN_INTERVAL 8 // minimum time in µs between stepper interrupts
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_SAMD51/timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB);

// Set compare value
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = HAL_TIMER_RATE / frequency;
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = (HAL_TIMER_RATE) / frequency;

// And start timer
tc->COUNT32.CTRLA.bit.ENABLE = true;
Expand Down
14 changes: 14 additions & 0 deletions Marlin/src/HAL/HAL_STM32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
#include "../../inc/MarlinConfig.h"
#include "../shared/Delay.h"

#if (__cplusplus == 201703L) && defined(__has_include)
#define HAS_SWSERIAL __has_include(<SoftwareSerial.h>)
#else
#define HAS_SWSERIAL HAS_TMC220x
#endif

#if HAS_SWSERIAL
#include "SoftwareSerial.h"
#endif

#if ENABLED(SRAM_EEPROM_EMULATION)
#if STM32F7xx
#include "stm32f7xx_ll_pwr.h"
Expand Down Expand Up @@ -82,6 +92,10 @@ void HAL_init() {
// Wait until backup regulator is initialized
while (!LL_PWR_IsActiveFlag_BRR());
#endif // EEPROM_EMULATED_SRAM

#if HAS_SWSERIAL
SoftwareSerial::setInterruptPriority(SWSERIAL_TIMER_IRQ_PRIO, 0);
#endif
}

void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
Expand Down
Loading