Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
v1.3.2 to remove crashing PIN_D24
Browse files Browse the repository at this point in the history
### Releases v1.3.2

1. Remove crashing `PIN_D24` from examples
  • Loading branch information
khoih-prog committed May 9, 2022
1 parent aa86755 commit bf025f2
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 37 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `ESP32` Core Version (e.g. ESP32 core v2.0.2)
* `ESP32` Core Version (e.g. ESP32 core v2.0.3)
* `ESP32` Board type (e.g. ESP32_DEV Module, etc.)
* `ESP32-S2` Board type (e.g. ESP32S2_DEV Module, ESP32_S2_Saola, etc.)
* `ESP32_S3` Board type (e.g. ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.)
Expand All @@ -31,10 +31,10 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.19
ESP32 core v2.0.2
ESP32 core v2.0.3
ESP32S3_DEV Module
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while using TimerInterrupt.
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
## Prerequisites

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)
2. [`ESP32 Core 2.0.2+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/).
2. [`ESP32 Core 2.0.3+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/).
3. [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) to use with some examples.


Expand Down Expand Up @@ -309,7 +309,7 @@ The following is the sample terminal output when running example [ISR_16_PWMs_Ar

```
Starting ISR_16_PWMs_Array_Complex on ESP32_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -377,7 +377,7 @@ The following is the sample terminal output when running example [ISR_16_PWMs_Ar

```
Starting ISR_16_PWMs_Array on ESP32_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -412,7 +412,7 @@ The following is the sample terminal output when running example [ISR_16_PWMs_Ar

```
Starting ISR_16_PWMs_Array_Simple on ESP32_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -446,7 +446,7 @@ The following is the sample terminal output when running example [ISR_Modify_PWM

```
Starting ISR_Modify_PWM on ESP32_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -482,7 +482,7 @@ The following is the sample terminal output when running example [ISR_Changing_P

```
Starting ISR_Changing_PWM on ESP32_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -516,7 +516,7 @@ The following is the sample terminal output when running example [ISR_Modify_PWM

```
Starting ISR_Modify_PWM on ESP32S2_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_S2_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -552,7 +552,7 @@ The following is the sample terminal output when running example [ISR_Changing_P

```
Starting ISR_Changing_PWM on ESP32S2_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_S2_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand All @@ -578,7 +578,7 @@ The following is the sample terminal output when running example [ISR_Modify_PWM

```
Starting ISR_Modify_PWM on ESP32C3_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 160 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -614,7 +614,7 @@ The following is the sample terminal output when running example [ISR_Changing_P

```
Starting ISR_Changing_PWM on ESP32C3_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 160 MHz
[PWM] ESP32_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -643,7 +643,7 @@ The following is the sample terminal output when running example [ISR_16_PWMs_Ar

```
Starting ISR_16_PWMs_Array_Complex on ESP32S3_DEV
ESP32_PWM v1.3.1
ESP32_PWM v1.3.2
CPU Frequency = 240 MHz
[PWM] ESP32_S3_TimerInterrupt: _timerNo = 1 , _fre = 1000000
[PWM] TIMER_BASE_CLK = 80000000 , TIMER_DIVIDER = 80
Expand Down Expand Up @@ -774,6 +774,8 @@ Submit issues to: [ESP32_PWM issues](https://github.com/khoih-prog/ESP32_PWM/iss
9. DutyCycle to be optionally updated at the end current PWM period instead of immediately.
10. Add support to `ESP32-S3`
11. Display informational warning only when `_PWM_LOGLEVEL_` > 3
12. Remove crashing `PIN_D24` from examples


---
---
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.3.2](#releases-v132)
* [Releases v1.3.1](#releases-v131)
* [Releases v1.3.0](#releases-v130)
* [Releases v1.2.2](#releases-v122)
Expand All @@ -27,6 +28,11 @@

## Changelog

### Releases v1.3.2

1. Remove crashing `PIN_D24` from examples


### Releases v1.3.1

1. Fix `DutyCycle` bug. Check [float precisison of DutyCycle only sometimes working #3](https://github.com/khoih-prog/SAMD_Slow_PWM/issues/3)
Expand Down
6 changes: 3 additions & 3 deletions examples/ISR_16_PWMs_Array/ISR_16_PWMs_Array.ino
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ bool IRAM_ATTR TimerHandler(void * timerNo)
#define PIN_D21 21 // Pin D21 mapped to pin GPIO21/SDA of ESP32
#define PIN_D22 22 // Pin D22 mapped to pin GPIO22/SCL of ESP32
#define PIN_D23 23 // Pin D23 mapped to pin GPIO23/VSPI_MOSI of ESP32
#define PIN_D24 24 // Pin D24 mapped to pin GPIO24 of ESP32
#define PIN_D25 25 // Pin D25 mapped to pin GPIO25/ADC18/DAC1 of ESP32
#define PIN_D26 26 // Pin D26 mapped to pin GPIO26/ADC19/DAC2 of ESP32
#define PIN_D27 27 // Pin D27 mapped to pin GPIO27/ADC17/TOUCH7 of ESP32
Expand Down Expand Up @@ -131,10 +130,11 @@ uint32_t PWM_Pin[] =
PIN_D9, PIN_D10, PIN_D11, PIN_D12, PIN_D13, PIN_D14, PIN_D15, PIN_D16,
};
#else
// Bad pins to use: PIN_D24
uint32_t PWM_Pin[] =
{
PIN_D24, LED_BUILTIN, PIN_D3, PIN_D4, PIN_D5, PIN_D12, PIN_D13, PIN_D14,
PIN_D15, PIN_D16, PIN_D17, PIN_D18, PIN_D19, PIN_D21, PIN_D22, PIN_D23
LED_BUILTIN, PIN_D25, PIN_D3, PIN_D4, PIN_D5, PIN_D12, PIN_D13, PIN_D14,
PIN_D15, PIN_D16, PIN_D17, PIN_D18, PIN_D19, PIN_D21, PIN_D22, PIN_D23
};
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ bool IRAM_ATTR TimerHandler(void * timerNo)
#define PIN_D21 21 // Pin D21 mapped to pin GPIO21/SDA of ESP32
#define PIN_D22 22 // Pin D22 mapped to pin GPIO22/SCL of ESP32
#define PIN_D23 23 // Pin D23 mapped to pin GPIO23/VSPI_MOSI of ESP32
#define PIN_D24 24 // Pin D24 mapped to pin GPIO24 of ESP32
#define PIN_D25 25 // Pin D25 mapped to pin GPIO25/ADC18/DAC1 of ESP32
#define PIN_D26 26 // Pin D26 mapped to pin GPIO26/ADC19/DAC2 of ESP32
#define PIN_D27 27 // Pin D27 mapped to pin GPIO27/ADC17/TOUCH7 of ESP32
Expand Down Expand Up @@ -140,10 +139,11 @@ uint32_t PWM_Pin[] =
PIN_D9, PIN_D10, PIN_D11, PIN_D12, PIN_D13, PIN_D14, PIN_D15, PIN_D16,
};
#else
// Bad pins to use: PIN_D24
uint32_t PWM_Pin[] =
{
PIN_D24, LED_BUILTIN, PIN_D3, PIN_D4, PIN_D5, PIN_D12, PIN_D13, PIN_D14,
PIN_D15, PIN_D16, PIN_D17, PIN_D18, PIN_D19, PIN_D21, PIN_D22, PIN_D23
LED_BUILTIN, PIN_D25, PIN_D3, PIN_D4, PIN_D5, PIN_D12, PIN_D13, PIN_D14,
PIN_D15, PIN_D16, PIN_D17, PIN_D18, PIN_D19, PIN_D21, PIN_D22, PIN_D23
};
#endif

Expand Down Expand Up @@ -450,6 +450,7 @@ void setup()
#endif
}


// You need this timer for non-critical tasks. Avoid abusing ISR if not absolutely necessary.
simpleTimer.setInterval(SIMPLE_TIMER_MS, simpleTimerDoingSomething2s);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ bool IRAM_ATTR TimerHandler(void * timerNo)
#define PIN_D21 21 // Pin D21 mapped to pin GPIO21/SDA of ESP32
#define PIN_D22 22 // Pin D22 mapped to pin GPIO22/SCL of ESP32
#define PIN_D23 23 // Pin D23 mapped to pin GPIO23/VSPI_MOSI of ESP32
#define PIN_D24 24 // Pin D24 mapped to pin GPIO24 of ESP32
#define PIN_D25 25 // Pin D25 mapped to pin GPIO25/ADC18/DAC1 of ESP32
#define PIN_D26 26 // Pin D26 mapped to pin GPIO26/ADC19/DAC2 of ESP32
#define PIN_D27 27 // Pin D27 mapped to pin GPIO27/ADC17/TOUCH7 of ESP32
Expand Down Expand Up @@ -131,10 +130,11 @@ uint32_t PWM_Pin[] =
PIN_D9, PIN_D10, PIN_D11, PIN_D12, PIN_D13, PIN_D14, PIN_D15, PIN_D16,
};
#else
// Bad pins to use: PIN_D24
uint32_t PWM_Pin[] =
{
PIN_D24, LED_BUILTIN, PIN_D3, PIN_D4, PIN_D5, PIN_D12, PIN_D13, PIN_D14,
PIN_D15, PIN_D16, PIN_D17, PIN_D18, PIN_D19, PIN_D21, PIN_D22, PIN_D23
LED_BUILTIN, PIN_D25, PIN_D3, PIN_D4, PIN_D5, PIN_D12, PIN_D13, PIN_D14,
PIN_D15, PIN_D16, PIN_D17, PIN_D18, PIN_D19, PIN_D21, PIN_D22, PIN_D23
};
#endif

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ESP32_PWM",
"version": "1.3.1",
"version": "1.3.2",
"keywords": "timing, device, control, pwm, timer, interrupt, hardware, isr, isr-based, hardware-timer, isr-timer, isr-based-timer, mission-critical, accuracy, precise, non-blocking, esp32, esp32-s2, esp32-c3, esp32-s3, synchronized-PWM, on-the-fly",
"description": "This library enables you to use Interrupt from Hardware Timers on an ESP32, ESP32_S2, ESP32_S3 or ESP32_C3-based board to create and output PWM to pins. It now supports 16 ISR-based synchronized PWM channels, while consuming only 1 Hardware Timer. PWM interval can be very long (uint32_t millisecs). The most important feature is they're ISR-based PWM channels. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware PWM channels, using interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's necessary if you need to measure some data requiring better accuracy. Now you can change the PWM settings on-the-fly",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32_PWM
version=1.3.1
version=1.3.2
author=Khoi Hoang <[email protected]>
maintainer=Khoi Hoang <[email protected]>
sentence=This library enables you to use Interrupt from Hardware Timers on an ESP32, ESP32_S2, ESP32_S3 or ESP32_C3-based board to create and output PWM to pins.
Expand Down
2 changes: 2 additions & 0 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ upload_speed = 921600

; Checks for the compatibility with frameworks and dev/platforms
lib_compat_mode = strict
lib_ldf_mode = chain+
;lib_ldf_mode = deep+

lib_deps =

Expand Down
3 changes: 2 additions & 1 deletion src/ESP32_PWM.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -35,6 +35,7 @@
1.2.2 K Hoang 01/02/2022 Use float for DutyCycle and Freq, uint32_t for period. Optimize code
1.3.0 K Hoang 12/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Fix `DutyCycle` and `New Period` display bugs. Display warning only when debug level > 3
1.3.2 K Hoang 09/05/2022 Remove crashing PIN_D24 from examples
*****************************************************************************************************************************/

#pragma once
Expand Down
9 changes: 5 additions & 4 deletions src/ESP32_PWM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -35,6 +35,7 @@
1.2.2 K Hoang 01/02/2022 Use float for DutyCycle and Freq, uint32_t for period. Optimize code
1.3.0 K Hoang 12/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Fix `DutyCycle` and `New Period` display bugs. Display warning only when debug level > 3
1.3.2 K Hoang 09/05/2022 Remove crashing PIN_D24 from examples
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -70,13 +71,13 @@
#endif

#ifndef ESP32_PWM_VERSION
#define ESP32_PWM_VERSION "ESP32_PWM v1.3.1"
#define ESP32_PWM_VERSION "ESP32_PWM v1.3.2"

#define ESP32_PWM_VERSION_MAJOR 1
#define ESP32_PWM_VERSION_MINOR 3
#define ESP32_PWM_VERSION_PATCH 1
#define ESP32_PWM_VERSION_PATCH 2

#define ESP32_PWM_VERSION_INT 1003001
#define ESP32_PWM_VERSION_INT 1003002
#endif

#ifndef TIMER_INTERRUPT_DEBUG
Expand Down
3 changes: 2 additions & 1 deletion src/ESP32_PWM_ISR.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -34,6 +34,7 @@
1.2.2 K Hoang 01/02/2022 Use float for DutyCycle and Freq, uint32_t for period. Optimize code
1.3.0 K Hoang 12/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Fix `DutyCycle` and `New Period` display bugs. Display warning only when debug level > 3
1.3.2 K Hoang 09/05/2022 Remove crashing PIN_D24 from examples
*****************************************************************************************************************************/

#pragma once
Expand Down
9 changes: 5 additions & 4 deletions src/ESP32_PWM_ISR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -34,6 +34,7 @@
1.2.2 K Hoang 01/02/2022 Use float for DutyCycle and Freq, uint32_t for period. Optimize code
1.3.0 K Hoang 12/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Fix `DutyCycle` and `New Period` display bugs. Display warning only when debug level > 3
1.3.2 K Hoang 09/05/2022 Remove crashing PIN_D24 from examples
*****************************************************************************************************************************/

#pragma once
Expand All @@ -54,13 +55,13 @@
#endif

#ifndef ESP32_PWM_VERSION
#define ESP32_PWM_VERSION "ESP32_PWM v1.3.1"
#define ESP32_PWM_VERSION "ESP32_PWM v1.3.2"

#define ESP32_PWM_VERSION_MAJOR 1
#define ESP32_PWM_VERSION_MINOR 3
#define ESP32_PWM_VERSION_PATCH 1
#define ESP32_PWM_VERSION_PATCH 2

#define ESP32_PWM_VERSION_INT 1003001
#define ESP32_PWM_VERSION_INT 1003002
#endif

#ifndef _PWM_LOGLEVEL_
Expand Down
3 changes: 2 additions & 1 deletion src/ESP32_PWM_ISR_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -34,6 +34,7 @@
1.2.2 K Hoang 01/02/2022 Use float for DutyCycle and Freq, uint32_t for period. Optimize code
1.3.0 K Hoang 12/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Fix `DutyCycle` and `New Period` display bugs. Display warning only when debug level > 3
1.3.2 K Hoang 09/05/2022 Remove crashing PIN_D24 from examples
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/PWM_Generic_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.3.1
Version: 1.3.2
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -34,6 +34,7 @@
1.2.2 K Hoang 01/02/2022 Use float for DutyCycle and Freq, uint32_t for period. Optimize code
1.3.0 K Hoang 12/02/2022 Add support to new ESP32-S3
1.3.1 K Hoang 04/03/2022 Fix `DutyCycle` and `New Period` display bugs. Display warning only when debug level > 3
1.3.2 K Hoang 09/05/2022 Remove crashing PIN_D24 from examples
*****************************************************************************************************************************/

#pragma once
Expand Down

0 comments on commit bf025f2

Please sign in to comment.