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

Commit 64761c8

Browse files
authored
v1.3.0
### Release v1.3.0 1. Fix TCB Clock bug. Don't use v1.2.0
1 parent dfdae9b commit 64761c8

35 files changed

+184
-129
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Please ensure to specify the following:
2929
Arduino IDE version: 1.8.13
3030
Arduino megaAVR Core Version 1.8.7
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
32+
Linux xy-Inspiron-3593 5.4.0-71-generic #79-Ubuntu SMP Wed Mar 24 10:56:57 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
3333
3434
Context:
3535
I encountered a crash while trying to use the Timer Interrupt.

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [Important Notes about ISR](#important-notes-about-isr)
1515
* [Currently supported Boards](#currently-supported-boards)
1616
* [Changelog](#changelog)
17+
* [Release v1.3.0](#release-v130)
1718
* [Release v1.2.0](#release-v120)
1819
* [Release v1.1.0](#release-v110)
1920
* [Initial Release v1.0.0](#initial-release-v100)
@@ -129,6 +130,11 @@ The catch is your function is now part of an ISR (Interrupt Service Routine), an
129130

130131
## Changelog
131132

133+
### Release v1.3.0
134+
135+
1. Fix TCB Clock bug. Don't use v1.2.0
136+
137+
132138
### Release v1.2.0
133139

134140
1. Selectable **TCB Clock 16MHz, 8MHz or 250KHz** depending on necessary accuracy
@@ -793,7 +799,7 @@ While software timer, **programmed for 2s, is activated after more than 10.000s
793799
```
794800

795801
Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
796-
megaAVR_TimerInterrupt v1.2.0
802+
megaAVR_TimerInterrupt v1.3.0
797803
CPU Frequency = 16 MHz
798804
TCB Clock Frequency = 250KHz for lower accuracy but longer time
799805
Starting ITimer1 OK, millis() = 6
@@ -945,7 +951,7 @@ The following is the sample terminal output when running example [Change_Interva
945951
946952
```
947953
Starting Change_Interval on megaAVR Nano Every
948-
megaAVR_TimerInterrupt v1.2.0
954+
megaAVR_TimerInterrupt v1.3.0
949955
CPU Frequency = 16 MHz
950956
TCB Clock Frequency = 250KHz for lower accuracy but longer time
951957
Starting ITimer1 OK, millis() = 1
@@ -974,7 +980,7 @@ Changing Interval, Timer1 = 100, Timer2 = 200
974980
975981
```
976982
Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
977-
megaAVR_TimerInterrupt v1.2.0
983+
megaAVR_TimerInterrupt v1.3.0
978984
CPU Frequency = 16 MHz
979985
TCB Clock Frequency = 16MHz for highest accuracy
980986
Starting ITimer1 OK, millis() = 6
@@ -1060,7 +1066,7 @@ Timer : 15, programmed : 80000, actual : 80000
10601066
```
10611067

10621068
Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
1063-
megaAVR_TimerInterrupt v1.2.0
1069+
megaAVR_TimerInterrupt v1.3.0
10641070
CPU Frequency = 16 MHz
10651071
TCB Clock Frequency = 8MHz for very high accuracy
10661072
Starting ITimer1 OK, millis() = 10
@@ -1128,7 +1134,7 @@ Timer : 15, programmed : 80000, actual : 80000
11281134
11291135
```
11301136
Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
1131-
megaAVR_TimerInterrupt v1.2.0
1137+
megaAVR_TimerInterrupt v1.3.0
11321138
CPU Frequency = 16 MHz
11331139
TCB Clock Frequency = 250KHz for lower accuracy but longer time
11341140
Starting ITimer1 OK, millis() = 11
@@ -1240,6 +1246,10 @@ Sometimes, the library will only work if you update the board core to the latest
12401246

12411247
## Releases
12421248

1249+
### Release v1.3.0
1250+
1251+
1. Fix TCB Clock bug. Don't use v1.2.0
1252+
12431253
### Release v1.2.0
12441254

12451255
1. Selectable **TCB Clock 16MHz, 8MHz or 250KHz** depending on necessary accuracy

examples/Argument_Complex/Argument_Complex.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324

2425
// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"

examples/Argument_None/Argument_None.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324

2425
// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"

examples/Argument_Simple/Argument_Simple.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324

2425
// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"

examples/Change_Interval/Change_Interval.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324

2425
/*
@@ -64,10 +65,10 @@
6465

6566

6667
#define TIMER1_INTERVAL_MS 1000UL
67-
#define TIMER2_INTERVAL_MS 2000UL
68+
#define TIMER2_INTERVAL_MS 500UL
6869

69-
volatile uint32_t Timer1Count = 0;
70-
volatile uint32_t Timer2Count = 0;
70+
volatile uint32_t Timer1Count = 1;
71+
volatile uint32_t Timer2Count = 1;
7172

7273
void printResult(uint32_t currTime)
7374
{
@@ -186,11 +187,15 @@ void loop()
186187

187188
ITimer1.setInterval(TIMER1_INTERVAL_MS * (multFactor + 1), TimerHandler1);
188189

190+
Timer1Count++;
191+
189192
Serial.print(F("Changing Interval, Timer1 = ")); Serial.println(TIMER1_INTERVAL_MS * (multFactor + 1));
190193

191194
#if USE_TIMER_2
192195
ITimer2.setInterval(TIMER2_INTERVAL_MS * (multFactor + 1), TimerHandler2);
193196

197+
Timer2Count++;
198+
194199
Serial.print(F("Changing Interval, Timer2 = ")); Serial.println(TIMER2_INTERVAL_MS * (multFactor + 1));
195200
#endif
196201

examples/FakeAnalogWrite/FakeAnalogWrite.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324
/*
2425
Notes:

examples/ISR_16_Timers_Array_Complex/ISR_16_Timers_Array_Complex.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,29 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324

2425
// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
2526
// _TIMERINTERRUPT_LOGLEVEL_ from 0 to 4
2627
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
2728
#define TIMER_INTERRUPT_DEBUG 0
28-
#define _TIMERINTERRUPT_LOGLEVEL_ 0
29+
#define _TIMERINTERRUPT_LOGLEVEL_ 3
2930

3031
// Select USING_16MHZ == true for 16MHz to Timer TCBx => shorter timer, but better accuracy
3132
// Select USING_8MHZ == true for 8MHz to Timer TCBx => shorter timer, but better accuracy
3233
// Select USING_250KHZ == true for 250KHz to Timer TCBx => shorter timer, but better accuracy
3334
// Not select for default 250KHz to Timer TCBx => longer timer, but worse accuracy
34-
#define USING_16MHZ true
35+
#define USING_16MHZ false
3536
#define USING_8MHZ false
36-
#define USING_250KHZ false
37+
#define USING_250KHZ true
3738

3839

3940
#define USE_TIMER_0 false

examples/ISR_RPM_Measure/ISR_RPM_Measure.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324
/* RPM Measuring uses high frequency hardware timer 1Hz == 1ms) to measure the time from of one rotation, in ms
2425
then convert to RPM. One rotation is detected by reading the state of a magnetic REED SW or IR LED Sensor

examples/ISR_Switch/ISR_Switch.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.2.0
15+
Version: 1.3.0
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
2020
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
2121
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
22+
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
2223
*****************************************************************************************************************************/
2324
/****************************************************************************************************************************
2425
ISR_Switch demontrates the use of ISR to avoid being blocked by other CPU-monopolizing task

0 commit comments

Comments
 (0)