Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5a85ab8

Browse files
Merge pull request #2621 from arduino/nano-r4-pwm-update
[PXCT-1269] - Nano R4 Documentation Update (PWM Resolution)
2 parents dc31407 + 5627662 commit 5a85ab8

File tree

1 file changed

+18
-3
lines changed
  • content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual

1 file changed

+18
-3
lines changed

‎content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,8 @@ You can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see th
733733

734734
The Nano R4 board features multiple pins with PWM capability that can be used to generate analog-like output signals. PWM works by rapidly switching a digital output between `HIGH` and `LOW` states, where the ratio of `HIGH` time to the total period determines the effective analog voltage output.
735735

736+
***__PWM Compatibility Note__: The Nano R4 shares identical PWM capabilities with the UNO R4 Minima, as both boards use the same RA4M1 microcontroller. This includes the same default 8-bit resolution, maximum 16-bit resolution, and PWM frequency control features. Code written for PWM on the UNO R4 Minima will work identically on the Nano R4.***
737+
736738
The Nano R4 board provides PWM functionality on the following pins:
737739

738740
| **Arduino Pin** | **Microcontroller Pin** | **PWM Channel** | **Primary Function** |
@@ -744,21 +746,35 @@ The Nano R4 board provides PWM functionality on the following pins:
744746
| `D10` | `P103` | Channel 2A | Digital I/O, SPI CS |
745747
| `D11` | `P101` | Channel 5A | Digital I/O, SPI MOSI |
746748

747-
***__Important note:__ Pins `A4` and `A5` also have PWM capability but are primarily used for I2C communication (SDA and SCL respectively). The onboard LEDs (`LEDR`, `LEDG`, `LEDB`, `LED_BUILTIN`) also support PWM for brightness control.***
749+
***__Important notes__: Pins `D3` and `D9` share the same PWM channel (`Channel 0B`) and cannot be used for PWM simultaneously. When using PWM on one of these pins, the other cannot output an independent PWM signal. Similarly, pins `D6`, `D3`, and `D9` all use timer `GPT0`, which means they will share the same PWM frequency setting. The onboard LEDs (`LEDR`, `LEDG`, `LEDB`, `LED_BUILTIN`) also support PWM for brightness control.***
750+
751+
The Nano R4's PWM offers the following technical specifications:
748752

753+
| **Specification** | **Value** | **Notes** |
754+
|:------------------:|:----------------:|:------------------------------:|
755+
| Default Resolution | 8-bit (0-255) | Standard Arduino compatibility |
756+
| Maximum Resolution | 16-bit (0-65535) | Full precision control |
749757

750758
You can use PWM pins as analog output pins with the `analogWrite()` function:
751759

752760
```arduino
753761
analogWrite(pin, value);
754762
```
755763

756-
By default, the resolution is 8-bit (0 to 255). You can use analogWriteResolution()to change this, supporting up to 12-bit (0 to 4095) resolution:
764+
**By default, the resolution is 8-bit (0 to 255)**. You can use the `analogWriteResolution()` resolution to change this, supporting up to 16-bit (0 to 65535) resolution:
757765

758766
```arduino
759767
analogWriteResolution(resolution);
760768
```
761769

770+
The Nano R4 supports the following PWM resolution options that you can configure based on your project's precision requirements:
771+
772+
- `analogWriteResolution(8)`: 8-bit resolution (0 to 255, **default resolution**)
773+
- `analogWriteResolution(10)`: 10-bit resolution (0 to 1023)
774+
- `analogWriteResolution(12)`: 12-bit resolution (0 to 4095)
775+
- `analogWriteResolution(14)`: 14-bit resolution (0 to 16383)
776+
- `analogWriteResolution(16)`: 16-bit resolution (0 to 65535, **maximum resolution**)
777+
762778
***The following PWM examples use the built-in orange user LED (`LED_BUILTIN`) of the Nano R4 board, which supports PWM for brightness control. This eliminates the need for external components and allows you to test PWM functionality immediately.***
763779

764780
The following example demonstrates how to control the brightness of the built-in orange user LED using PWM:
@@ -873,7 +889,6 @@ void loop() {
873889
This high-resolution example creates a smooth sine wave pattern with the built-in LED brightness, demonstrating the precision available with a 12-bit PWM resolution. You should see a very smooth transition in the LED brightness following a sine wave pattern. Additionally, you can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see the angle and PWM value outputs that demonstrate the precise 12-bit control values being used.
874890

875891
![Arduino IDE Serial Monitor output for the high-resolution PWM example sketch](assets/pwm-3.png)
876-
877892
### Operational Amplifier (OPAMP)
878893

879894
The Nano R4 board features a built-in operational amplifier (OPAMP) that provides signal conditioning and amplification capabilities directly on the board. The OPAMP is connected to analog pins `A1`, `A2` and `A3`, allowing you to perform analog signal processing without requiring external amplifier circuits. This feature is particularly useful for sensor signal amplification, buffering and analog filtering applications.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /