Giter Club home page Giter Club logo

Comments (11)

terjeio avatar terjeio commented on May 26, 2024

Seems it is possible, from PA1 spec: USART2_RTS(9)/ADC12_IN1/TIM2_CH2(9)
driver.h must be modified for that, STEPPER_TIMER has to be changed as well as it is mapped to timer 2.

You can do it?

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

I will try to do it. If I am not successful, I will inform you,

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

Seems it is possible, from PA1 spec: USART2_RTS(9)/ADC12_IN1/TIM2_CH2(9) driver.h must be modified for that, STEPPER_TIMER has to be changed as well as it is mapped to timer 2.

You can do it?

I have modified the driver.h file for SPINDLE PWM on PA1, gives output when SPINDLE_PWM_TIMER_INV set to 1, output does not work when set to 0

// Define timer allocations.
#define STEPPER_TIMER TIM5
#define PULSE_TIMER TIM3
#define DEBOUNCE_TIMER TIM4

#ifdef SPINDLE_PWM_PORT_BASE

#if SPINDLE_PWM_PORT_BASE == GPIOA_BASE
#if SPINDLE_PWM_PIN == 1 // PA1 - TIM2_CH2
#define SPINDLE_PWM_TIMER_N 2
#define SPINDLE_PWM_TIMER_CH 2
#define SPINDLE_PWM_TIMER_INV 1
#define SPINDLE_PWM_AF_REMAP 0
#endif
#if SPINDLE_PWM_PIN == 8 // PA8 - TIM1_CH1
#define SPINDLE_PWM_TIMER_N 1
#define SPINDLE_PWM_TIMER_CH 1
#define SPINDLE_PWM_TIMER_INV 0
#define SPINDLE_PWM_AF_REMAP 0
#endif
#elif SPINDLE_PWM_PORT_BASE == GPIOB_BASE
#if SPINDLE_PWM_PIN == 0 // PB0 - TIM1_CH2N
#define SPINDLE_PWM_TIMER_N 1
#define SPINDLE_PWM_TIMER_CH 2
#define SPINDLE_PWM_TIMER_INV 1
#define SPINDLE_PWM_AF_REMAP 0b01
#endif
#endif

I want normal output of this signal
1

from stm32f1xx.

terjeio avatar terjeio commented on May 26, 2024

I have modified the driver.h file for SPINDLE PWM on PA1, gives output when SPINDLE_PWM_TIMER_INV set to 1, output does not work when set to 0

That is a bit odd, is this with a cloned MCU or genuine one?

I want normal output of this signal

The scope trace does not tell me anything. What is wrong with it? Should it be 5KHz?

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

The scope trace does not tell me anything. What is wrong with it? Should it be 5KHz?

I guess I didn't fully explain the problem. The output of the oscilloscope indicates that the output of the generated signal is inverted. The expected signal should be invertesd to the signal on the oscilloscope, how should we set it up?

The generated PWM signal should be a signal for the BESC spindle as shown below appears on the oscilloscope.

expexted pwm out signal
2

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

That is a bit odd, is this with a cloned MCU or genuine one?

real mcu, i am using BTT SKR MINI E3 V2.0 3D printer board

from stm32f1xx.

terjeio avatar terjeio commented on May 26, 2024

$16=4 works? ($$=16 for info)

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

$16=4 works? ($$=16 for info)

$16=4 ,I did nothing changed
$$=16
0 - Spindle enable (1)
1 - Spindle direction (2)
2 - PWM (4)
Inverts the spindle on, counterclockwise and PWM signals (active low).

3

4

5

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

#define SPINDLE_PWM_TIMER_INV 1

when SPINDLE_PWM_TIMER_INV set to 0
#define SPINDLE_PWM_TIMER_INV 0

no pwm output on PA1

6

from stm32f1xx.

terjeio avatar terjeio commented on May 26, 2024

There is a nasty bug here, wonder if it is this that trips it up for PA1? The line should be:

SPINDLE_PWM_TIMER->CCER |= SPINDLE_PWM_CCER_EN;

from stm32f1xx.

MeKeCNC avatar MeKeCNC commented on May 26, 2024

There is a nasty bug here, wonder if it is this that trips it up for PA1? The line should be:

SPINDLE_PWM_TIMER->CCER |= SPINDLE_PWM_CCER_EN;

good catch, it works now. that is, we can use two different pins (PA1 and PA8) for the pwm spindle output on the BTT SKR MINI E3 V2.0 3D printer board. in driver.h latest revision code as below

// Define timer allocations.
#define STEPPER_TIMER TIM2
#define PULSE_TIMER TIM3
#define DEBOUNCE_TIMER TIM4

#ifdef SPINDLE_PWM_PORT_BASE

#if SPINDLE_PWM_PORT_BASE == GPIOA_BASE
#if SPINDLE_PWM_PIN == 1 // PA1 - TIM5_CH2
#define SPINDLE_PWM_TIMER_N 5
#define SPINDLE_PWM_TIMER_CH 2
#define SPINDLE_PWM_TIMER_INV 0
#define SPINDLE_PWM_AF_REMAP 0
#endif
#if SPINDLE_PWM_PIN == 8 // PA8 - TIM1_CH1
#define SPINDLE_PWM_TIMER_N 1
#define SPINDLE_PWM_TIMER_CH 1
#define SPINDLE_PWM_TIMER_INV 0
#define SPINDLE_PWM_AF_REMAP 0
#endif
#elif SPINDLE_PWM_PORT_BASE == GPIOB_BASE
#if SPINDLE_PWM_PIN == 0 // PB0 - TIM1_CH2N
#define SPINDLE_PWM_TIMER_N 1
#define SPINDLE_PWM_TIMER_CH 2
#define SPINDLE_PWM_TIMER_INV 1
#define SPINDLE_PWM_AF_REMAP 0b01
#endif
#endif

from stm32f1xx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.