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

Fix multiple servos with STM32 #16151

Merged
merged 2 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
1 change: 0 additions & 1 deletion Marlin/src/HAL/HAL_STM32/Servo.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ class libServo : public Servo {
private:
typedef Servo super;
uint16_t min_ticks, max_ticks;
uint8_t servoIndex; // index into the channel data for this servo
};
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ extern "C" {

// Timer Definitions
//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
#define TIMER_TONE TIM6
#define TIMER_TONE TIM2
#define TIMER_SERIAL TIM7

// Do not use basic timer: OC is required
#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work
#define TIMER_SERVO TIM6 //TODO: advanced-control timers don't work
Comment on lines 252 to +253
Copy link
Contributor

@sjasonsmith sjasonsmith Dec 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused by this. TIM6 is a basic timer, and TIM2 is a General-purpose timer.
This contradicts the comment in the line above. Do you know why this is working using the less functional timer?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi all,
the comment is a legacy one. Since HardwareTimer library has been deployed, this comment is no more relevant.
Using TIM6 is a good option like it is not linked to a pin.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case we may need to check whether TIM2 is attached to any pins that might cause problems for the TONE_TIMER. Perhaps you are using some of the pins which attach to TIM2 as PWM outputs, and those are interfering with the timer operation.

(Sounds like the comment should be removed as well)


// UART Definitions
// Define here Serial instance number to map on Serial generic name
Expand Down