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

Esp32 HAL - fixed i2s stream, added PWM to extended pins #14592

Merged
merged 7 commits into from
Jul 14, 2019

Conversation

Ringel
Copy link
Contributor

@Ringel Ringel commented Jul 12, 2019

Description

Fixes I2S Stream in ESP32 HAL. Last code didn't fill up the DMA buffer completely, leaving last ~4 samples from older calculation when no more steps were needed. This could result in permanent motor drift if a step was in the last 4 samples.

To direct access the last 16bit of the extension bypassing the DMA a new define I2S_STEPPER_SPLIT_STREAM was introduced for using in pins.h

To handle the extended pins as PWM - a timer inside the HAL adds PWM features - as current Marlin doesn't handle CONTROLLER_FAN, E?_AUTO_FAN by FAN_SOFT_PWM
This also resolves conflicting hardware usage for PWM and servos.

Benefits

Working Stepper Motors via i2s extender.
Working PWM for Controller, E0,E.. FANS via i2s extender in split mode

@simon-jouet
Copy link
Contributor

I already replied to @Ringel in simon-jouet/ESP32Controller#10.

I'm all for the changes to i2s.cpp because they add the constant i2s channel + fix the DMA stream but I think we should old fire on the changes to PWM/timer, ledc is superior to a timer when we can use it so we probably should enable the timer and do soft PWM only when ledc is not usable

@Ringel
Copy link
Contributor Author

Ringel commented Jul 14, 2019

@simon-jouet as suggested i'm using ledc for internal pins and fire the timer on first non-internal PWM pin usage.

@thinkyhead thinkyhead added A: ESP32 PR: Bug Fix T: HAL & APIs Topic related to the HAL and internal APIs. labels Jul 14, 2019
@thinkyhead thinkyhead merged commit e139c1d into MarlinFirmware:bugfix-2.0.x Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: ESP32 PR: Bug Fix T: HAL & APIs Topic related to the HAL and internal APIs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants