Skip to content

Commit 0a3a598

Browse files
authored
Merge pull request #262 from arduino/jacobhylen/giga-cheat-sheet-tweaks
Tweak the giga cheat sheet
2 parents fa3e2f9 + b8aaa67 commit 0a3a598

File tree

10 files changed

+89
-47
lines changed

10 files changed

+89
-47
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

content/hardware/08.mega/boards/giga-r1/tutorials/cheat-sheet/cheat-sheet.md

Lines changed: 89 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ tags:
1414
- Arducam
1515
- Audio Jack
1616
author: 'Jacob Hylén'
17-
libraries:
18-
- name: Arduino ECCX08
19-
url: https://github.com/arduino-libraries/ArduinoECCX08
20-
- name: RTC by Giampalo Mancini
21-
url: Haven't found yet
22-
- name: USBHostMbed5
23-
url: https://github.com/facchinm/USBHostMbed5/tree/test_hs_in_fs WILL PROBABLY CHANGE
24-
- name: AdvancedAnalogRedux
25-
url: https://github.com/bcmi-labs/AdvancedAnalogRedux
2617
hardware:
2718
- hardware/giga-r1
2819
software:
@@ -43,7 +34,7 @@ You can also visit the documentation platform for the [Arduino GIGA R1](/hardwar
4334
## Datasheet
4435
The full datasheets are available as a downloadable PDF from the link below:
4536

46-
- [Download the Arduino GIGA R1 datasheet]()
37+
- [Download the Arduino GIGA R1 datasheet](docs.arduino.cc/resources/datasheets/ABX00067-datasheet.pdf)
4738

4839
## Power Supply
4940

@@ -69,7 +60,7 @@ The **Arduino GIGA R1** can be programmed through:
6960
To set the board up to be programmed with the OpenMV IDE in MicroPython, check out the [Boot0 section](#boot0) of this article.
7061

7162
### Core
72-
The Arduino GIGA R1 uses the [GIGA core]().
63+
The Arduino GIGA R1 uses the [Arduino Core for mbed devices](https://github.com/arduino/ArduinoCore-mbed).
7364

7465
### Boot0
7566
Pressing and holding the button labelled `BOOT0` on the board while powering the board will boot it into DFU-mode (Device Firmware Update), letting you reflash the bootloader without the use of external hardware, if you were to ever need to.
@@ -78,15 +69,12 @@ Pressing and holding the button labelled `BOOT0` on the board while powering the
7869

7970
The state of this button can also be read from a sketch while it is running, giving you a basic interactive component without needing to do any wiring.
8071

81-
Booting the board into DFU-mode will also let you configure it with the OpenMV IDE to program the board with MicroPython, to for example deploy a trained ML model analysing a real time camera feed.
82-
83-
To learn more about this feature, and how you can use it, check out [this tutorial.]()
84-
85-
## Arduino IoT Cloud
86-
87-
The Arduino GIGA R1 is compatible with the [Arduino IoT Cloud](https://create.arduino.cc/iot/things), a cloud service that allows you to create IoT applications in just minutes.
72+
To read the state of the Boot0 button in your sketch, you use this line of code:
73+
```arduino
74+
digitalRead(PC_13);
75+
```
8876

89-
If you need help to get started, you can go through the [Arduino IoT Cloud getting started guide](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-getting-started).
77+
Booting the board into DFU-mode will also let you configure it with the OpenMV IDE to program the board with MicroPython, to for example deploy a trained ML model analysing a real time camera feed.
9078

9179
## STM32H747XI Microcontroller
9280

@@ -158,44 +146,106 @@ In the coming sections we will provide resources and basic information on how to
158146

159147

160148
### Output
149+
In order to output audio from the DAC, you can use the `AdvancedAnalogRedux` library from Arduino. You will need to connect a speaker to your board either with the headphone jack or the dac pins.
161150

162-
### Input
151+
Include the library and setup the DAC with the following code in the beginning of your sketch, outside of the `void setup()` function:
163152

164-
## MIPI Display Interface
165-
The **STM32H747XI** has an internal 2D graphics accelerator with support for resolutions up to 1024x768, it also has the ability to encode and decode JPEG codec. This is what allows the **Arduino GIGA R1** to boast a 2 lane MIPI display interface.
153+
```arduino
154+
#include "AdvancedDAC.h"
166155
167-
This means that the **Arduino GIGA R1** is capable of driving a touch-display large enough to build a substantial user interface. The [LVGL](https://lvgl.io) library is a powerful tool to quickly build a responsive interface.
156+
AdvancedDAC dac(A12);
157+
158+
```
168159

169-
Check out [this tutorial]() to learn how to build an interface with the LVGL library.
160+
Then, initialize the library, and check that everything went as expected with the following piece of code:
170161

171-
## USBHost
172-
The USB-A port you find on the **Arduino GIGA R1** is configured as a host-only port, meaning that it cannot be used to program the board, instead it is used to connect peripherals to the board. The board can receive keyboard input, or be used to read files off of a USB flash drive, if you for example want to play audio files on a speaker you have plugged in the audio jack.
162+
```arduino
163+
if (!dac.begin(AN_RESOLUTION_12, 8000, 32, 64)) {
164+
Serial.println("Failed to start DAC!");
165+
while (1);
166+
}
167+
```
168+
169+
Then lastly, add the following code to `void loop()` to start:
170+
```arduino
171+
if (dac.available()) {
172+
173+
// Get a free buffer for writing
174+
SampleBuffer buf = dac.dequeue();
175+
176+
// Write data to buffer
177+
for (int i=0; i<buf.size(); i++) {
178+
buf.data()[i] = (i % 2 == 0) ? 0: 0xfff;
179+
}
180+
181+
// Write the buffer data to DAC
182+
dac.write(buf);
183+
}
184+
```
185+
186+
The options for audio playback and generation on your Arduino GIGA R1 are **much** more vast than this, however. To learn about audio playback in depth, check out the [audio guide](../giga-audio/content.md).
173187

174-
- [Library for USB-Host]()
188+
### Input
189+
The audio jack on the Arduino GIGA R1 is not just connected to the DAC pins, however, but are also connected to pin A7, for microphone capabilities.
175190

176-
To learn in depth about how to use this powerful feature, read the [USBHost Guide.]()
191+
To take advantage of this, you can use the `AdvancedAnalogRedux` library from Arduino, start off by including the library and setting up the pin as an advanced ADC pin in the beginning of your sketch, outside of `void setup()`.
177192

178-
## Dual Core Processing
179-
As mentioned previously, the microcontroller on the **Arduino GIGA R1** is a dual core processor, and can therefore run two separate programs simultaneously. The cores can be programmed separately and are capable of sharing information with each other.
193+
```arduino
194+
#include "AdvancedADC.h"
180195
181-
When writing a program that is supposed to use both cores, you will be required to forcefully boot the second core. For most programs there really is no reason to use both, and for that reason it is by default unbooted. However it is a powerful option to have, and one that you can easily make use of if you want to continuously monitor and process sensor values.
196+
AdvancedADC adc(A7);
197+
```
182198

183-
You boot the second core by adding the function:
199+
Now, initialise the library and run a check to make sure everything went as expected with the following code within `void setup()`:
184200
```arduino
185-
bootM4();
201+
202+
Serial.begin(9600);
203+
204+
// Resolution, sample rate, number of samples per channel, and queue depth of the ADC
205+
if (!adc.begin(AN_RESOLUTION_16, 16000, 32, 64)) {
206+
Serial.println("Failed to start analog acquisition!");
207+
while (1);
208+
}
186209
```
187-
at the beginning of the sketch for your primary core, in the board selector you choose to program either the primary M7 core, or the secondary M4 core.
210+
Finally, read the ADC, and store it in a way that you can use it, do this within `void loop()`:
211+
```arduino
212+
if (adc.available()) {
213+
SampleBuffer buf = adc.read();
214+
215+
// Print first sample
216+
Serial.println(buf[0]);
217+
218+
// Release the buffer to return it to the pool
219+
buf.release();
220+
```
221+
222+
The options for audio input on your Arduino GIGA R1 are **much** more vast than this, however. To learn about audio recording in depth, check out the [audio guide](../giga-audio/content.md).
223+
224+
## MIPI Display Interface
225+
The **STM32H747XI** has an internal 2D graphics accelerator with support for resolutions up to 1024x768, it also has the ability to encode and decode JPEG codec. This is what allows the **Arduino GIGA R1** to boast a 2 lane MIPI display interface.
226+
227+
This means that the **Arduino GIGA R1** is capable of driving a touch-display large enough to build a substantial user interface. The [LVGL](https://lvgl.io) library is a powerful tool to quickly build a responsive interface.
188228

189-
It is also possible to program both cores with just one sketch, though this quickly becomes an unwieldy, inefficient and **difficult** way to work.
229+
## USBHost
230+
The USB-A port you find on the **Arduino GIGA R1** is configured as a host-only port, meaning that it cannot be used to program the board, instead it is used to connect peripherals to the board. The board can receive keyboard input effectively enabling a few hundred more inputs without any wiring, or be used to read files off of a USB flash drive, if you for example want to play audio files on a speaker you have plugged in the audio jack.
190231

191-
To learn more about dual core processing on the **Arduino GIGA R1**, check out the tutorial below:
232+
There are several libraries you can use for the USBHost capabilities of the Arduino GIGA R1:
192233

193-
- [Dual Core Processing](https://docs.arduino.cc/tutorials/portenta-h7/dual-core-processing)
234+
- USBHost
235+
- HIDHost
236+
- PluggableUSBHID
237+
- USBKeyboard
238+
239+
Some of these libraries are built in to the core and therefore you won't be required to download them separately.
240+
241+
To learn in depth about how to use these powerful features, read the [USBHost Guide](../giga-usb/giga-usb.md) that contains in-depth walkthroughs for each of them.
194242

195243
## RTC
196244

197245
The **Arduino GIGA R1** features an RTC pin, giving you the ability to power the timekeeping circuitry with a coin cell battery to keep the time even when your board is turned off, for low power timekeeping.
198246

247+
![RTC pin on the Arduino GIGA R1](./assets/rtc.png)
248+
199249
The following sketch will continuously print the time in the Serial monitor.
200250
```arduino
201251
#include "mbed.h"
@@ -241,18 +291,16 @@ String getLocaltime()
241291

242292
To get accurate time, you'll want to change the values in `void RTCset()` to whatever time it is when you're starting this clock. As long as the VRTC pin is connected to power, the clock will keep ticking and time will be kept accurately.
243293

244-
To learn more about the Arduino GIGA R1's RTC capabilities, check out [this tutorial]() for an in-depth guide
245-
246294
## Camera Interface
247295
The Arduino GIGA features an onboard arducam compatible connector, with support for **parallel**.
248296

249297
Programming the board in the **MicroPython** language using the **OpenMV IDE** easily lets you get started with a neural network analysing a realtime camera feed with ML.
250298

299+
To learn more about the camera capabilities of the Arduino GIGA R1, check out the [GIGA Camera Guide](../giga-camera/giga-camera.md)
300+
251301
## JTAG
252302
The **Arduino GIGA R1** features a 2x5 pin JTAG (Joint Test Action Group) connector, giving advanced debug functionalities for more advanced users.
253303

254-
Check out [this tutorial]() to learn how to use the JTAG connector on the **Arduino GIGA R1**.
255-
256304
![JTAG Connector](assets/jtag.png)
257305

258306
## CAN Bus
@@ -268,10 +316,6 @@ This makes the **Arduino GIGA R1** a powerful option for complex multilayered sy
268316

269317
The CAN pins on the **Arduino GIGA R1** are labelled `CANRX` and `CANTX`
270318

271-
For more information on how to use the CAN bus on your **Arduino GIGA R1**, check out [this tutorial.]()
272-
273-
- [Using the CAN bus on the Arduino GIGA]()
274-
275319
## SPI
276320
The **Arduino GIGA R1** features two separate SPI (Serial Peripheral Interface) buses, one is configured on the 6 pin header labelled SPI, and the other is broken out into pin connections on the board.
277321

@@ -539,8 +583,6 @@ On the **Arduino GIGA R1** you will find a pin labelled **"OFF"**. If you connec
539583

540584
You can install a flip-switch to the board to let you turn your device on and off easily, which can be a handy option for a more permanent fixture.
541585

542-
Read more about this feature, and learn when and how to use it by checking out this [this tutorial.]()
543-
544586
## Miscellaneous
545587

546588
### Interrupts

0 commit comments

Comments
 (0)