You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -880,7 +888,7 @@ The Nano R4's OPAMP offers the following electrical characteristics:
880
888
| Load Current | -100 to +100 | -100 to +100 | μA | Maximum |
881
889
| Load Capacitance | 20 | 20 | pF | Maximum |
882
890
883
-
You can configure and use the OPAMP using the dedicated `<OPAMP.h>` library, which is included in the Arduino UNO R4 Boards core. To startup the OPAMP, simply include the library and call `OPAMP.begin(speed)` where speed can be `OPAMP_SPEED_LOWSPEED` for lower power consumption or `OPAMP_SPEED_HIGHSPEED` for better performance.
891
+
You can configure and use the OPAMP using the dedicated `OPAMP.h` library, which is included in the Arduino UNO R4 Boards core. To startup the OPAMP, simply include the library and call `OPAMP.begin(speed)` where speed can be `OPAMP_SPEED_LOWSPEED` for lower power consumption or `OPAMP_SPEED_HIGHSPEED` for better performance.
884
892
885
893
The following example demonstrates how to initialize and use the OPAMP. The same code works for both voltage follower and amplifier configurations, **the difference is only in the external connections**:
886
894
@@ -898,8 +906,9 @@ Works for both voltage follower and amplifier configurations.
898
906
#include <OPAMP.h>
899
907
900
908
void setup() {
901
-
// Initialize serial communication at 115200 baud
909
+
// Initialize serial communication and wait up to 2.5 seconds for a connection
// Set DAC resolution to 12-bit for smooth waveform
1062
1073
analogWriteResolution(12);
@@ -1115,7 +1126,7 @@ The Nano R4's RTC offers the following technical specifications:
1115
1126
| Current Consumption |~1 μA | In backup mode |
1116
1127
| Temperature Range | -40°C to +85°C | Operating range |
1117
1128
1118
-
You can configure and use the RTC using the dedicated `<RTC.h>` library, which is included in the Arduino UNO R4 Boards core. The library provides functions to set time, get time, check RTC status and configure alarms.
1129
+
You can configure and use the RTC using the dedicated `RTC.h` library, which is included in the Arduino UNO R4 Boards core. The library provides functions to set time, get time, check RTC status and configure alarms.
1119
1130
1120
1131
The following example demonstrates how to initialize the RTC and display the current date and time:
1121
1132
@@ -1133,8 +1144,9 @@ to keep track of date and time.
1133
1144
#include "RTC.h"
1134
1145
1135
1146
void setup() {
1136
-
// Initialize serial communication at 115200 baud
1147
+
// Initialize serial communication and wait up to 2.5 seconds for a connection
Serial.println("- Arduino Nano R4 - RTC Basic Example started...");
1140
1152
Serial.println("- Initializing RTC...");
@@ -1258,7 +1270,7 @@ The Nano R4's EEPROM offers the following technical specifications:
1258
1270
| Retention Time | 10+ years | Data retention period |
1259
1271
| Operating Voltage | +5 VDC | Same as board |
1260
1272
1261
-
You can read and write to EEPROM using the dedicated `<EEPROM.h>` library, which is included in the Arduino UNO R4 Boards core. The library provides simple functions to store and retrieve individual bytes or larger data structures.
1273
+
You can read and write to EEPROM using the dedicated `EEPROM.h` library, which is included in the Arduino UNO R4 Boards core. The library provides simple functions to store and retrieve individual bytes or larger data structures.
1262
1274
1263
1275
The following example demonstrates how to store and retrieve data from EEPROM:
1264
1276
@@ -1276,8 +1288,9 @@ from the built-in EEPROM memory.
1276
1288
#include <EEPROM.h>
1277
1289
1278
1290
void setup() {
1279
-
// Initialize serial communication at 115200 baud
1291
+
// Initialize serial communication and wait up to 2.5 seconds for a connection
Serial.println("- Arduino Nano R4 - EEPROM Basic Example started...");
1283
1296
@@ -1328,7 +1341,7 @@ You can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see th
1328
1341
1329
1342

1330
1343
1331
-
For storing larger data structures, you can use the `EEPROM.get()` and `EEPROM.put()` functions:
1344
+
You can also store complex data structures using the `EEPROM.put()` and `EEPROM.get()` functions:
1332
1345
1333
1346
```arduino
1334
1347
// Define a structure for complex data
@@ -1354,6 +1367,170 @@ When working with EEPROM on the Nano R4, there are several key points to keep in
1354
1367
- Keep in mind that EEPROM stores data as individual bytes (0 to 255), so larger data types need to be broken down or use the `put()` and `get()` functions for automatic handling.
1355
1368
- The EEPROM retains data for over 10 years under normal conditions, making it excellent for long-term storage of configuration data and user preferences.
1356
1369
1370
+
## SPI Communication
1371
+
1372
+
The Nano R4 board features built-in SPI (Serial Peripheral Interface) communication that allows your projects to communicate with external devices like sensors, displays, memory cards and other microcontrollers. SPI is implemented within the RA4M1 microcontroller and uses four dedicated pins to provide high-speed synchronous serial communication.
1373
+
1374
+
SPI is particularly useful when your project needs to communicate with external components at high speeds, rather than using slower protocols. While I²C is perfect for simple sensor communication and UART for basic serial data exchange, SPI excels at high-speed communication with devices like SD cards, TFT displays, wireless modules or external memory chips. SPI can achieve much faster data rates than I²C and can handle multiple devices on the same bus through individual chip select lines.
1375
+
1376
+
The Nano R4's SPI interface offers the following technical specifications:
You can communicate via SPI using the dedicated `SPI.h` library, which is included in the Arduino UNO R4 Boards core. The library provides simple functions to initialize the bus, send and receive data and manage multiple devices.
1398
+
1399
+
The following example demonstrates how to use SPI communication to control an external device:
1400
+
1401
+
```arduino
1402
+
/**
1403
+
SPI Basic Example for the Arduino Nano R4 Board
1404
+
Name: nano_r4_spi_basic.ino
1405
+
Purpose: This sketch demonstrates how to use SPI communication
1406
+
to send and receive data.
1407
+
1408
+
@author Arduino Product Experience Team
1409
+
@version 1.0 01/06/25
1410
+
*/
1411
+
1412
+
#include <SPI.h>
1413
+
1414
+
// Chip Select pin for SPI device
1415
+
const int CS_PIN = 10;
1416
+
1417
+
void setup() {
1418
+
// Initialize serial communication and wait up to 2.5 seconds for a connection
Serial.println("- Test data transmission complete");
1497
+
}
1498
+
```
1499
+
1500
+
***To test this example, no external SPI device is required. The code will demonstrate SPI communication patterns, though without a connected device, the received data will typically be `0xFF`.***
1501
+
1502
+
You can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see the SPI communication in action. The example shows how to properly select devices, send data and handle responses.
1503
+
1504
+
For connecting multiple SPI devices, you can use different digital pins as additional Chip Select (`CS`) lines while sharing the `MOSI`, `MISO` and `SCK` pins:
1505
+
1506
+
```arduino
1507
+
// Multiple device example
1508
+
const int DEVICE1_CS = 10; // First SPI device
1509
+
const int DEVICE2_CS = 9; // Second SPI device
1510
+
const int DEVICE3_CS = 8; // Third SPI device
1511
+
1512
+
void setup() {
1513
+
SPI.begin();
1514
+
1515
+
// Configure all CS pins
1516
+
pinMode(DEVICE1_CS, OUTPUT);
1517
+
pinMode(DEVICE2_CS, OUTPUT);
1518
+
pinMode(DEVICE3_CS, OUTPUT);
1519
+
1520
+
// Set all CS pins HIGH (inactive)
1521
+
digitalWrite(DEVICE1_CS, HIGH);
1522
+
digitalWrite(DEVICE2_CS, HIGH);
1523
+
digitalWrite(DEVICE3_CS, HIGH);
1524
+
}
1525
+
```
1526
+
1527
+
When working with SPI on the Nano R4, there are several key points to keep in mind for successful implementation:
1528
+
1529
+
- The SPI protocol requires careful attention to timing and device selection. Always ensure that only one device is selected (`CS LOW`) at a time, and remember to deselect devices (`CS HIGH`) after communication to avoid conflicts.
1530
+
- Different SPI devices may require different clock speeds and modes, so check your device's datasheet for the correct `SPISettings()` parameters.
1531
+
- Keep in mind that SPI is a synchronous protocol, meaning that data is transferred in both directions simultaneously with each clock pulse. Even if you only need to send data, you'll still receive data back, and vice versa.
1532
+
- The Nano R4 board can communicate with multiple SPI devices by using different Chip Select (`CS`) pins, making it perfect for complex projects that need to interface with various sensors, displays and storage devices.
1533
+
1357
1534
## Support
1358
1535
1359
1536
If you encounter any issues or have questions while working with your Nano R4 board, we provide various support resources to help you find answers and solutions.
0 commit comments