Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 4932e4b

Browse files
authored
v1.0.1 to add PWM_StepperControl example
### Releases v1.0.1 1. Add example [PWM_StepperControl](https://github.com/khoih-prog/STM32_PWM/tree/main/examples/PWM_StepperControl) to demo how to control Stepper Motor using PWM
1 parent cfaac42 commit 4932e4b

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

README.md

+41-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
* [ 1. PWM_Multi](examples/PWM_Multi)
3838
* [ 2. PWM_Multi_Args](examples/PWM_Multi_Args)
3939
* [ 3. PWMs_Array_Complex](examples/PWMs_Array_Complex)
40-
* [Example PWMs_Array_Complex](#example-PWMs_Array_Complex)
40+
* [ 4. PWM_StepperControl](examples/PWM_StepperControl) **New**
41+
* [Example PWM_StepperControl](#example-PWM_StepperControl)
4142
* [Debug Terminal Output Samples](#debug-terminal-output-samples)
4243
* [1. PWMs_Array_Complex on NUCLEO_F767ZI](#1-PWMs_Array_Complex-on-NUCLEO_F767ZI)
4344
* [2. PWMs_Array_Complex on NUCLEO_H743ZI2](#2-PWMs_Array_Complex-on-NUCLEO_H743ZI2)
@@ -132,7 +133,7 @@ Functions using normal software-based PWM, relying on loop() and calling millis(
132133
## Prerequisites
133134

134135
1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
135-
2. [`Arduino Core for STM32 v2.3.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
136+
2. [`Arduino Core for STM32 v2.4.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
136137
3. To use with certain example
137138
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
138139
---
@@ -333,7 +334,6 @@ TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pinNameToUse, PinMap_PW
333334
```cpp
334335
void PeriodCallback()
335336
{
336-
337337
}
338338

339339
void setup()
@@ -352,12 +352,13 @@ void setup()
352352
1. [PWM_Multi](examples/PWM_Multi)
353353
2. [PWM_Multi_Args](examples/PWM_Multi_Args)
354354
3. [PWMs_Array_Complex](examples/PWMs_Array_Complex)
355+
4. [PWM_StepperControl](examples/PWM_StepperControl) **New**
355356

356357

357358
---
358359
---
359360

360-
### Example [PWMs_Array_Complex](examples/PWMs_Array_Complex)
361+
### Example [PWM_StepperControl](examples/PWM_StepperControl)
361362

362363
```cpp
363364
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
@@ -838,7 +839,7 @@ The following is the sample terminal output when running example [PWMs_Array_Com
838839
839840
```cpp
840841
Starting PWMs_Array_Complex on NUCLEO_F767ZI
841-
STM32_PWM v1.0.0
842+
STM32_PWM v1.0.1
842843
Index = 0, Instance = 0x40000000, channel = 1, TimerIndex = 1, PinName = 0
843844
Index = 1, Instance = 0x40010000, channel = 3, TimerIndex = 0, PinName = 77
844845
Index = 2, Instance = 0x40000800, channel = 4, TimerIndex = 3, PinName = 63
@@ -876,7 +877,7 @@ The following is the sample terminal output when running example [PWMs_Array_Com
876877

877878
```cpp
878879
Starting PWMs_Array_Complex on NUCLEO_H743ZI2
879-
STM32_PWM v1.0.0
880+
STM32_PWM v1.0.1
880881
Index = 0, Instance = 0x40000000, channel = 1, TimerIndex = 1, PinName = 0
881882
Index = 1, Instance = 0x40010000, channel = 3, TimerIndex = 0, PinName = 77
882883
Index = 2, Instance = 0x40000800, channel = 4, TimerIndex = 3, PinName = 63
@@ -902,7 +903,7 @@ The following is the sample terminal output when running example [PWMs_Array_Com
902903
903904
```cpp
904905
Starting PWMs_Array_Complex on NUCLEO_L552ZE_Q
905-
STM32_PWM v1.0.0
906+
STM32_PWM v1.0.1
906907
Index = 0, Instance = 0x40000000, channel = 1, TimerIndex = 1, PinName = 0
907908
Index = 1, Instance = 0x40012C00, channel = 3, TimerIndex = 0, PinName = 77
908909
Index = 2, Instance = 0x40000800, channel = 4, TimerIndex = 3, PinName = 63
@@ -928,7 +929,7 @@ The following is the sample terminal output when running example [PWMs_Array_Com
928929

929930
```cpp
930931
Starting PWMs_Array_Complex on BLUEPILL_F103CB
931-
STM32_PWM v1.0.0
932+
STM32_PWM v1.0.1
932933
Using pin = 0, 1, etc => Index = 0, Instance = 0x40000000, channel = 1, TimerIndex = 1, PinName = 0
933934
Using pin = 0, 1, etc => Index = 1, Instance = 0x40000400, channel = 2, TimerIndex = 2, PinName = 21
934935
Using pin = 0, 1, etc => Index = 2, Instance = 0x40012C00, channel = 3, TimerIndex = 0, PinName = 10
@@ -952,6 +953,27 @@ SimpleTimer (ms): 2000, us : 52974007, Dus : 10001000
952953
PWM Channel : 0, programmed Period (us): 50000, actual : 49999, programmed DutyCycle : 20, actual : 20.00
953954
PWM Channel : 1, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 30, actual : 30.00
954955
PWM Channel : 2, programmed Period (us): 2000, actual : 2000, programmed DutyCycle : 50, actual : 50.00
956+
```
957+
---
958+
959+
### 5. PWM_StepperControl on NUCLEO_F767ZI
960+
961+
The following is the sample terminal output when running example [PWM_StepperControl](examples/PWM_StepperControl) on **NUCLEO_F767ZI** to demonstrate how to control Stepper Motor using PWM
962+
963+
964+
```
965+
Starting PWM_StepperControl on NUCLEO_F767ZI
966+
STM32_PWM v1.0.1
967+
stepperTimer = 0x40010000, channel = 3, TimerIndex = 0, PinName = 77
968+
setSpeed = 2000
969+
setSpeed = 0
970+
setSpeed = -1000
971+
setSpeed = 0
972+
setSpeed = 2000
973+
setSpeed = 0
974+
setSpeed = -1000
975+
```
976+
955977
956978
---
957979
---
@@ -996,6 +1018,7 @@ Submit issues to: [STM32_PWM issues](https://github.com/khoih-prog/STM32_PWM/iss
9961018

9971019
1. Basic hardware-based multi-channel PWM for **STM32F/L/H/G/WB/MP1 boards**.
9981020
2. Add Table of Contents
1021+
3. Add example [PWM_StepperControl](https://github.com/khoih-prog/STM32_PWM/tree/main/examples/PWM_StepperControl) to demo how to control Stepper Motor using PWM
9991022

10001023
---
10011024
---
@@ -1004,12 +1027,22 @@ Submit issues to: [STM32_PWM issues](https://github.com/khoih-prog/STM32_PWM/iss
10041027

10051028
Many thanks for everyone for bug reporting, new feature suggesting, testing and contributing to the development of this library.
10061029

1030+
1. Thanks to [Paul van Dinther](https://github.com/dinther) for proposing new way to use PWM to drive Stepper-Motor in [Using PWM to step a stepper driver #16](https://github.com/khoih-prog/RP2040_PWM/issues/16), leading to v2.0.3
1031+
1032+
1033+
<table>
1034+
<tr>
1035+
<td align="center"><a href="https://github.com/dinther"><img src="https://github.com/dinther.png" width="100px;" alt="dinther"/><br /><sub><b>Paul van Dinther</b></sub></a><br /></td>
1036+
</tr>
1037+
</table>
1038+
10071039

10081040
---
10091041

10101042
## Contributing
10111043

10121044
If you want to contribute to this project:
1045+
10131046
- Report bugs and errors
10141047
- Ask for enhancements
10151048
- Create issues and pull requests

0 commit comments

Comments
 (0)