Skip to content

Commit e61d6ec

Browse files
committed
add wifi section + fix sections
1 parent 06ef6e2 commit e61d6ec

File tree

2 files changed

+141
-26
lines changed

2 files changed

+141
-26
lines changed
Loading

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

Lines changed: 141 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ This can be very useful, as this flash storage **does not get deleted when you u
158158

159159
***Note: In this configuration, the USB serial port used for serial communication with the computer is occupied, so you won't be able to send or read information in the serial monitor. **This includes uploading new sketches. To upload a new sketch you need to put the GIGA R1 in DFU mode by double pressing the RST button.***
160160

161+
## Wi-Fi / Bluetooth® LE
162+
163+
***This section is only relevant for the [GIGA R1 WiFi](/hardware/giga-r1-wifi) version. The standard [GIGA R1](/hardware/giga-r1) does not have a radio module, cryptochip & and antenna connector.***
164+
165+
![Murata LBEE5KL1DX-883 radio module + antenna connector.]()
166+
167+
The Wi-Fi / Bluetooth® module onboard the GIGA R1 WiFi is the Murata LBEE5KL1DX-883. This module does not come with a built-in antenna, but an external antenna is included when purchasing the Wi-Fi version of this board.
168+
169+
The antenna connector (see image above) is located right next to the USB-C connector, and is of a **U.FL.** type.
170+
161171
## Audio Jack
162172

163173
The **GIGA R1** features an audio jack, with 2x DAC channels, and 1x ADC channel, and is capable of reading input from a microphone, as well as outputting sound through a speaker.
@@ -517,17 +527,15 @@ void printWifiStatus()
517527
```
518528

519529

520-
### RTC Pin
530+
### VRTC Pin
521531

522-
The GIGA R1 also features an RTC pin, giving you the ability to power the RTC with a coin cell battery to keep the time even when your board is turned off, for low power timekeeping.
532+
The GIGA R1 also features a `VRTC` pin, giving you the ability to power the RTC with a coin cell battery to keep the time even when your board is turned off, for low power timekeeping.
523533

524-
![RTC pin on the GIGA R1](./assets/rtc.png)
534+
![VRTC pin on the GIGA R1](./assets/rtc.png)
525535

526536
## Camera Interface
527537

528-
The Arduino GIGA features an onboard arducam compatible connector, with support for **parallel**.
529-
530-
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.
538+
The Arduino GIGA features an onboard Arducam compatible connector.
531539

532540
To learn more about the camera capabilities of the GIGA R1, check out the [GIGA R1 Camera Guide](/tutorials/giga-r1/giga-camera)
533541

@@ -543,61 +551,159 @@ The **GIGA R1** features a dedicated CAN bus.
543551

544552
![CAN Bus](assets/canpins.png)
545553

546-
>**Note:** the CAN bus does not include a built in transceiver. If you need to use the CAN bus, you can add a transceiver as a breakout board.
554+
***The CAN bus does not include a built in transceiver. If you need to use the CAN bus, you can add a transceiver as a breakout board.***
547555

548556
CAN, or **Controller Area Network**, is a communication standard that allows microcontroller-based devices to communicate with each other without the need for a host computer. This means that building a complex system with many different subsystems within becomes much easier.
549557

550558
This makes the **GIGA R1** a powerful option for complex multilayered systems, as it can be integrated into existing systems or be used to build a new one from scratch.
551559

552-
The CAN pins on the **GIGA R1** are labelled `CANRX` and `CANTX`
560+
The CAN pins on the **GIGA R1** are labelled `CANRX` and `CANTX`. Typically, transceiver breakouts are labelled with a similar syntax, and to connect them to the board, use the following wiring scheme:
561+
562+
| GIGA R1 | Tranceiver |
563+
| ------- | ---------- |
564+
| VCC | 3.3V |
565+
| GND | GND |
566+
| CANTX | CANTX\* |
567+
| CANRX | CANRX\* |
568+
569+
***\*The name of CANTX/CANRX differs from product to product.***
570+
571+
Below is an example of how to send & receive data using a CAN bus.
572+
573+
```arduino
574+
#include "CAN.h"
575+
576+
mbed::CAN can1(PB_5, PB_13);
577+
uint8_t counter = 0;
578+
579+
void send() {
580+
Serial.println("send()");
581+
if (can1.write(mbed::CANMessage(1337, &counter, 1))) {
582+
Serial.println("wloop()");
583+
counter++;
584+
Serial.print("Message sent: ");
585+
Serial.println(counter);
586+
} else {
587+
Serial.println("Transmission error");
588+
Serial.println(can1.tderror());
589+
can1.reset();
590+
}
591+
}
592+
593+
void receive() {
594+
mbed::CANMessage msg;
595+
if (can1.read(msg)) {
596+
Serial.print("Message received: ");
597+
Serial.println(msg.data[0]);
598+
}
599+
}
553600
554-
## SPI
555-
The **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.
556601
557-
The pins used for SPI on the **GIGA R1** are the following:
602+
void setup() {
603+
Serial.begin(115200);
604+
can1.frequency(1000000);
605+
}
558606
559-
(CIPO) - D12
560-
(COPI) - D11
561-
(SCK) - D13
562-
(CS) - D10
607+
bool receiver = false;
608+
void loop() {
609+
if (receiver) {
610+
receive();
611+
} else {
612+
send();
613+
}
614+
delay(1000);
615+
}
616+
```
617+
618+
## SPI
563619

564620
![SPI Pins](assets/spipins.png)
565621

566-
To use SPI, we first need to include the [SPI](https://www.arduino.cc/en/reference/SPI) library.
622+
The **GIGA R1** features two separate SPI (Serial Peripheral Interface) buses, one is configured on the 6 pin header (ICSP) labelled SPI, and the other is broken out into pin connections on the board.
623+
624+
The second bus `SPI` uses the following pins:
625+
626+
- (CIPO) - D89
627+
- (COPI) - D90
628+
- (SCK) - D91
629+
- (CS) - D10\*
630+
631+
The first bus, `SPI1`, uses the following pins:
632+
633+
- (CIPO) - D12
634+
- (COPI) - D11
635+
- (SCK) - D13
636+
- (CS) - D10\*
637+
638+
***\*When connecting several devices, you also need to define additional Chip Select (CS) pins. You can use any GPIO for this.***
639+
640+
For using both SPI buses simultaneously, check out the following example:
641+
567642
```arduino
568643
#include <SPI.h>
644+
645+
const int CS_1 = 10;
646+
const int CS_2 = 5;
647+
648+
void setup() {
649+
pinMode(CS_1, OUTPUT);
650+
pinMode(CS_2, OUTPUT);
651+
652+
SPI.begin();
653+
SPI1.begin();
654+
655+
digitalWrite(CS_1, LOW);
656+
digitalWrite(CS_2, LOW);
657+
658+
SPI.transfer(0x00);
659+
SPI1.transfer(0x00);
660+
661+
digitalWrite(CS_1, HIGH);
662+
digitalWrite(CS_2, HIGH);
663+
}
664+
665+
void loop() {
666+
}
569667
```
570-
Inside `void setup()` we need to initialize the library
571-
```arduino
572-
SPI.begin()
573-
```
668+
669+
Please note that the in the GIGA R1 schematics and the code does not match exactly. If you are looking at the schematics, you will notice `SPI` is `SPI1` and `SPI1` is `SPI5`.
670+
671+
![SPI ports in the schematics.](assets/schematics-spi.png)
672+
673+
574674

575675
## I2C Pins
676+
576677
I2C lets you connect multiple I2C compatible devices in series using only two pins. The controller will send out information through the I2C bus to a 7 bit address, meaning that the technical limit of I2C devices on a single line is 128. Practically, you're never gonna reach 128 devices before other limitations kick in.
577678

578679
The **GIGA R1** has three separate I2C buses of which two are usable without external components, letting you control more devices.
579680

580681
The pins used for I2C on the **GIGA R1** are the following:
581682
- SDA - D20
582683
- SCL - D21
583-
- SDA1
584-
- SCL1
684+
- SDA1 - also available on the camera connector.
685+
- SCL1 - also available on the camera connector.
585686
- SDA2 - D9
586687
- SCL2 - D8
587688

588689
![I2C Pins](assets/i2cpins.png)
589690

590691
To connect I2C devices you will need to include the [Wire](https://www.arduino.cc/reference/en/language/functions/communication/wire/) library at the top of your sketch.
692+
591693
```arduino
592694
#include <Wire.h>
593695
```
594696

595-
Inside `void setup()` you need to initialize the library.
697+
Inside `void setup()` you need to initialize the library, and initialize the I2C port you want to use.
698+
596699
```arduino
597-
Wire.begin()
700+
Wire.begin() //SDA & SDL
701+
Wire1.begin(); //SDA1 & SDL1
702+
Wire2.begin(); //SDA2 & SDL2
598703
```
599704

600705
And to write something to a device connected via I2C, we can use the following commands:
706+
601707
```arduino
602708
Wire.beginTransmission(1); //begin transmit to device 1
603709
Wire.write(byte(0x00)); //send instruction byte
@@ -610,6 +716,7 @@ If you pay close attention you may notice that there are three sets of I2C pins.
610716
If you want to use the third set (SDA2, SCL2) as I2C pins you will need to use external pullup resistors.
611717

612718
## Serial/UART Pins
719+
613720
The **GIGA R1** supports, like every other Arduino board, serial communication with UART (Universal Asynchronous, Receiver-Transmitter). However, the **GIGA R1** board features 4 separate serial ports.
614721

615722
This not only means that you may print different values to different ports and monitor them separately, which is useful enough in and of itself, but that you may also communicate with **4 different serial enabled devices** simultaneously.
@@ -626,6 +733,7 @@ The pins used for UART on the **GIGA R1** are the following:
626733
- TX3 - 14
627734

628735
Each Serial port works in the same way as the one you're used to, but you use different functions to target them:
736+
629737
```arduino
630738
Serial.begin(9600);
631739
Serial1.begin(9600);
@@ -761,20 +869,24 @@ If you just need a quick overview of the pins functionality, this is a full tabl
761869
### Analog Pins
762870

763871
The **GIGA R1** has 12 analog input pins that can be read with a resolution of 16 Bits, by using the `analogRead()` function.
872+
764873
```arduino
765874
value = analogRead(pin, value);
766875
```
767876

768877
The reference voltage of these pins is 3.3V.
769878

770-
Pins A8, A9, A10 and A11 can not be used as GPIO, but are limited to use as analog input pins.
879+
Pins A8, A9, A10 and A11 can not be used as GPIOs, but are limited to use as analog input pins.
880+
881+
***For more advanced analog readings, you can use the `AdvancedAnalogRedux` library. Read more about this in the [Advanced ADC section](/tutorials/giga-r1/giga-audio#analog-to-digital-converters).***
771882

772883

773884
### PWM Pins
774885

775886
PWM (Pulse Width Modulation) capability allows a digital pin to emulate analog output by flickering on and off very fast letting you, among other things, dim LEDs connected to digital pins.
776887

777888
The **GIGA R1** has 12 PWM capable pins, the PWM capable pins are 2-12. You may use them as analog output pins with the function:
889+
778890
```arduino
779891
analogWrite(pin, value);
780892
```
@@ -798,7 +910,7 @@ The **GIGA R1** features more pins than any other Arduino board for makers, a fu
798910
- 18 - TX1
799911
- 19 - RX1
800912
- 20 - SDA
801-
- 21 - SCL
913+
- 21 - SCL
802914

803915
The reference voltage of all digital pins is 3.3V.
804916

@@ -814,10 +926,13 @@ analogWrite(pin, value);
814926
These DAC pins have a default write resolution of 8-bits. This means that values that are written to the pin should be between 0-255.
815927

816928
However you may change this write resolution if you need to, to up to 12-bits:
929+
817930
```arduino
818931
analogWriteResolution(12);
819932
```
820933

934+
***For advanced usage of the DAC, you can use the `AdvancedAnalogRedux` library. Read more about this in the [Advanced DAC section](/tutorials/giga-r1/giga-audio#digital-to-analog-converters).***
935+
821936
### OFF Pin
822937

823938
On the **GIGA R1** you will find a pin labelled **"OFF"**. If you connect this pin to ground, the board will power down even if power is supplied to the board.

0 commit comments

Comments
 (0)