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

Commit 2e2e426

Browse files
authored
v1.3.0 to not use NRF_TIMER_1
### Releases v1.3.0 1. Don't use NRF_TIMER_1 because of [ArduinoCore-mbed mbed_nano core v2.0.0+](https://github.com/arduino/ArduinoCore-mbed) 2. Force to use NRF_TIMER_3 if select NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2 3. Check [Nano 33 BLE will not run library examples using NRF_TIMER_1 #6](#6)
1 parent b1d9dd7 commit 2e2e426

25 files changed

+284
-196
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1414

1515
Please ensure to specify the following:
1616

17-
* Arduino IDE version (e.g. 1.8.13) or Platform.io version
18-
* Arduino `mbed` Core Version (e.g. Arduino `mbed` core v1.3.0)
17+
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
18+
* Arduino `mbed` Core Version (e.g. Arduino `mbed` core v1.3.2 or Arduino `mbed_nano` core v2.4.1 )
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
2121
* Anything that might be relevant in your opinion, such as:
@@ -26,10 +26,10 @@ Please ensure to specify the following:
2626
### Example
2727

2828
```
29-
Arduino IDE version: 1.8.13
30-
Arduino mbed Core Version 1.3.0
29+
Arduino IDE version: 1.8.16
30+
Arduino mbed_nano` core v2.4.1
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
32+
Linux xy-Inspiron-3593 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 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.
@@ -40,6 +40,7 @@ Steps to reproduce:
4040
3. ...
4141
4. ...
4242
```
43+
4344
### Sending Feature Requests
4445

4546
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.

README.md

Lines changed: 41 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@
1414
* [Why do we need this NRF52_MBED_TimerInterrupt library](#why-do-we-need-this-nrf52_mbed_timerinterrupt-library)
1515
* [Features](#features)
1616
* [Why using ISR-based Hardware Timer Interrupt is better](#why-using-isr-based-hardware-timer-interrupt-is-better)
17+
* [Important notes about NRF_TIMER_1](#important-notes-about-nrf_timer_1)
1718
* [Currently supported Boards](#currently-supported-boards)
1819
* [Important Notes about ISR](#important-notes-about-isr)
19-
* [Changelog](#changelog)
20-
* [Releases v1.2.1](#releases-v121)
21-
* [Releases v1.2.0](#releases-v120)
22-
* [Releases v1.1.1](#releases-v111)
23-
* [Releases v1.0.2](#releases-v102)
24-
* [Releases v1.0.1](#releases-v101)
2520
* [Prerequisites](#prerequisites)
2621
* [Installation](#installation)
2722
* [Use Arduino Library Manager](#use-arduino-library-manager)
@@ -63,7 +58,6 @@
6358
* [5. Change_Interval on Arduino Nano_33_BLE](#5-change_interval-on-arduino-nano_33_ble)
6459
* [Debug](#debug)
6560
* [Troubleshooting](#troubleshooting)
66-
* [Releases](#releases)
6761
* [Issues](#issues)
6862
* [TO DO](#to-do)
6963
* [DONE](#done)
@@ -114,6 +108,21 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
114108

115109
[**HOWTO Attach Interrupt**](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/)
116110

111+
112+
### Important notes about NRF_TIMER_1
113+
114+
- Starting from core mbed_nano core v2.0.0+, NRF_TIMER_1 stops working.
115+
116+
```
117+
// For core mbed core 1.3.2-
118+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
119+
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
120+
121+
// For core mbed core 2.0.0-
122+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
123+
// If you select the already-used NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_3
124+
```
125+
117126
---
118127

119128
### Currently supported Boards
@@ -145,45 +154,16 @@ mbed_portenta: Portenta H7
145154
The mbed architecture should be retained for backwards support, but the new mbed_nano should also be added to avoid spurious incompatibility warnings and the library's examples being shown under the File > Examples > INCOMPATIBLE menu of the Arduino IDE when the Nano 33 BLE board is selected.
146155
```
147156

148-
---
149-
---
150-
151-
## Changelog
152-
153-
### Releases v1.2.1
154-
155-
1. Add **mbed_nano** to list of compatible architectures. For more info, Check [Add mbed_nano to list of compatible architectures #3](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/pull/3).
156-
157-
158-
### Releases v1.2.0
159-
160-
1. Add better debug feature.
161-
2. Optimize code and examples to reduce RAM usage
162-
3. Add Table of Contents
163-
164-
### Releases v1.1.1
165-
166-
1. Add example [**Change_Interval**](examples/Change_Interval)
167-
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
168-
169-
### Releases v1.0.2
170-
171-
1. Add example [**ISR_16_Timers_Array_Complex**](examples/ISR_16_Timers_Array_Complex) and optimize example [**ISR_16_Timers_Array**](examples/ISR_16_Timers_Array)
172-
173-
### Releases v1.0.1
174-
175-
1. Initial coding for Nano-33-BLE and sync with [**NRF52_TimerInterrupt Library**](https://github.com/khoih-prog/NRF52_TimerInterrupt)
176-
177-
178157
---
179158
---
180159

181160
## Prerequisites
182161

183-
1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
184-
2. [`Arduino mbed core v1.3.2+`](https://github.com/arduino/ArduinoCore-mbed) for NRF52-based board using mbed-RTOS such as Nano-33-BLE. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest)
185-
3. To use with certain examples
186-
- [`SimpleTimer library`](https://github.com/schinken/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
162+
1. [`Arduino IDE 1.8.16+` for Arduino](https://www.arduino.cc/en/Main/Software)
163+
2. [`Arduino mbed core v1.3.2-`](https://github.com/arduino/ArduinoCore-mbed) for NRF52-based board using mbed-RTOS such as Nano-33-BLE if you'd like to use `NRF_TIMER_1`. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/release s/latest)
164+
3. [`Arduino mbed_nano core 2.4.1+`](https://github.com/arduino/ArduinoCore-mbed) for NRF52-based board using mbed-RTOS such as Nano-33-BLE if you don't use `NRF_TIMER_1`. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest)
165+
4. To use with certain examples
166+
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
187167

188168
---
189169
---
@@ -329,9 +309,14 @@ Before using any Timer, you have to make sure the Timer has not been used by any
329309
#### 1.1 Init Hardware Timer
330310

331311
```
312+
// For core mbed core 1.3.2-
332313
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
333314
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
334315
316+
// For core mbed core 2.0.0-
317+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
318+
// If you select the already-used NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_3
319+
335320
// Init NRF52 timer NRF_TIMER3
336321
NRF52_MBED_Timer ITimer(NRF_TIMER_3);
337322
```
@@ -421,9 +406,14 @@ The 16 ISR_based Timers, designed for long timer intervals, only support using *
421406
### 2.2 Init Hardware Timer and ISR-based Timer
422407

423408
```
409+
// For core mbed core 1.3.2-
424410
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
425411
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
426412
413+
// For core mbed core 2.0.0-
414+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
415+
// If you select the already-used NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_3
416+
427417
// Init NRF52 timer NRF_TIMER3
428418
NRF52_MBED_Timer ITimer(NRF_TIMER_3);
429419
@@ -545,9 +535,14 @@ void setup()
545535
546536
volatile uint32_t startMillis = 0;
547537
538+
// For core mbed core 1.3.2-
548539
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
549540
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
550541
542+
// For core mbed core 2.0.0-
543+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
544+
// If you select the already-used NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_3
545+
551546
// Init NRF52 timer NRF_TIMER3
552547
NRF52_MBED_Timer ITimer(NRF_TIMER_3);
553548
@@ -852,7 +847,7 @@ While software timer, **programmed for 2s, is activated after more than 3.000s i
852847

853848
```
854849
Starting ISR_16_Timers_Array_Complex on Nano 33 BLE
855-
NRF52_MBED_TimerInterrupt v1.2.1
850+
NRF52_MBED_TimerInterrupt v1.3.0
856851
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
857852
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 10000
858853
Starting ITimer OK, millis() = 714
@@ -1326,7 +1321,7 @@ The following is the sample terminal output when running example [**TimerInterru
13261321

13271322
```
13281323
Starting TimerInterruptTest on Nano 33 BLE
1329-
NRF52_MBED_TimerInterrupt v1.2.1
1324+
NRF52_MBED_TimerInterrupt v1.3.0
13301325
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
13311326
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 1000000
13321327
Starting ITimer0 OK, millis() = 5660
@@ -1359,7 +1354,7 @@ The following is the sample terminal output when running example [**Argument_Non
13591354

13601355
```
13611356
Starting Argument_None on Nano 33 BLE
1362-
NRF52_MBED_TimerInterrupt v1.2.1
1357+
NRF52_MBED_TimerInterrupt v1.3.0
13631358
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER1
13641359
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 500000
13651360
Starting ITimer0 OK, millis() = 1519
@@ -1387,7 +1382,7 @@ The following is the sample terminal output when running example [FakeAnalogWrit
13871382

13881383
```
13891384
Starting FakeAnalogWrite on Nano 33 BLE
1390-
NRF52_MBED_TimerInterrupt v1.2.1
1385+
NRF52_MBED_TimerInterrupt v1.3.0
13911386
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
13921387
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 100
13931388
Starting ITimer OK, millis() = 1811
@@ -1492,7 +1487,7 @@ The following is the sample terminal output when running example [Change_Interva
14921487

14931488
```
14941489
Starting Change_Interval on Nano 33 BLE
1495-
NRF52_MBED_TimerInterrupt v1.2.1
1490+
NRF52_MBED_TimerInterrupt v1.3.0
14961491
Starting ITimer0 OK, millis() = 801
14971492
Starting ITimer1 OK, millis() = 805
14981493
Time = 10001, Timer0Count = 18, , Timer1Count = 4
@@ -1548,33 +1543,6 @@ Sometimes, the library will only work if you update the board core to the latest
15481543
---
15491544
---
15501545

1551-
## Releases
1552-
1553-
### Releases v1.2.1
1554-
1555-
1. Add **mbed_nano** to list of compatible architectures. For more info, Check PR [Add mbed_nano to list of compatible architectures #3](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/pull/3).
1556-
1557-
### Releases v1.2.0
1558-
1559-
1. Add better debug feature.
1560-
2. Optimize code and examples to reduce RAM usage
1561-
3. Add Table of Contents
1562-
1563-
### Releases v1.1.1
1564-
1565-
1. Add example [**Change_Interval**](examples/Change_Interval)
1566-
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
1567-
1568-
### Releases v1.0.2
1569-
1570-
1. Add example [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex) and optimize example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array)
1571-
1572-
### Releases v1.0.1
1573-
1574-
1. Initial coding for Nano-33-BLE and sync with [**NRF52_TimerInterrupt Library**](https://github.com/khoih-prog/NRF52_TimerInterrupt)
1575-
1576-
---
1577-
15781546
#### Supported Boards
15791547

15801548
- **Arduino Nano-33-BLE**

changelog.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# NRF52_MBED_TimerInterrupt Library
2+
3+
[![arduino-library-badge](https://www.ardu-badge.com/badge/NRF52_MBED_TimerInterrupt.svg?)](https://www.ardu-badge.com/NRF52_MBED_TimerInterrupt)
4+
[![GitHub release](https://img.shields.io/github/release/khoih-prog/NRF52_MBED_TimerInterrupt.svg)](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/releases)
5+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/blob/main/LICENSE)
6+
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
7+
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/NRF52_MBED_TimerInterrupt.svg)](http://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/issues)
8+
9+
---
10+
---
11+
12+
## Table of Contents
13+
14+
* [Changelog](#changelog)
15+
* [Releases v1.3.0](#releases-v130)
16+
* [Releases v1.2.1](#releases-v121)
17+
* [Releases v1.2.0](#releases-v120)
18+
* [Releases v1.1.1](#releases-v111)
19+
* [Releases v1.0.2](#releases-v102)
20+
* [Releases v1.0.1](#releases-v101)
21+
22+
---
23+
---
24+
25+
## Changelog
26+
27+
### Releases v1.3.0
28+
29+
1. Don't use NRF_TIMER_1 because of [ArduinoCore-mbed mbed_nano core v2.0.0+](https://github.com/arduino/ArduinoCore-mbed)
30+
2. Force to use NRF_TIMER_3 if select NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2
31+
3. Check [Nano 33 BLE will not run library examples using NRF_TIMER_1 #6](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/issues/6)
32+
33+
34+
### Releases v1.2.1
35+
36+
1. Add **mbed_nano** to list of compatible architectures. For more info, Check [Add mbed_nano to list of compatible architectures #3](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/pull/3).
37+
38+
39+
### Releases v1.2.0
40+
41+
1. Add better debug feature.
42+
2. Optimize code and examples to reduce RAM usage
43+
3. Add Table of Contents
44+
45+
### Releases v1.1.1
46+
47+
1. Add example [**Change_Interval**](examples/Change_Interval)
48+
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
49+
50+
### Releases v1.0.2
51+
52+
1. Add example [**ISR_16_Timers_Array_Complex**](examples/ISR_16_Timers_Array_Complex) and optimize example [**ISR_16_Timers_Array**](examples/ISR_16_Timers_Array)
53+
54+
### Releases v1.0.1
55+
56+
1. Initial coding for Nano-33-BLE and sync with [**NRF52_TimerInterrupt Library**](https://github.com/khoih-prog/NRF52_TimerInterrupt)
57+
58+
59+

examples/Argument_None/Argument_None.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.2.1
22+
Version: 1.3.0
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2929
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
3030
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31+
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3132
*****************************************************************************************************************************/
3233

3334
/*
@@ -73,9 +74,14 @@
7374
volatile uint32_t Timer0Count = 0;
7475
volatile uint32_t Timer1Count = 0;
7576

77+
// For core mbed core 1.3.2-
7678
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
7779
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
7880

81+
// For core mbed core 2.0.0-
82+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
83+
// If you select the already-used NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_3
84+
7985
// Init NRF52 timer NRF_TIMER1
8086
NRF52_MBED_Timer ITimer0(NRF_TIMER_4);
8187

examples/Change_Interval/Change_Interval.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.2.1
22+
Version: 1.3.0
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2929
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
3030
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31+
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3132
*****************************************************************************************************************************/
3233

3334
/*
@@ -73,9 +74,14 @@
7374
volatile uint32_t Timer0Count = 0;
7475
volatile uint32_t Timer1Count = 0;
7576

77+
// For core mbed core 1.3.2-
7678
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
7779
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
7880

81+
// For core mbed core 2.0.0-
82+
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
83+
// If you select the already-used NRF_TIMER_0, NRF_TIMER_1 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_3
84+
7985
// Init NRF52 timer NRF_TIMER1
8086
NRF52_MBED_Timer ITimer0(NRF_TIMER_4);
8187

0 commit comments

Comments
 (0)