Skip to content

IDE pro references removed. Some bad indentations inside code blocks+typos #547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ The Portenta H7 is equipped with a processor that has two processing units calle

- [Portenta H7 (ABX00042)](https://store.arduino.cc/portenta-h7) or [Portenta H7 Lite Connected (ABX00046)](https://store.arduino.cc/products/portenta-h7-lite-connected)
- USB C cable (either USB A to USB C or USB C to USB C)
- Arduino IDE 1.8.10+ or Arduino Pro IDE 0.0.4+ 
- Arduino IDE 1.8.10+ 

## Cortex® M7 & M4
Processor cores are individual processing units within the board's main processing unit (do not confuse a processor core with an [Arduino core](https://www.arduino.cc/en/guide/cores)). These cores are responsible for executing instructions at a particular clock speed. The on-board  Arm Cortex processor comes with two cores (Cortex® M7 and M4), with slightly different architectures and clock speeds. The M7 runs at 480 MHz and the architecture is designed to separate Instruction and Data buses to optimize CPU latency. The M4 runs at 240 MHz and the architecture supports the ART™ accelerator (a block that speeds up instruction fetching accesses of the Cortex-M4 core to the D1-domain internal memories). The higher clock rate of the M7 makes it suitable to handle complex processing tasks such as data storage, debugging or handling input/output peripherals at a higher efficiency compared to the M4. The dual core processor of the Portenta H7 sets it apart from other single core Arduino boards, by allowing true multitasking, faster data processing capabilities, enhanced processing power and application partitioning.  
Processor cores are individual processing units within the board's main processing unit (do not confuse a processor core with an [Arduino core](https://docs.arduino.cc/learn/starting-guide/cores)). These cores are responsible for executing instructions at a particular clock speed. The on-board  Arm Cortex processor comes with two cores (Cortex® M7 and M4), with slightly different architectures and clock speeds. The M7 runs at 480 MHz and the architecture is designed to separate Instruction and Data buses to optimize CPU latency. The M4 runs at 240 MHz and the architecture supports the ART™ accelerator (a block that speeds up instruction fetching accesses of the Cortex-M4 core to the D1-domain internal memories). The higher clock rate of the M7 makes it suitable to handle complex processing tasks such as data storage, debugging or handling input/output peripherals at a higher efficiency compared to the M4. The dual core processor of the Portenta H7 sets it apart from other single core Arduino boards, by allowing true multitasking, faster data processing capabilities, enhanced processing power and application partitioning.  

![The Architectures of Cortex® M7 and M4 cores.](assets/por_ard_dcp_m4_m7_architectures.svg)

Expand All @@ -48,7 +48,7 @@ To best illustrate the idea of dual core processing, you will be running two sep
![Running two different sketch files on the different cores.](assets/por_ard_dcp_tutorial_overview.svg)

### 1. The Basic Setup
Begin by plugging-in your Portenta board to your computer using an appropriate USB-C cable and have the  Arduino IDE open. If this is your first time running Arduino sketch files on the board, we suggest you check out how to [Setting Up Portenta H7 For Arduino](https://docs.arduino.cc/tutorials/portenta-h7/setting-up-portenta) before you proceed.
Begin by plugging-in your Portenta board to your computer using an appropriate USB-C cable and have the  Arduino IDE open. If this is your first time running Arduino sketch files on the board, we suggest you check out how to [Setting Up Portenta H7 For Arduino](setting-up-portenta) before you proceed.

![A Basic setup of the board attached to your computer](../setting-up-portenta/assets/por_ard_gs_basic_setup.svg)

Expand Down Expand Up @@ -149,11 +149,11 @@ int myLED;

void setup() {

randomSeed(analogRead(0));
randomSeed(analogRead(0));

#ifdef CORE_CM7
bootM4();
myLED = LEDB; // built-in blue LED
#ifdef CORE_CM7
bootM4();
myLED = LEDB; // built-in blue LED
#endif
```

Expand All @@ -163,9 +163,9 @@ The code between `#ifdef CORE_CM7` and `#endif` will only apply for the M7 Core
Then, as well inside the `setup()` function, you will need to include the following lines to configure properly the green LED in the M4 core.

```cpp
#ifdef CORE_CM4
myLED = LEDG; // built-in greeen LED
#endif
#ifdef CORE_CM4
myLED = LEDG; // built-in greeen LED
#endif
```

### 3. Finishing the Setup() Function and Programming the Loop()
Expand All @@ -181,7 +181,7 @@ void loop() {
digitalWrite(myLED, LOW); // turn the LED on
delay(200);
digitalWrite(myLED, HIGH); // turn the LED off
delay( rand() % 2000 + 1000); // wait for a random amount of time between 1 and 3 seconds.
delay(rand() % 2000 + 1000); // wait for a random amount of time between 1 and 3 seconds.
}
```

Expand All @@ -192,4 +192,4 @@ This tutorial introduces the idea of dual core processing and illustrates the co

### Next Steps

- Proceed with the next tutorial "Setting Up a Wi-Fi Access Point" to learn how to make use of the built-in Wi-Fi module and configure your Portenta H7 as a Wi-Fi access point.
- Proceed with the next tutorial [Setting Up a Wi-Fi Access Point](wifi-access-point) to learn how to make use of the built-in Wi-Fi module and configure your Portenta H7 as a Wi-Fi access point.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ software:
- web-editor
---
## Overview
Congratulations on your purchase of one of our most powerful microcontroller boards to date! We know you are eager to try out your new board but before you can start using the Portenta H7 to run Arduino sketches you need to configure your computer and the Arduino IDE. This tutorial teaches you how to set up the board, how to configure your computer and how to run the classic Arduino blink example to verify if the configuration was successful.
Congratulations on your purchase of one of our most powerful microcontroller boards to date! We know you are eager to try out your new board but before you can start using the Portenta H7 to run Arduino sketches you need to configure your computer and the Arduino IDE. This tutorial teaches you how to set up the board, how to configure your computer and how to run the classic Arduino blink example to verify if the configuration was successful.

One of the benefits of the Portenta H7 is that it supports different types of software cores. A core is the software API for a particular set of processors. It is the API that provides functions such as digitalRead(), analogWrite(), millis() etc. which directly operate on the hardware.

Expand All @@ -31,19 +31,18 @@ This tutorial focuses on the Arduino core which allows you to benefit from the t
## Goals

- About the Arduino and Mbed operating system (Mbed OS) stack
- Installing the Mbed library
- Installing the Mbed library
- Controlling the built in LED on the Portenta board

### Required Hardware and Software

- [Portenta H7 (ABX00042)](https://store.arduino.cc/products/portenta-h7), [Portenta H7 Lite (ABX00045)](https://store.arduino.cc/products/portenta-h7-lite) or [Portenta H7 Lite Connected (ABX00046)](https://store.arduino.cc/products/portenta-h7-lite-connected)
- [Portenta H7 (ABX00042)](https://store.arduino.cc/products/portenta-h7), [Portenta H7 Lite (ABX00045)](https://store.arduino.cc/products/portenta-h7-lite) or [Portenta H7 Lite Connected (ABX00046)](https://store.arduino.cc/products/portenta-h7-lite-connected)
- USB C cable (either USB A to USB C or USB C to USB C)
- Arduino IDE 1.8.10+ or Arduino Pro IDE 0.0.4+

## Portenta and The Arduino Core
The Portenta H7 is equipped with two Arm Cortex ST processors (Cortex-M4 and Cortex-M7) which run the Mbed OS. Mbed OS is an embedded real time operating system (RTOS) designed specifically for microcontrollers to run IoT applications on low power. A real-time operating system is an operating system designed to run real-time applications that process data as it comes in, typically without buffer delays. [Here you can read more about real time operating systems](https://www.ni.com/en-us/innovations/white-papers/07/what-is-a-real-time-operating-system--rtos--.html).
The Portenta H7 is equipped with two Arm Cortex ST processors (Cortex-M4 and Cortex-M7) which run the Mbed OS. Mbed OS is an embedded real time operating system (RTOS) designed specifically for microcontrollers to run IoT applications on low power. A real-time operating system is an operating system designed to run real-time applications that process data as it comes in, typically without buffer delays. [Here you can read more about real time operating systems](https://www.ni.com/en-us/innovations/white-papers/07/what-is-a-real-time-operating-system--rtos--.html).

The Arduino core for the Portenta H7 sits on top of the Mbed OS and allows to develop applications using Mbed OS APIs which handle for example storage, connectivity, security and other hardware interfacing. [Here you can read more about the Mbed OS APIs](https://os.mbed.com/docs/mbed-os/v5.15/apis/index.html). However, taking advantage of the Arm® Mbed™ real time operating system's powerful features can be a complicated process. Therefore we simplified that process by allowing you to run Arduino sketches on top of it.
The Arduino core for the Portenta H7 sits on top of the Mbed OS and allows to develop applications using Mbed OS APIs which handle for example storage, connectivity, security and other hardware interfacing. [Here you can read more about the Mbed OS APIs](https://os.mbed.com/docs/mbed-os/latest/apis/index.html). However, taking advantage of the Arm® Mbed™ real time operating system's powerful features can be a complicated process. Therefore we simplified that process by allowing you to run Arduino sketches on top of it.

![The Arduino core is built on top of the Mbed stack](assets/por_gs_mbed_stack.svg)

Expand All @@ -52,28 +51,25 @@ The Arduino core for the Portenta H7 sits on top of the Mbed OS and allows to de
### Configuring the Development Environment
In this section, we will guide you through a step-by-step process of setting up your Portenta board for running an Arduino Sketch that blinks the built-in RGB LED.

***IMPORTANT: Please make sure to update the bootloader to the most recent version to benefit from the latest improvements. Follow [these steps](/tutorials/portenta-h7/updating-the-bootloader) before you proceed with the next step of this tutorial.***
***IMPORTANT: Please make sure to update the bootloader to the most recent version to benefit from the latest improvements. Follow [these steps](updating-the-bootloader) before you proceed with the next step of this tutorial.***

### 1. The Basic Setup
Let's begin by Plug-in your Portenta to your computer using the appropriate USB C cable. Next, open your IDE and make sure that you have the right version of the Arduino IDE or the PRO IDE downloaded on to your computer.
Let's begin by Plug-in your Portenta to your computer using the appropriate USB C cable. Next, open your IDE and make sure that you have the right version of the Arduino IDE downloaded on to your computer.

![The Portenta H7 can be connected to the computer using an appropriate USB-C cable](assets/por_ard_gs_basic_setup.svg)

### 2. Adding the Portenta to the List of Available Boards
This step is the same for both the classic IDE and the Pro IDE. Open the board manager and search for "portenta". Find the Arduino mbed-enabled Boards library and click on "Install" to install the latest version of the mbed core (1.2.3 at the time of writing this tutorial).
In your Arduino IDE, open the board manager and search for "portenta". Find the Arduino mbed-enabled Boards library and click on "Install" to install the latest version of the mbed core (1.2.3 at the time of writing this tutorial).

**Note:** If you have previously installed the Nano 33 BLE core it will be updated by following this step.
**Note:** If you have previously installed the Nano 33 BLE core it will be updated by following this step.

![A search for "portenta" reveals the core that needs to be installed to support Portenta H7.](assets/por_ard_gs_bm_core.png)

![Also in the Pro IDE, a search for "portenta" reveals the core that needs to be installed to support Portenta H7.](assets/por_ard_gs_bm_core_pro_ide.png)

### 3. Uploading the Classic Blink Sketch
Let's program the Portenta with the classic blink example to check if the connection to the board works. There are two ways to do that:

- In the classic Arduino IDE open the blink example by clicking the menu entry **File > Examples > 01.Basics > Blink**. You need to swap LOW and HIGH pin values as the built-in LED on Portenta is turned on by pulling it LOW.
- By downloading the 'Arduino_Pro_Tutorials' library and opening the pre-made sketch under **File > Examples > Arduino_Pro_Tutorials > Setting Up Portenta H7 For Arduino > Blink**
- In the Arduino Pro IDE Copy and paste the following code into a new sketch in your IDE.
- In the classic Arduino IDE open the blink example by clicking the menu entry **File > Examples > 01.Basics > Blink**. You need to swap LOW and HIGH pin values as the built-in LED on Portenta is turned on by pulling it LOW.
- In the Arduino IDE copy and paste the following code into a new sketch in your IDE.

```cpp
// the setup function runs once when you press reset or power the board
Expand All @@ -96,25 +92,23 @@ void loop() {

For Portenta H7 LED_BUILTIN represents the built-in RGB LED on the board in green color.

**Note:** The individual colors of the built-in RGB LED can be accessed and controlled separately. In the tutorial "Dual Core Processing" you will learn how to control the LED to light it in different colors
**Note:** The individual colors of the built-in RGB LED can be accessed and controlled separately. In the tutorial [Dual core processing](dual-core-processing) you will learn how to control the LED to light it in different colors

### 4. Upload the Blink Sketch
Now it's time to upload the sketch and see if the LED will start to blink. Make sure you select Arduino Portenta H7 (M7 core) as the board and the port to which the Portenta H7 is connected. If the Portenta H7 doesn't show up in the list of ports, go back to step 5 and make sure that the drivers are installed correctly. Once selected click Upload. Once uploaded the built-in LED should start blinking with an interval of 1 second.
Now it's time to upload the sketch and see if the LED will start to blink. Make sure you select Arduino Portenta H7 (M7 core) as the board and the port to which the Portenta H7 is connected. If the Portenta H7 doesn't show up in the list of ports, go back to step 1 and make sure that the drivers are installed correctly. Once selected click Upload. Once uploaded the built-in LED should start blinking with an interval of 1 second.

**Note:** The Portenta H7 has an M7 and an M4 processor which run separate cores. That's why you need to select the one to which you want to upload your sketch to (check out the tutorial "Dual Core Processing" to learn more about Portenta's processors).
**Note:** The Portenta H7 has an M7 and an M4 processor which run separate cores. That's why you need to select the one to which you want to upload your sketch to (check out the tutorial [Dual core processing](dual-core-processing) to learn more about Portenta's processors).

![Select the Arduino Portenta H7 (M7 core) in the board selector.](assets/por_ard_gs_upload_sketch.png)

![Selecting the Arduino Portenta H7 (M7 core)](assets/por_gs_board_selection_pro_ide.png)

**Optional:** We collect all the sketches from the tutorials in a library which you can install from the Library Manager: **Tools > Manage Libraries**. Search for 'Arduino_Pro_Tutorials' or download them from the [repository](https://github.com/arduino-libraries/Arduino_Pro_Tutorials/releases).

## Conclusion
You have now configured your Portenta board to run Arduino sketches. Along with that you gained an understanding of how the Arduino Core runs on top of Mbed OS.
You have now configured your Portenta board to run Arduino sketches. Along with that you gained an understanding of how the Arduino Core runs on top of Mbed OS.

### Next Steps
- Proceed with the next tutorial "Dual Core Processing" to learn how to make use of Portenta H7's two processors to do two separate tasks simultaneously.
- Read more about why we chose Mbed as as the foundation [here](https://blog.arduino.cc/2019/07/31/why-we-chose-to-build-the-arduino-nano-33-ble-core-on-mbed-os/)
- Proceed with the next tutorial [Dual core processing](dual-core-processing) to learn how to make use of Portenta H7's two processors to do two separate tasks simultaneously.
- Read more about why we chose Mbed as as the foundation [here](https://blog.arduino.cc/2019/07/31/why-we-chose-to-build-the-arduino-nano-33-ble-core-on-mbed-os/).

## Troubleshooting
### Sketch Upload Troubleshooting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This tutorial will explain what a bootloader is, why you should consider keeping

- [Portenta H7 (ABX00042)](https://store.arduino.cc/products/portenta-h7), [Portenta H7 Lite (ABX00045)](https://store.arduino.cc/products/portenta-h7-lite) or [Portenta H7 Lite Connected (ABX00046)](https://store.arduino.cc/products/portenta-h7-lite-connected)
- USB C cable (either USB A to USB C or USB C to USB C)
- Arduino IDE 1.8.10+ or Arduino Pro IDE 0.0.4+
- Arduino IDE 1.8.10+

## What Is a Firmware?

Expand Down Expand Up @@ -64,7 +64,7 @@ New versions of the bootloader normally get shipped together with the core. That

![Open the Boards Manager from the Tools menu](assets/por_ard_bl_boards_manager.png)

In the board manager and search for "portenta". Find the Arduino mbed-enabled Boards package and click on "Install" to install the latest version of the mbed core (1.3.0 at the time of writing this tutorial).
In the board manager and search for "portenta". Find the Arduino mbed-enabled Boards package and click on "Install" to install the latest version of the mbed core (1.3.0 at the time of writing this tutorial).

![A search for "portenta" reveals the core that needs to be updated to get the latest bootloader](assets/por_ard_bl_update_core.png)

Expand Down