Communicating to SAMD mcu on MKR WiFi 1010

naylom
Posts: 1
Joined: Fri Jan 21, 2022 12:11 pm

Communicating to SAMD mcu on MKR WiFi 1010

Postby naylom » Fri Jan 21, 2022 12:33 pm

I am using an Arduino MKR WiFi 1010 which has a SAMD based mcu and an included ESP32 as part of the u-blox Nina subsystem.

Arduino has a standard with an ArduinoBLE library, however I need to use Bluetooth classic in order to communciate with a legacy application. I have been able to program the ESP32 to use bluetooth classic by uploading the following code using the Arduino IDE (ver 1.8.13) configured to use the ESP Dev board.

//This example code is in the Public Domain (or CC0 licensed, at your option.)
//By Evandro Copercini - 2018
//
//This example creates a bridge between Serial and Classical Bluetooth (SPP)
//and also demonstrate that SerialBT have the same functionalities of a normal Serial

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

BluetoothSerial SerialBT;

void setup() {
Serial.begin(115200);
SerialBT.begin("My MKR WiFi 1010"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
}

void loop()
{

if (Serial2.available())
{
SerialBT.write(Serial2.read());
}

if (SerialBT.available())
{
Serial.write(SerialBT.read());
}
delay(20);
}

This works fine but is using the Arduino serial port (via usb) to receive data to be sent over Bluetooth and equally is outputing data received over Bluetooth back over the same Serial port. What I need to do is send any data received over Bluetooth to code running on the arduino MKR SAMD mcu (and equally send data from here to the ESP code for forwarding over teh Bluetooth connection).

I wish to send data from ESP32 to arduino code running on the SAMD mcu of the MKR WiFi 1010. I am using the arduino IDE v 1.8.13 to program both the Arduino MKR and the ESP32.

From an Arduino MKR perspective I have found examples of code that uses SerialNina library to send data to the ESP32 however I cannot work out how the ESP32 code reads that data or indeed how it sends data back. If anyone has any pointers on how the ESP32 and SAMD chip are connected when on the MKR WiFI 1010 board and how they communicate data back and forth it would appreeciated.

Who is online

Users browsing this forum: No registered users and 105 guests