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

Commit

Permalink
v1.3.0 to not use NRF_TIMER_1
Browse files Browse the repository at this point in the history
### 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)
  • Loading branch information
khoih-prog committed Sep 10, 2021
1 parent b1d9dd7 commit 2e2e426
Show file tree
Hide file tree
Showing 25 changed files with 284 additions and 196 deletions.
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ 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.13) or Platform.io version
* Arduino `mbed` Core Version (e.g. Arduino `mbed` core v1.3.0)
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
* Arduino `mbed` Core Version (e.g. Arduino `mbed` core v1.3.2 or Arduino `mbed_nano` core v2.4.1 )
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -26,10 +26,10 @@ Please ensure to specify the following:
### Example

```
Arduino IDE version: 1.8.13
Arduino mbed Core Version 1.3.0
Arduino IDE version: 1.8.16
Arduino mbed_nano` core v2.4.1
OS: Ubuntu 20.04 LTS
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
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
Context:
I encountered a crash while trying to use the Timer Interrupt.
Expand All @@ -40,6 +40,7 @@ Steps to reproduce:
3. ...
4. ...
```

### Sending Feature Requests

Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
Expand Down
114 changes: 41 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
* [Why do we need this NRF52_MBED_TimerInterrupt library](#why-do-we-need-this-nrf52_mbed_timerinterrupt-library)
* [Features](#features)
* [Why using ISR-based Hardware Timer Interrupt is better](#why-using-isr-based-hardware-timer-interrupt-is-better)
* [Important notes about NRF_TIMER_1](#important-notes-about-nrf_timer_1)
* [Currently supported Boards](#currently-supported-boards)
* [Important Notes about ISR](#important-notes-about-isr)
* [Changelog](#changelog)
* [Releases v1.2.1](#releases-v121)
* [Releases v1.2.0](#releases-v120)
* [Releases v1.1.1](#releases-v111)
* [Releases v1.0.2](#releases-v102)
* [Releases v1.0.1](#releases-v101)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Use Arduino Library Manager](#use-arduino-library-manager)
Expand Down Expand Up @@ -63,7 +58,6 @@
* [5. Change_Interval on Arduino Nano_33_BLE](#5-change_interval-on-arduino-nano_33_ble)
* [Debug](#debug)
* [Troubleshooting](#troubleshooting)
* [Releases](#releases)
* [Issues](#issues)
* [TO DO](#to-do)
* [DONE](#done)
Expand Down Expand Up @@ -114,6 +108,21 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),

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


### Important notes about NRF_TIMER_1

- Starting from core mbed_nano core v2.0.0+, NRF_TIMER_1 stops working.

```
// For core mbed core 1.3.2-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
// For core mbed core 2.0.0-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
// 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
```

---

### Currently supported Boards
Expand Down Expand Up @@ -145,45 +154,16 @@ mbed_portenta: Portenta H7
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.
```

---
---

## Changelog

### Releases v1.2.1

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).


### Releases v1.2.0

1. Add better debug feature.
2. Optimize code and examples to reduce RAM usage
3. Add Table of Contents

### Releases v1.1.1

1. Add example [**Change_Interval**](examples/Change_Interval)
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.

### Releases v1.0.2

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)

### Releases v1.0.1

1. Initial coding for Nano-33-BLE and sync with [**NRF52_TimerInterrupt Library**](https://github.com/khoih-prog/NRF52_TimerInterrupt)


---
---

## Prerequisites

1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
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)
3. To use with certain examples
- [`SimpleTimer library`](https://github.com/schinken/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
1. [`Arduino IDE 1.8.16+` for Arduino](https://www.arduino.cc/en/Main/Software)
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)
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)
4. To use with certain examples
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).

---
---
Expand Down Expand Up @@ -329,9 +309,14 @@ Before using any Timer, you have to make sure the Timer has not been used by any
#### 1.1 Init Hardware Timer

```
// For core mbed core 1.3.2-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
// For core mbed core 2.0.0-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
// 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
// Init NRF52 timer NRF_TIMER3
NRF52_MBED_Timer ITimer(NRF_TIMER_3);
```
Expand Down Expand Up @@ -421,9 +406,14 @@ The 16 ISR_based Timers, designed for long timer intervals, only support using *
### 2.2 Init Hardware Timer and ISR-based Timer

```
// For core mbed core 1.3.2-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
// For core mbed core 2.0.0-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
// 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
// Init NRF52 timer NRF_TIMER3
NRF52_MBED_Timer ITimer(NRF_TIMER_3);
Expand Down Expand Up @@ -545,9 +535,14 @@ void setup()
volatile uint32_t startMillis = 0;
// For core mbed core 1.3.2-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_1,NRF_TIMER_3,NRF_TIMER_4 (1,3 and 4)
// If you select the already-used NRF_TIMER_0 or NRF_TIMER_2, it'll be auto modified to use NRF_TIMER_1
// For core mbed core 2.0.0-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
// 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
// Init NRF52 timer NRF_TIMER3
NRF52_MBED_Timer ITimer(NRF_TIMER_3);
Expand Down Expand Up @@ -852,7 +847,7 @@ While software timer, **programmed for 2s, is activated after more than 3.000s i

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

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

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

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

```
Starting Change_Interval on Nano 33 BLE
NRF52_MBED_TimerInterrupt v1.2.1
NRF52_MBED_TimerInterrupt v1.3.0
Starting ITimer0 OK, millis() = 801
Starting ITimer1 OK, millis() = 805
Time = 10001, Timer0Count = 18, , Timer1Count = 4
Expand Down Expand Up @@ -1548,33 +1543,6 @@ Sometimes, the library will only work if you update the board core to the latest
---
---

## Releases

### Releases v1.2.1

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).

### Releases v1.2.0

1. Add better debug feature.
2. Optimize code and examples to reduce RAM usage
3. Add Table of Contents

### Releases v1.1.1

1. Add example [**Change_Interval**](examples/Change_Interval)
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.

### Releases v1.0.2

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)

### Releases v1.0.1

1. Initial coding for Nano-33-BLE and sync with [**NRF52_TimerInterrupt Library**](https://github.com/khoih-prog/NRF52_TimerInterrupt)

---

#### Supported Boards

- **Arduino Nano-33-BLE**
Expand Down
59 changes: 59 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# NRF52_MBED_TimerInterrupt Library

[![arduino-library-badge](https://www.ardu-badge.com/badge/NRF52_MBED_TimerInterrupt.svg?)](https://www.ardu-badge.com/NRF52_MBED_TimerInterrupt)
[![GitHub release](https://img.shields.io/github/release/khoih-prog/NRF52_MBED_TimerInterrupt.svg)](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/releases)
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/blob/main/LICENSE)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/NRF52_MBED_TimerInterrupt.svg)](http://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/issues)

---
---

## Table of Contents

* [Changelog](#changelog)
* [Releases v1.3.0](#releases-v130)
* [Releases v1.2.1](#releases-v121)
* [Releases v1.2.0](#releases-v120)
* [Releases v1.1.1](#releases-v111)
* [Releases v1.0.2](#releases-v102)
* [Releases v1.0.1](#releases-v101)

---
---

## Changelog

### 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](https://github.com/khoih-prog/NRF52_MBED_TimerInterrupt/issues/6)


### Releases v1.2.1

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).


### Releases v1.2.0

1. Add better debug feature.
2. Optimize code and examples to reduce RAM usage
3. Add Table of Contents

### Releases v1.1.1

1. Add example [**Change_Interval**](examples/Change_Interval)
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.

### Releases v1.0.2

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)

### Releases v1.0.1

1. Initial coding for Nano-33-BLE and sync with [**NRF52_TimerInterrupt Library**](https://github.com/khoih-prog/NRF52_TimerInterrupt)



8 changes: 7 additions & 1 deletion examples/Argument_None/Argument_None.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.2.1
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
*****************************************************************************************************************************/

/*
Expand Down Expand Up @@ -73,9 +74,14 @@
volatile uint32_t Timer0Count = 0;
volatile uint32_t Timer1Count = 0;

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

// For core mbed core 2.0.0-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
// 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

// Init NRF52 timer NRF_TIMER1
NRF52_MBED_Timer ITimer0(NRF_TIMER_4);

Expand Down
8 changes: 7 additions & 1 deletion examples/Change_Interval/Change_Interval.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.2.1
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
*****************************************************************************************************************************/

/*
Expand Down Expand Up @@ -73,9 +74,14 @@
volatile uint32_t Timer0Count = 0;
volatile uint32_t Timer1Count = 0;

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

// For core mbed core 2.0.0-
// Depending on the board, you can select NRF52 Hardware Timer from NRF_TIMER_3,NRF_TIMER_4 (3 and 4)
// 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

// Init NRF52 timer NRF_TIMER1
NRF52_MBED_Timer ITimer0(NRF_TIMER_4);

Expand Down
Loading

0 comments on commit 2e2e426

Please sign in to comment.