Spresense Header CodeSpresense Header Code

Edge computing with low power consumption

The Spresense development board enables edge solutions with high computing ability and low power consumption.

Spresense Arduino Library Getting Started Guide

This section helps you set up the environment on your computer to:

  1. Install the Spresense Arduino Library.

  2. Set up your computer to run Spresense Arduino Library sketches.

  3. Run a sample application on the Spresense board to test the setup.

1. Supported Operating Systems

The Spresense Arduino Library runs on the following operating systems:

  • Windows 8.1/10

  • 64bit version Linux Ubuntu 16.04

  • Mac OS X 10.12 Sierra

2. Prerequisites

  1. Download and install the Arduino IDE for your operating system:

  2. Download and install the USB-to-serial drivers that correspond to your operating system from the following links:

For Windows 10, please download v10.1.3 from the above URL and install it. If you use the latest driver (v10.1.4), a problem that transmission data have been lost may occur when the serial terminal is opened.

Installing extra drivers is not necessary for 64bit Linux Ubuntu.

2.1. Linux USB serial port configuration

  • 64bit Linux Ubuntu requires the user to be a member of the dialout group.

    1. Add user to dialout groups.

      $ sudo usermod -a -G dialout $USER
    2. Logout and login again to use the new settings.

    3. Connect the Spresense board to the PC via the USB cable.

You must set up the USB port to be able to upload the built image to the Spresense board.

3. Install Spresense Arduino Library

There are two installation methods to choose from:

We recommend installing through the Arduino IDE Board Manager for ease of use. If you are unable to complete installation through this method, you can still install the library using the manual install method.

3.1. Installation through Arduino IDE Board Manager

The following steps will describe how to install the Spresense Arduino Library into the Arduino IDE using the Board Manager.

  1. Start Arduino IDE.

  2. Open the preferences in [File→Preferences].

    tutorial arduino open preferences
    Figure 1. Open preferences
  3. Copy and paste https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/generic/package_spresense_index.json into the field called Additional Boards Managers URLs:

    tutorial arduino preferences add bm url
    Figure 2. Copy this https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/generic/package_spresense_index.json URL and paste it into the Additional Boards Manager URLs field.
  4. Open the Boards Manager [Tools→Board→Boards Manager].

    tutorial arduino open boardmanager
    Figure 3. Open the Boards Manager.
  5. Search for Spresense. Once found in the list, select it and click install. If the package list fails to download, a possible reason is your network connection uses a proxy. To set the proxy, navigate to [File → Preferences → Network].

    The Spresense board package size is above 150 MB. Please be aware of the impact to your network usage limits and charges.
    tutorial arduino boardmanager spresense install
    Figure 4. Search for Spresense, select it and click install.
  6. The Spresense Arduino Library is now installed.

3.2. Manual installation

  1. Download the manual installation board package zip file manual-install-spresense-arduino-"OPERATING_SYSTEM"-latest.zip for your platform from:

  2. Follow the installation instructions for the respective PC platform:

  3. Start Arduino IDE.

  4. Open the preferences in [File→Preferences].

  5. In the Arduino IDE Preferences dialog box, set https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/generic/package_spresense_index.json in the field called Additional Boards Managers URLs: and close the dialog box. This is to prevent the Arduino Boards Manager UI from removing the Spresense board listing.

3.2.1. Install Spresense Arduino Library for Windows

The following steps assume you have installed WinZip on your PC.

Use "Expand All (T)" option if you are using Windows Explorer.
  1. If you have not started the Arduino IDE for the first time, start the application and close it. Check that a folder called %userprofile%/AppData/Local/Arduino15 exists.

  2. Right-click on the ZIP file, open the menu to select Extract> Extract to folder and navigate to %userprofile%/AppData/Local/.

  3. The board package is now installed.

3.2.2. Install Spresense Arduino Library for Linux

The following steps assume you have a 64-bit Ubuntu PC and you have stored the downloaded file manual-install-spresense-arduino-linux-latest.zip at ~/Downloads.

  1. If you have not started the Arduino IDE for the first time, start the application and close it. Check that a folder called ~/.arduino15/ exists.

  2. Open the terminal and navigate to the folder where you have stored manual-install-spresense-arduino-linux-latest.zip.

  3. Extract the contents to ~/Downloads.

    $ cd ~/Downloads
    $ unzip manual-install-spresense-arduino-linux-latest.zip
    $ rm -rf ~/.arduino15/packages/SPRESENSE
    $ cp -rfv ~/Downloads/Arduino15/* ~/.arduino15/
    $ rm -rf ~/Downloads/Arduino15
  4. The board package is now installed.

3.2.3. Install Spresense Arduino Library for Mac OS X

The following steps assume you have stored the downloaded file manual-install-spresense-arduino-macosx-latest.zip at ~/Downloads.

  1. If you have not started the Arduino IDE for the first time, start the application and close it. Check that a folder called ~/Library/Arduino15 exists.

  2. Open the terminal and navigate to the folder where you have stored manual-install-spresense-arduino-macosx-latest.zip.

  3. Extract the contents to ~/Library/.

    $ cd ~/Downloads
    $ unzip manual-install-spresense-arduino-macosx-latest.zip -d ~/Library/
  4. The board package is now installed.

4. Setting up the environment

4.1. Identify the serial port used by Spresense board

Connect your PC to the Spresense main board USB connector and check that the power LED turns on. The serial port driver may install at this point if it has not done so already.

spresense musb connect
Figure 5. Connection to the Spresense main board USB connector with power LED on

4.1.1. Windows

To find the serial COM port used by the Spresense board in Windows:
  1. Open the Device Manager.

  2. Expand Ports (COM & LPT), look for the Silicon Labs CP21x USB to UART Bridge device.

tutorial arduino windows device manager find port
Figure 6. Device Manager displays the serial COM port where COM9 is the COM port in this example

4.1.2. Linux

To find the serial COM port of the Spresense board in Ubuntu/Linux.

Open a terminal and type:

$ dmesg | grep "cp21.*attached"
[12220.625979] usb 1-1: cp210x converter now attached to ttyUSB0

In this example the COM port is ttyUSB0.

4.1.3. Mac OS X

To find the serial COM port of the Spresense board in Mac OS X.
  1. Open a terminal and type:

ls /dev/{tty,cu}.*
/dev/cu.SLAB_USBtoUART  /dev/tty.SLAB_USBtoUART

In this example the COM port is cu.SLAB_USBtoUART.

4.2. Install Bootloader

  1. Select the Spresense board in the [Tools→Boards→Spresense] menu.

    tutorial arduino board spresense
    Figure 7. Select the Spresense board
  2. Select the serial port used by Spresense from the menu [Tools→Port]. If there is more than one port see Identify the serial port used by Spresense board for more info.

    tutorial arduino select port
    Figure 8. Select port, this example shows how it looks like in Windows.
  3. If you are using the Spresense board for the first time, or if you are using an updated version of the Spresense Arduino Library, update the boot loader by selecting [Tools→Programmer→Spresense Firmware Updater].

    tutorial arduino select programmer
    Figure 9. Select correct programmer to be able to flash the firmware/boot loader.
  4. Then select [Tools→Programmer→Burn Bootloader].

    tutorial arduino burn bootloader
    Figure 10. Burn bootloader.
  5. Review and accept the EULA by following the dialog.

    tutorial arduino eula dialog
    Figure 11. Accept EULA to load the bootloader binaries.
  6. Once the upload completes, this is how it should look like:

    tutorial arduino fw upload done
    Figure 12. Burn bootloader.

4.3. Build your first sketch to verify installation

  1. You have now finished setting up the board. To verify the setup is correct, copy and paste the following example LED test code into a new sketch:

    void setup() {
        pinMode(LED0, OUTPUT);
        pinMode(LED1, OUTPUT);
        pinMode(LED2, OUTPUT);
        pinMode(LED3, OUTPUT);
    }
    
    void loop() {
        digitalWrite(LED0, HIGH);
        delay(100);
        digitalWrite(LED1, HIGH);
        delay(100);
        digitalWrite(LED2, HIGH);
        delay(100);
        digitalWrite(LED3, HIGH);
        delay(1000);
    
        digitalWrite(LED0, LOW);
        delay(100);
        digitalWrite(LED1, LOW);
        delay(100);
        digitalWrite(LED2, LOW);
        delay(100);
        digitalWrite(LED3, LOW);
        delay(1000);
    }
  2. Build and upload the LED test sketch by clicking Upload.

    tutorial arduino upload
    Figure 13. Click Upload.
  3. Wait for the upload to complete.

    tutorial arduino upload example sketch done
    Figure 14. Uploading finished without errors.
  4. Your sketch should run automatically. When the LEDs on the main board are flashing, congratulations! Your setup is now complete!

    • If the LEDs doesn’t flash, press the board reset button or open the serial monitor to start the sketch.

    • You may increase the baud rate to shorten the transfer/upload time. This may not always work depending on what hardware you use (PC, cables etc). A recommendation is to start at the default value and increase the baud rate to test if the transfer still works.

      tutorial arduino select baudrate
      Figure 15. This picture shows the highest possible baud rate. Not guaranteed to work on every setup.

5. Explore further!

Now that you have set up your development environment, you can proceed to run example sketches to explore the features on the board or head over to Spresense Arduino Library Developer Guide to read more.

Spresense specific examples are available from the Arduino IDE at File > Examples > Spresense and on spresense-sketches GitHub repository. You can also run example sketches that work with Arduino Uno though be aware of the hardware differences. Spresense Hardware comparison section contains details of these differences.

6. Spresense Arduino Sensing Library

6.1. Let’s try Step Counter on Spresense

6.1.1. An example sketch of Step Counter

The following are the requirements to run the Step Counter sketch.

In this sketch, a physical sensor client using the BMI160 library works with a logical sensor client using the AESM. The acceleration data obtained from BMI160 is input, the activity recognition is performed by using machine learning (AI), and the recognition result is output.

AESM is installed by Tools > Burn Bootloader on Arduino IDE menu. Please refer to Install Bootloader for details.

On the Arduino IDE, select File→ Examples → Sensing under "Examples for Spresense" → application → step_counter and open the example sketch.

arduino stepcounter menu1
arduino stepcounter menu2

Compile this sketch and upload it to the Spresense board.

When you open serial monitor, the pedometer and other information will be displayed in real time.

arduino stepcounter result
tempo

Number of steps per second [Hz]

stride

Stride [cm]
This is fixed value.

speed

Moving speed [m/s]

distance

Moving distance [m]
The option of calculating the distance by fusing GPS positioning data will be supported in the future.
The current released software does not use GPS data.

step

Number of steps

move-type

Activity recognition result (stopping, walking and running)

6.1.2. Try to change the physical sensor of Step Counter

Here, let’s change the physical sensor to another sensor.

  • Sensor board to ROHM’s SPRESENSE-SENSOR-EVK-701.

  • KX122 Arduino Library

    • How to install KX122 Arduino library

      1. Select Clone or download → Download ZIP on GitHub site and download a ZIP file.

      2. Extract the downloaded ZIP file into any folder.

      3. On Arduino IDE menu, open Sketch → Include Library → Add .ZIP Library…​ and select the KX122 folder from the extracted folder.

      4. If Library added to your libraries. is shown on Arduino IDE, the installation is successful.

How to change step_counter.ino is below.

  • Include library

    Change to inclue <KX122.h>.

    #include <BMI160Gen.h>

    to

    #include <Wire.h>
    #include <KX122.h>
    KX122 kx122(KX122_DEVICE_ADDRESS_1F);
  • setup() function

    Change to initialize KX122. The accel_rate is set to 50 Hz by default of KX122 library.

      /* Initialize device. */
    
      BMI160.begin(BMI160GenClass::I2C_MODE, i2c_addr);
    
      /* Set device setting */
    
      BMI160.setAccelerometerRange(accel_range);
      BMI160.setAccelerometerRate(accel_rate);

    to

      Wire.begin();
      kx122.init();
  • loop() function

    Change to get the acceleration data from KX122.

      float x;
      float y;
      float z;
    
      /* Read raw accelerometer measurements from BMI160 */
    
      BMI160.readAccelerometerScaled(x, y, z);
    
      AccelSensor.write_data(x, y, z);

    to

      float acc[3];
    
      /* Read raw accelerometer measurements from KX122 */
    
      kx122.get_val(acc);
    
      AccelSensor.write_data(acc[0], acc[1], acc[2]);

After applying the above modifications, you should be able to work the Step Counter with KX122.

6.1.3. Let’s try to create the unique logical sensor of Step Counter

If you want to implement your own Step Counter algorithm instead of Sony’s provided Step Counter algorithm, create a logic sensor client as follow.

Create a logical sensor class that inherits SensorClient .

For example, implement MyCounterClass in MyCounter.h. Include the header file as needed. For example, SensorClient.h is required, but sensing/logical_sensor/step_counter.h is necessary only if you want to use the StepCounter definition.

Also, as an example, the figure below shows the storage location of generally used code.

diag 99c0d03fa17e569de5628b57e9395653
Figure 16. Example of MyCounter code storage location

Above diagram is an example of Windows environment. The Arduino directory is ~/Arduino in Ubuntu environment and ~/Documents/Arduino in macOS environment.

class MyCounterClass : public SensorClient

Override the following methods of MyCounterClass on MyCounter.cpp .

bool begin(int id,
           uint32_t subscriptions,
           int      rate,
           int      sample_watermark_num,
           int      size_per_sample));

int publish(FAR void* data,
            uint32_t  size_per_sample,
            uint32_t  freq,
            uint32_t  sample_watermark_num,
            uint32_t  timestamp);

int subscribe(sensor_command_data_mh_t& data);
  • Implementation of begin() :

Set initial settings for MyCounter. It is necessary to register a callback function to receive published accelerometer data. The callback function calls MyCounter’s subscribe() and get the data.

Description example
unsigned char mycounter_cb(sensor_command_data_mh_t &data)
{
  return MyCounter.subscribe(data);
}

bool MyCounterClass::begin(int      id,
                           uint32_t subscriptions,
                           int      rate,
                           int      sample_watermark_num,
                           int      size_per_sample)
{
  return SensorClient::begin(id,
                             subscriptions,
                             rate,
                             sample_watermark_num,
                             size_per_sample,
                             mycounter_cb);
}
  • Implementation of subscribe() :

You can create your own Step Counter by subscribing to the accelerometer data and processing it with your own algorithm.

If you use AccelSensorClass provided by the library here, the data to be sent is 50 Hz, 50 samples, and it is the data of x, y, z axis aligned like st_accel_axis in the following. Call Subscribe() in the base class ( SensorClient ) to get this data.

Description example
int MyCounterClass::subscribe(sensor_command_data_mh_t& data)
{
  struct st_accel_axis
  {
    float x;
    float y;
    float z;
  } *accel_axis;

  accel_axis = static_cast<accel_axis*>(SensorClient::subscribe(data));
  uint32_t  timestamp = data.time;

  SensorResultStepCounter output;

  /*
    Implement your own algorithm and put a value in output.
   */

  publish(&output,
          sizeof(SensorResultStepCounter),
          1, /* 1Hz */
          1, /* 1sample */
          timestamp);
}
The subscribed data is sensor_command_data_mh_t . Please refer to here for this data structure.
  • Implementation of publish() :

publish() send the data calculated by MyCounter.
The StepCounterReader is provided as a sample of the reading application client, and if you use it as it is, the data structure to publish is

SensorResultStepCounter

As mentioned above, when passed in the form of SensorResultStepCounter , publish() of the base class ( SensorClient ) can be used as it is.

6.1.4. Let’s try to change the data according to your logic sensor

Of course, you may want to change the resulting sensor data to match your own logic sensor.

In that case, use your defined data type (e.g. MyStepCounterResult) in publish() of MyCounter class.

int MyCounterClass::subscribe(sensor_command_data_mh_t& data)
{
  ..(Omission)..

  MyStepCounterResult output;

  publish(&output,
          sizeof(MyStepCounterResult),
          1, /* 1Hz */
          1, /* 1sample */
          timestamp);
}

Please implement as follows in Application ( StepCountReaderClass ).

subscribe()
{
  MyStepCounterResult* steps = reinterpret_cast<MyStepCounterResult*>(ApplicationSensorClass.subscribe(data));
}

6.2. Let’s try to create new sensor client

6.2.1. Let’s try to create new physical sensor client

[T.B.D]

7. Spresense Arduino multi-core environment

This section describes the multi-core programming development environment using Arduino IDE.

In Arduino multi-core environments, please use the MultiCore MP library. The application CPU has total of 6 cores, consisting of 1 MainCore and 5 SubCore. In the normal single core application, the user programs only use MainCore. In the multi-core application environment described here, you can program all cores including SubCore.

MainCore

MainCore is always started at power on.

SubCore(s)

SubCore(s) are launched from MainCore. There are total of 5 SubCores.

In this tutorial, we show two examples with the MultiCore MP library.

Multicore Boot Example

Boot 4 SubCores and perform LED blinking using multicore.
By running this sample, you can understand the procedure to boot SubCore.

Multicore MessageHello Example

Communicate messages between MainCore and SubCore.
By running this sample, you can understand how to communicate between MainCore and SubCore.

7.1. Multicore Boot example

The main steps are:

  1. Open a sketch using Arduino IDE

  2. Select core

  3. Compile & upload

Repeat above for the number of cores you want to program.

Please follow the procedure as below.

  • Launch Arduino IDE from your desktop
    (If there is no icon on your desktop, please launch from the start menu etc.)

    arduino multicore desktop
    In multi-core programming, please note when you launch multiple Arduino IDE windows.
    If you open a new window with File→ New from the Arduino IDE menu, if you switch the menu of Core selection in one window, the setting is reflected to all the windows.
    As a workaround, when you open multiple Arduino IDE windows for every Core, please launch Arduino IDE from the icon on your desktop. Then, menu settings such as Core selection can be set independently for each window.
  • MainCore programming

    • Open a sketch from Arduino IDE menu File → Examples → MultiCore MP → Boot → Main.

      arduino multicore boot0
      arduino multicore boot1 main
    • Explanation for Main.ino sketch

      MP.begin(subid) boot 4 SubCores.

      arduino multicore boot4 main
    • Select MainCore from Arduino IDE menu Tools → Core → MainCore.

      arduino multicore boot2 main

      You can see that MainCore is selected in the status bar.

      arduino multicore boot3 main
      In Arduino IDE 1.8.9, there is an issue, the status bar is not displayed correctly after switching menu.
    • Press the Upload button to do Compile & Upload.

      arduino multicore boot5 main
      You cannot upload multiple core programs from multiple windows at the same time.
      Upload each core one by one so that the upload operation is not executed simultaneously.
    • Size of used memory is displayed on the log of compilation result.

      MainCore always uses 768 KByte of memory.

      arduino multicore boot6 main

      If Upload is successful, MainCore programming is completed.

      • As a test, try to open the serial monitor without SubCore program.
        Since there is no SubCore, you can see that MP.begin(1~4) returns error.

        arduino multicore boot7 serial err

        If the serial monitor is open, uploading from other windows may fail.
        Please close the serial monitor after this trial.

Then we will program the SubCore.

  • SubCore programming

    • Open a sketch from Arduino IDE menu File → Examples → MultiCore MP → Boot → Sub1.

      arduino multicore boot0
      arduino multicore boot1 sub1
    • Explanation for Sub1.ino sketch

      In setup(), by calling MP.begin(), notify MainCore that startup is complete.
      In loop(), output log by MPLog() and blink a LED.

      arduino multicore boot4 sub1
    • Select SubCore 1 from Arduino IDE menu Tools → Core → SubCore 1.

      arduino multicore boot2 sub1

      You can see that SubCore 1 is selected in the status bar.

      arduino multicore boot3 sub1
      In Arduino IDE 1.8.9, there is an issue, the status bar is not displayed correctly after switching menu.
    • Press the Upload button to do Compile & Upload.

      arduino multicore boot5 sub1
      You cannot upload multiple core programs from multiple windows at the same time.
      Upload each core one by one so that the upload operation is not executed simultaneously.
    • Size of used memory is displayed on the log of compilation result.

      You can see that this SubCore sample sketch uses 128 KBytes of memory.
      This size increases or decreases depending on the user program.

      arduino multicore boot6 sub1

      If Upload is successful, SubCore 1 programming is completed.

  • Follow the same procedure for SubCore 2, 3 and 4 and execute Compile & Upload.

    • Open Sub2 sketch, select SubCore 2, and Compile & Upload.

    • Open Sub3 sketch, select SubCore 3, and Compile & Upload.

    • Open Sub4 sketch, select SubCore 4, and Compile & Upload.

  • Operation check

    • Blink 4 LEDs on the Spresense main board.

    • Open the serial monitor, and you can see the log from each core.

      arduino multicore boot7 serial
  • Summary

    • We have learned how to boot SubCore using a simple example sketch.
      Add a call to MP.begin() when you port an existing sketch to multi-core environment.

    • The basic usage, such as Arduino IDE’s Compile & Upload method, is the same as usual in multi-core environments. The main difference is that a menu of core selections has been added in Tools→ Core.

7.2. Multicore MessageHello example

The main steps are the same as Multicore Boot example.
In this example, MainCore and SubCore(s) use a common sketch.

  1. Open a sketch using Arduino IDE (only once)

  2. Select core

  3. Compile & upload

Repeat above for the number of cores you want to program. This example runs all SubCores.

Please follow the procedure as below.

  • Launch Arduino IDE from your desktop
    (If there is no icon on your desktop, please launch from the start menu etc.)

    arduino multicore desktop
    In multi-core programming, please note when you launch multiple Arduino IDE windows.
    If you open a new window with File→ New from the Arduino IDE menu, if you switch the menu of Core selection in one window, the setting is reflected to all the windows.
    As a workaround, when you open multiple Arduino IDE windows for every Core, you always launch Arduino IDE from the icon on your desktop. By doing so, menu settings such as Core selection can be set independently for each window.
  • MainCore programming

    • Open a sketch from Arduino IDE menu File → Examples → MultiCore MP → Message → MessageHello.

      arduino multicore boot0
      arduino multicore hello1
    • Explanation for MessageHello.ino sketch

      We use #ifdef SUBCORE ~ #else ~ #endif to switch between MainCore and SubCore implementations in this sketch.

      • MainCore implementation

        In setup(), MP.begin(subid) boot 5 SubCores
        By calling MP.RecvTimeout(MP_RECV_POLLING), set polling in receiver mode. In this mode, when MP.Recv() is called, Recv() do polling with non-blocking.
        In loop(), MP.Recv() receives the packet address from each SubCore, and outputs the message in the packet.

        arduino multicore hello4 main
      • SubCore implementation

        In setup(), by calling MP.begin(), notify MainCore that startup is complete.
        In loop(), put "Hello" message into packet, and send the packet address by MP.Send().

        arduino multicore hello4 sub
    • Select MainCore from Arduino IDE menu Tools → Core → MainCore.

      arduino multicore hello2 main

      You can see that MainCore is selected in the status bar.

      arduino multicore boot3 main
      In Arduino IDE 1.8.9, there is an issue, the status bar is not displayed correctly after switching menu.
    • Press the Upload button to do Compile & Upload.

      arduino multicore hello5 main
      You cannot upload multiple core programs from multiple windows at the same time.
      Upload each core one by one so that the upload operation is not executed simultaneously.
    • Size of used memory is displayed on the log of compilation result.

      MainCore always uses 768 KByte of memory.

      arduino multicore boot6 main

      If Upload is successful, MainCore programming is completed.

Then we will program the SubCore.

  • SubCore programming

    • Select SubCore 1 from Arduino IDE menu Tools → Core → SubCore 1.

      arduino multicore hello2 sub1

      You can see that SubCore 1 is selected in the status bar.

      arduino multicore boot3 sub1
      In Arduino IDE 1.8.9, there is an issue, the status bar is not displayed correctly after switching menu.
    • Press the Upload button to do Compile & Upload.

      arduino multicore hello5 main
      You cannot upload multiple core programs from multiple windows at the same time.
      Upload each core one by one so that the upload operation is not executed simultaneously.
    • Size of used memory is displayed on the log of compilation result.

      You can see that this SubCore sample sketch uses 128 KBytes of memory.
      This size increases or decreases depending on the user program.

      arduino multicore boot6 sub1

      If Upload is successful, SubCore 1 programming is completed.

  • Follow the same procedure for SubCore 2, 3, 4 and 5 and execute Compile & Upload.

    • Select SubCore 2, and Compile & Upload.

    • Select SubCore 3, and Compile & Upload.

    • Select SubCore 4, and Compile & Upload.

  • Operation check

    • Open the serial monitor.

    • MainCore receives the message sent from each SubCore and outputs them to the serial monitor.

      arduino multicore hello7 serial
  • Summary

    • We have learned how to communicate between MainCore and SubCore.

    • It can communicate by sending the address of message because of the shared memory.

    • You can use a common sketch for multi-core programming.

7.3. Notices

  • See developer guide for the details of MultiCore MP library.

  • If you want to remove SubCore binaries on the Spresense board, please do Install Bootloader. When installing the loader, remove all SubCore binaries and then start installing the loader.

    arduino multicore remove subcore

    Note that SubCore does not run unless you call MP.begin() from MainCore. Therefore, there is no problem even if the old SubCore remains on your Spresense board.

  • If you open multiple Arduino IDE windows for every Core, please launch Arduino IDE from the icon on your desktop. Then, menu settings such as Core selection can be set independently for each window.

  • Use Arduino IDE to open multiple windows and select core is complicated, but you can use command line tools such as arduino-builder and arduino-cli. Also, you can upload the multiple binaries for all cores at once by using flash_writer tool. How to use the command line tools will be updated in this manual later.