Skip to content

Commit e0a0552

Browse files
Update documentation
Adds examples for I2C, SD card, flash memory, and DA14531MOD
1 parent b2a84b9 commit e0a0552

File tree

7 files changed

+470
-0
lines changed

7 files changed

+470
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// --------------------------------------
2+
// i2c_scanner
3+
//
4+
// Modified from https://playground.arduino.cc/Main/I2cScanner/
5+
// --------------------------------------
6+
7+
#include <Wire.h>
8+
9+
// Set I2C bus to use: Wire, Wire1, etc.
10+
#define WIRE Wire
11+
12+
int toggle = 0;
13+
14+
void setup() {
15+
WIRE.begin();
16+
17+
pinMode(8, OUTPUT);
18+
19+
Serial.begin(115200);
20+
while (!Serial)
21+
delay(10);
22+
Serial.println("\nI2C Scanner");
23+
}
24+
25+
26+
void loop() {
27+
if (toggle == 0) {
28+
digitalWrite(8, HIGH);
29+
toggle = 1;
30+
} else {
31+
digitalWrite(8, LOW);
32+
toggle = 0;
33+
}
34+
35+
36+
byte error, address;
37+
int nDevices;
38+
39+
Serial.println("Scanning...");
40+
41+
nDevices = 0;
42+
for (address = 1; address < 127; address++) {
43+
// The i2c_scanner uses the return value of
44+
// the Write.endTransmisstion to see if
45+
// a device did acknowledge to the address.
46+
WIRE.beginTransmission(address);
47+
error = WIRE.endTransmission();
48+
49+
if (error == 0) {
50+
Serial.print("I2C device found at address 0x");
51+
if (address < 16)
52+
Serial.print("0");
53+
Serial.print(address, HEX);
54+
Serial.println(" !");
55+
56+
nDevices++;
57+
} else if (error == 4) {
58+
Serial.print("Unknown error at address 0x");
59+
if (address < 16)
60+
Serial.print("0");
61+
Serial.println(address, HEX);
62+
}
63+
}
64+
if (nDevices == 0)
65+
Serial.println("No I2C devices found\n");
66+
else
67+
Serial.println("done\n");
68+
69+
delay(700); // wait 5 seconds for next scan
70+
}

docs/example-I2C.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
---
2+
icon: simple/arduino
3+
---
4+
5+
## Device Scan
6+
This sketch allows users to scan for devices connected to the primary I^2^C bus of the RAM5 Thing Plus. The example code can be found in the [GitHub repository](https://github.com/sparkfun/SparkFun_Thing_Plus_RA6M5/tree/main/docs/assets/arduino_examples/i2c_scanner/i2c_scanner.ino). However, users can also simply click on the button *(below)*, to download the code; or expand the box *(below)*, to copy the code.
7+
8+
9+
??? code "`i2c_scanner.ino`"
10+
```cpp
11+
--8<-- "./assets/arduino_examples/i2c_scanner/i2c_scanner.ino"
12+
```
13+
14+
15+
<center>
16+
[:octicons-download-16:{ .heart } Download the Example Sketch](./assets/arduino_examples/i2c_scanner/i2c_scanner.ino){ .md-button .md-button--primary }
17+
</center>
18+
19+
20+
## Peripheral Devices
21+
The RA6M5 Thing Plus features a Qwiic connector to seamlessly integrate with devices from [SparkFun's Qwiic Ecosystem](https://www.sparkfun.com/qwiic). While users are free to utilize any I^2^C device, we recommend the [Qwiic devices](https://www.sparkfun.com/categories/399) from our catalog.
22+
23+
??? note "Optional Hardware"
24+
<div class="grid cards" markdown>
25+
26+
- <a href="https://www.sparkfun.com/products/15081">
27+
<figure markdown>
28+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/3/4/3/1/15081-_01.jpg)
29+
</figure>
30+
31+
---
32+
33+
**SparkFun Qwiic Cable Kit**<br>
34+
KIT-15081</a>
35+
36+
37+
- <a href="https://www.sparkfun.com/products/15109">
38+
<figure markdown>
39+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/3/4/7/5/15109-Qwiic_Cable_-_Grove_Adapter__150mm_-01.jpg)
40+
</figure>
41+
42+
---
43+
44+
**Qwiic Cable - Grove Adapter (100mm)**<br>
45+
PRT-15109</a>
46+
47+
48+
- <a href="https://www.sparkfun.com/products/23453">
49+
<figure markdown>
50+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/2/3/7/6/0/23453-Qwiic-OLED-Feature-WithDisplay.jpg)
51+
</figure>
52+
53+
---
54+
55+
**SparkFun Qwiic OLED - (1.3in., 128x64)**<br>
56+
LCD-23453</a>
57+
58+
59+
- <a href="https://www.sparkfun.com/products/14414">
60+
<figure markdown>
61+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/2/3/4/0/14414-SparkFun_GPS_Breakout_-_XA1110__Qwiic_-01.jpg)
62+
</figure>
63+
64+
---
65+
66+
**SparkFun GPS Breakout - XA1110 (Qwiic)**<br>
67+
GPS-14414</a>
68+
69+
70+
- <a href="https://www.sparkfun.com/products/15168">
71+
<figure markdown>
72+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/3/5/5/8/15168-SparkFun_Qwiic_Joystick-01.jpg)
73+
</figure>
74+
75+
---
76+
77+
**SparkFun Qwiic Joystick**<br>
78+
COM-15168</a>
79+
80+
81+
- <a href="https://www.sparkfun.com/products/16784">
82+
<figure markdown>
83+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/5/6/8/9/16784-SparkFun_Qwiic_Mux_Breakout_V2_-_8_Channel__TCA9548A_-01.jpg)
84+
</figure>
85+
86+
---
87+
88+
**SparkFun Qwiic Mux Breakout - 8 Channel (TCA9548A)**<br>
89+
BOB-16784</a>
90+
91+
92+
- <a href="https://www.sparkfun.com/products/19096">
93+
<figure markdown>
94+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/8/6/9/6/19096-SparkFun_Environmental_Sensor_Breakout_-_BME688__Qwiic_-01.jpg)
95+
</figure>
96+
97+
---
98+
99+
**SparkFun Environmental Sensor - BME688 (Qwiic)**<br>
100+
SEN-19096</a>
101+
102+
103+
- <a href="https://www.sparkfun.com/products/19013">
104+
<figure markdown>
105+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/8/6/1/2/19013-SparkFun_Qwiic_Mini_ToF_Imager_-_VL53L5CX-01.jpg)
106+
</figure>
107+
108+
---
109+
110+
**SparkFun Qwiic Mini ToF Imager - VL53L5CX**<br>
111+
SEN-19013</a>
112+
113+
</div>
114+
115+
116+
### MAX17048 Fuel Gauge
117+
The MAX17048 fuel gauge measures the approximate charge/discharge rate, state of charge, and voltage of a connected LiPo battery. We recommend the [SparkFun MAX1704x Arduino library](https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library) be utilized in the Arduino IDE, to connect to the MAX17048 on the RA6M5 Thing Plus. Once the [library is installed in the Arduino IDE](../software_overview-arduino/#max17048-fuel-gauge), users will find several example sketches listed in the **File** > **Examples** > **SparkFun MAX1704x Fuel Gauge Arduino Library** > drop-down menu. We recommend the following examples for users:
118+
119+
- `Example1_Simple.ino`
120+
- `Example4_MAX17048_KitchenSink.ino`
121+
122+
??? note "Optional Hardware"
123+
<div class="grid cards" markdown>
124+
125+
- <a href="https://www.sparkfun.com/products/13855">
126+
<figure markdown>
127+
![Product Thumbnail](https://cdn.sparkfun.com/r/140-140/assets/parts/1/1/4/6/2/13855-01.jpg)
128+
</figure>
129+
130+
---
131+
132+
**Lithium Ion Battery - 2Ah**<br>
133+
PRT-13855</a>
134+
135+
136+
- <a href="https://www.sparkfun.com/products/13851">
137+
<figure markdown>
138+
![Product Thumbnail](https://cdn.sparkfun.com/r/140-140/assets/parts/1/1/4/5/8/13857-01.jpg)
139+
</figure>
140+
141+
---
142+
143+
**Lithium Ion Battery - 400mAh**<br>
144+
PRT-13851</a>
145+
146+
147+
- <a href="https://www.sparkfun.com/products/13813">
148+
<figure markdown>
149+
![Product Thumbnail](https://cdn.sparkfun.com/r/140-140/assets/parts/1/1/4/0/1/13813-01.jpg)
150+
</figure>
151+
152+
---
153+
154+
**Lithium Ion Battery - 1Ah**<br>
155+
PRT-13813</a>
156+
157+
158+
- <a href="https://www.sparkfun.com/products/13853">
159+
<figure markdown>
160+
![Product Thumbnail](https://cdn.sparkfun.com/r/140-140/assets/parts/1/1/4/6/0/13853-01.jpg)
161+
</figure>
162+
163+
---
164+
165+
**Lithium Ion Battery - 110mAh**<br>
166+
PRT-13853</a>
167+
168+
</div>
169+
170+
171+
=== "`Example1_Simple.ino`"
172+
Users can find this sketch in the **File** > **Examples** > **SparkFun MAX1704x Fuel Gauge Arduino Library** > **Example1_Simple** drop-down menu.
173+
174+
??? code "`Example1_Simple.ino`"
175+
```cpp
176+
--8<-- "https://raw.githubusercontent.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library/main/examples/Example1_Simple/Example1_Simple.ino"
177+
```
178+
179+
180+
=== "`Example4_MAX17048_KitchenSink.ino`"
181+
Users can find this sketch in the **File** > **Examples** > **SparkFun MAX1704x Fuel Gauge Arduino Library** > **Example4_MAX17048_KitchenSink** drop-down menu.
182+
183+
??? code "`Example4_MAX17048_KitchenSink.ino`"
184+
```cpp
185+
--8<-- "https://raw.githubusercontent.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library/main/examples/Example4_MAX17048_KitchenSink/Example4_MAX17048_KitchenSink.ino"
186+
```

docs/example-QSPI.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
icon: simple/arduino
3+
---
4+
5+
## MX25L12833F
6+
The Renesas-Arduino core includes a built-in [FATFileSystem library](https://github.com/arduino/ArduinoCore-renesas/tree/main/libraries/FATFilesystem) to control the QSPI flash memory. This example code demonstrates how to initialize the flash memory, a file is written, and data is read from the file. *Users can also find other example sketches in the **File** > **Examples** > **Storage** drop-down menu.*
7+
8+
??? code "`QSPI_Flash_FileSystem_Test.ino`"
9+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1236:1321"
10+
11+
12+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1325:1325"
13+
14+
??? code
15+
```cpp
16+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1272:1283"
17+
```
18+
19+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1326:1326"
20+
21+
??? code
22+
```cpp
23+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1285:1299"
24+
```
25+
26+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1327:1327"
27+
28+
??? code
29+
```cpp
30+
--8<-- "https://raw.githubusercontent.com/arduino/docs-content/main/content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md:1301:1317"
31+
```

docs/example-SD_card.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
icon: simple/arduino
3+
---
4+
5+
!!! warning "Data Corruption"
6+
To avoid any data loss or corrupting the SD card, users should disable all activity with the SD card before removing it from the RA6M5 Thing Plus.
7+
8+
The [FATFileSystem library](https://github.com/arduino/ArduinoCore-renesas/tree/main/libraries/FATFilesystem) built into the Renesas-Arduino core, supports &micro;SD cards with a **FAT32** file system *(i.e. SD cards **up to 32GB** in size)*.
9+
10+
- While users may be able to use cards with a higher storage capacity, we highly advise against it. As users may experience data loss due to a corrupt file system *(i.e. SD cards with a storage capacity greater than 32GB are not meant to be formatted with a FAT32 file system)*.
11+
12+
13+
## SD Card - Test
14+
The Renesas-Arduino core includes a built-in [FATFileSystem library](https://github.com/arduino/ArduinoCore-renesas/tree/main/libraries/FATFilesystem) that controls the SD host interface. The library that supports SD cards with a **FAT32** file system *(i.e. SD cards **up to 32GB** in size)*. Users can find an example sketch in the **File** > **Examples** > **Storage** > **TestSDCARD** drop-down menu.
15+
16+
??? note "Optional Hardware"
17+
<div class="grid cards" markdown>
18+
19+
- <a href="https://www.sparkfun.com/products/15107">
20+
<figure markdown>
21+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/3/4/7/0/15107-microSD_Card_-_1GB__Class_4_-01.jpg)
22+
</figure>
23+
24+
---
25+
26+
**microSD Card - 1GB (Class 4)**<br>
27+
COM-15107</a>
28+
29+
30+
- <a href="https://www.sparkfun.com/products/19041">
31+
<figure markdown>
32+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/1/8/6/5/3/19041-microSD_Card_-_32GB__Class_10_-02.jpg)
33+
</figure>
34+
35+
---
36+
37+
**microSD Card - 32GB (Class 10)**<br>
38+
COM-19041</a>
39+
40+
41+
- <a href="https://www.sparkfun.com/products/13004">
42+
<figure markdown>
43+
![Product Thumbnail](https://cdn.sparkfun.com/assets/parts/9/9/5/8/13004-02.jpg)
44+
</figure>
45+
46+
---
47+
48+
**microSD USB Reader**<br>
49+
COM-13004</a>
50+
51+
</div>
52+
53+
54+
<!--
55+
=== "`TestSDCARD.ino`"
56+
Users can find this sketch in the **File** > **Examples** > **Storage** > **TestSDCARD** drop-down menu.
57+
58+
??? code "`TestSDCARD.ino`"
59+
```cpp
60+
--8<-- "https://raw.githubusercontent.com/arduino/ArduinoCore-renesas/main/libraries/Storage/examples/TestSDCARD/TestSDCARD.ino"
61+
```
62+
63+
64+
=== "`SD_Test.ino`"
65+
Users can find this sketch in the **File** > **Examples** > **02.Digital** > **InputPullupSerial** drop-down menu.
66+
67+
??? code "`SD_Test.ino`"
68+
```cpp
69+
--8<-- "./Firmware/Tests/SD_Test/SD_Test.ino"
70+
```
71+
-->
72+
73+
74+
??? code "`TestSDCARD.ino`"
75+
```cpp
76+
--8<-- "https://raw.githubusercontent.com/arduino/ArduinoCore-renesas/main/libraries/Storage/examples/TestSDCARD/TestSDCARD.ino"
77+
```

0 commit comments

Comments
 (0)