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
The **Opta™** is a secure, easy-to-use micro Programmable Logic Controller (PLC) with Industrial Internet of Things (IIoT) capabilities. The **Portenta Machine Control** is a centralized, energy-efficient industrial control unit capable of operating equipment and machinery. Both devices can be programmed with the [Arduino PLC IDE](https://www.arduino.cc/pro/software-plc-ide/), a tool that simplifies programming the device through any of the five programming languages defined by the IEC 61131-3 standard.
21
+
The **Opta™** is a secure, easy-to-use micro Programmable Logic Controller (PLC) with Industrial Internet of Things (IIoT) capabilities. The **Portenta Machine Control** is a centralized, energy-efficient industrial control unit capable of operating equipment and machinery.
22
+
23
+
Both devices can be programmed with the [Arduino PLC IDE](https://www.arduino.cc/pro/software-plc-ide/), a tool that simplifies programming the device through any of the five programming languages defined by the IEC 61131-3 standard.
22
24
23
25
The Opta™ and the Portenta Machine Control can also be programmed with other tools from the Arduino ecosystem, such as the [Arduino IDE](https://www.arduino.cc/en/software) and the Arduino programming language. Suppose we are using Opta™ with the Arduino PLC IDE and want to start programming the device using the Arduino IDE and the rest of the Arduino ecosystem tools. In that case, we need to partition the device's memory to enable all available features. This applies to the Portenta Machine Control as well.
24
26
25
-
In this tutorial, we will use an Opta™ and learn how to partition the memory to enable all its functionalities to be programmed using the Arduino IDE and the Arduino programming language.
27
+

In this tutorial, we will use an Opta™ and learn how to partition the memory to enable all its functionalities to be programmed using the Arduino IDE and the Arduino programming language.
28
30
29
31
## Goals
30
32
31
-
- Learn how to partition the memory of an Opta™ device to be used with the Arduino IDE and other ecosystem tools
32
-
- Program an Opta™ device using the Arduino IDE and the Arduino programming language.
33
+
- Learn how to partition the memory of an Opta™ device and a Portenta Machine Control to be used with the Arduino IDE and other ecosystem tools
34
+
- Program an Opta™ device and a Portenta Machine Control using the Arduino IDE and the Arduino programming language.
33
35
34
36
## Hardware and Software Requirements
35
37
@@ -52,21 +54,21 @@ In the context of the Opta™, partitioning the memory allows the device to acco
52
54
53
55
Now, we will guide the process of partitioning an Opta™'s memory to enable the full range of its functionalities to be programmed using the Arduino IDE and the Arduino programming language.
54
56
55
-
## Instructions
57
+
## Setting Up the Arduino IDE
56
58
57
-
### Setting Up the Arduino IDE
59
+
This tutorial requires the latest version of the Arduino IDE, which can be downloaded [here](https://www.arduino.cc/en/software).
58
60
59
-
This tutorial requires the latest version of the Arduino IDE, which can be downloaded [here](https://www.arduino.cc/en/software). In the Arduino IDE, you need to install the core for Opta™ devices. To do this, go to **Tools > Board > Boards Manager** or click the **Boards Manager** icon in the left tab of the IDE. In the **Boards Manager** tab, search for `opta` and install the latest `Arduino Mbed OS Opta Boards` version.
61
+
In the Arduino IDE, you need to install the core for *Opta™* devices. To do this, go to **Tools > Board > Boards Manager** or click the **Boards Manager** icon in the left tab of the IDE. In the **Boards Manager** tab, search for `opta` and install the latest `Arduino Mbed OS Opta Boards` version.
60
62
61
63

62
64
63
-
***For the Portenta Machine Control, in the __Boards Manager__ tab, search for `portenta` and install the latest `Arduino Mbed OS Portenta Boards` core version.***
65
+
For the *Portenta Machine Control*, in the __Boards Manager__ tab, search for `portenta` and install the latest `Arduino Mbed OS Portenta Boards` core version.
64
66
65
67
We are now ready to compile and upload Arduino sketches to an Opta™ device using the Arduino IDE.
66
68
67
69
***Memory partitioning of an Opta™ or a Portenta Machine Control should use the latest core and libraries to ensure the system is up-to-date with the intended default configuration.***
68
70
69
-
###Partitioning Memory of an Opta™ Device
71
+
## Partitioning Memory of an Opta™ Device
70
72
71
73
To partition the memory of an Opta™ device, you need an Arduino sketch that includes memory partition operations and a certificate file. These files can be downloaded directly from the [Software Requirements section](#software-requirements) or [here](assets/memory_partitioning.zip). Ensure both files are stored in the same directory, as shown in the following layout:
72
74
@@ -358,13 +360,291 @@ After a while, you should see information on the progress of the flashing proces
358
360
359
361
If everything went as intended, you should see a success message in the Serial Monitor. Now, we are ready to start using the full capabilities of the Opta™ with the Arduino IDE.
360
362
361
-
**The process is similar for the Portenta Machine Control.** Once the same memory partition code uploads and finishes its operation, it should show similar results in the Arduino IDE's Serial Monitor as the Opta™. It will be ready to start using the full functionalities of the Portenta Machine Control with the Arduino IDE.
363
+
## Partitioning Memory of a Portenta Machine Control
364
+
365
+
**The memory partitioning process for the Portenta Machine Control follows the same procedure as the Opta™ device.** You will need the latest `Arduino Mbed OS Portenta Boards` core version. If you do not have the latest version, please refer to the [Setting Up the Arduino IDE](#setting-up-the-arduino-ide) section before proceeding.
366
+
367
+
You will need an Arduino sketch with memory partition operations and a certificate file. These files can be downloaded from the [Software Requirements section](#software-requirements) or directly [here](assets/memory_partitioning.zip). Ensure both files are stored in the same directory, as shown below:
368
+
369
+
```
370
+
memory_partitioning
371
+
├── certificates.h
372
+
└── memory_partitioning.ino
373
+
```
374
+
375
+
***The complete sketch and the certificate files can be downloaded [__here__](assets/memory_partitioning.zip). __Please store both files in the same directory__.***
376
+
377
+
Compile and upload the following code to partition the memory of a Portenta Machine Control:
378
+
379
+
```arduino
380
+
// Include necessary libraries for working
381
+
#include <BlockDevice.h>
382
+
#include <FATFileSystem.h>
383
+
#include <LittleFileSystem.h>
384
+
#include <MBRBlockDevice.h>
385
+
#include "wiced_resource.h"
386
+
#include "certificates.h"
387
+
388
+
// Ensure that the M7 core is being used instead of the M4 core
389
+
#ifndef CORE_CM7
390
+
#error Update the WiFi firmware by uploading the sketch to the M7 core instead of the M4 core.
391
+
#endif
392
+
393
+
using namespace mbed;
394
+
395
+
// Create instances of block devices and filesystems for the QSPI Flash memory
396
+
BlockDevice* root;
397
+
MBRBlockDevice* wifi_data;
398
+
MBRBlockDevice* ota_data;
399
+
FATFileSystem wifi_data_fs("wlan");
400
+
FATFileSystem ota_data_fs("fs");
401
+
402
+
void setup() {
403
+
// Set the built-in LED pin as an output and turn it off
404
+
pinMode(LED_BUILTIN, OUTPUT);
405
+
digitalWrite(LED_BUILTIN, LOW);
406
+
407
+
// Initialize serial communication and wait up to 2.5 seconds for a connection
***If you encounter an error during the compilation process, **please ensure both the script and certificate files are in the same folder**. The certificate file is crucial for the memory partitioning process. The complete sketch and the certificate files can be downloaded [here](assets/memory_partitioning.zip).***
636
+
637
+
Once the memory partition code uploads, wait for it to complete its process. It should display similar results in the Arduino IDE's Serial Monitor as the Opta™.
638
+
639
+

640
+
641
+
You will then be ready to use the full functionalities of the Portenta Machine Control with the Arduino IDE.
362
642
363
643
## Conclusion
364
644
365
-
In this tutorial, we showed how to partition the memory of an Opta™ device, enabling its full range of functionalities to be programmed using Arduino ecosystem tools such as the Arduino IDE and the Arduino programming language. We walked through initializing and erasing the QSPI Flash memory, partitioning and formatting the memory, and writing the Wi-Fi firmware and certificate data onto the device's memory.
645
+
In this tutorial, we showed how to partition the memory of an Opta™ device and a Portenta Machine Control, enabling its full range of functionalities to be programmed using Arduino ecosystem tools such as the Arduino IDE and the Arduino programming language.
366
646
367
-
We also showed that the same process can be applied to the Portenta Machine Control to achieve similar results.
647
+
We walked through initializing and erasing the QSPI Flash memory, partitioning and formatting the memory, and writing the Wi-Fi firmware and certificate data onto the device's memory.
0 commit comments