jalway
November 10, 2022, 5:05am
1
Hello,
The goal is to control the Nicla Sense ME (acting as slave) via an Asset Tracker/Samd51 (acting as master) via the I2C bus.
I'm trying the example: "Control Nicla from an arduino board through eslov " seen on this page:
nicla-sense-me-fw
When I run it I don't see any data. I can see nothing in the Arduino IDE serial monitor (unless I plug both of the boards into a COM port).
These are the boards I have:
samd51
MicroMod Asset Tracker Carrier Board
Nicla Sense ME
I used the Arduino IDE 2.0.1 to compile and upload the programs to the boards.
I have the two boards connected by the qwiic connector from the Asset Tracker. The Asset Tracker/Samd51 are powered by a USB cable plugged into my computer. The Nicla Sense ME is powered by the qwiic connector from the Asset Tracker (I checked the connections for power/ground/SDA and SCL with my multimeter).
I compiled and uploaded the App.ino sketch to the Nicla Sense ME (using a COM port). Here is the code:
#include "Arduino.h"
#include "Arduino_BHY2.h"
// Set DEBUG to true in order to enable debug print
#define DEBUG false
void setup()
{
#if DEBUG
Serial.begin(115200);
BHY2.debug(Serial);
#endif
BHY2.begin(NICLA_I2C);
}
void loop()
{
// Update and then sleep
BHY2.update(100);
}
And I compiled and uploaded the accelerometer.ino code to the Asset Tracker board . Here is the code:
#include "Arduino.h"
#include "Arduino_BHY2Host.h"
SensorXYZ accel(SENSOR_ID_ACC);
void setup()
{
// debug port
Serial.begin(115200);
while(!Serial);
BHY2Host.begin();
accel.begin();
}
void loop()
{
static auto printTime = millis();
Serial.println("loop()");
BHY2Host.update();
if (millis() - printTime >= 1000) {
printTime = millis();
Serial.println(String("Acceleration values: ") + accel.toString());
}
}
Does anyone have any ideas on this? I'm fairly new to programming devices like this.
Thanks for any help.
Regards,
...John
In order to make all relevant information available to any who are interested in this subject, I'll share a link to the related discussion here:
opened 02:50AM - 10 Nov 22 UTC
Hello,
I have an issue here.
**The goal is to control the Nicla Sense ME (… acting as slave) via an Asset Tracker/Samd51 (acting as master) via the I2C bus.**
I'm trying your example: "**Control Nicla from an arduino board through eslov**" seen on this page:
[nicla-sense-me-fw](https://github.com/arduino/nicla-sense-me-fw#control-nicla-from-an-arduino-board-through-eslov)
When I run it I don't see any data. I can see nothing in the Arduino IDE serial monitor (unless I plug both of the boards into a COM port).
**These are the boards I have:**
[samd51](https://learn.sparkfun.com/tutorials/micromod-samd51-processor-board-hookup-guide/introduction)
[MicroMod Asset Tracker Carrier Board](https://learn.sparkfun.com/tutorials/micromod-asset-tracker-carrier-board-hookup-guide?_ga=2.54664363.1235648010.1665417122-521471151.1661097805)
[Nicla Sense ME](https://www.sparkfun.com/products/19727)
I used the **Arduino IDE 2.0.1** to compile and upload the programs to the boards.
I have the two boards connected by the **qwiic connector** from the Asset Tracker. The Asset Tracker/Samd51 are powered by a USB cable plugged into my computer. The Nicla Sense ME is powered by the qwiic connector from the Asset Tracker (I checked the connections for power/ground/SDA and SCL with my multimeter).
I compiled and uploaded the **App.ino** sketch to the Nicla Sense ME (using a COM port). Here is the code:
```
#include "Arduino.h"
#include "Arduino_BHY2.h"
// Set DEBUG to true in order to enable debug print
#define DEBUG false
void setup()
{
#if DEBUG
Serial.begin(115200);
BHY2.debug(Serial);
#endif
BHY2.begin(NICLA_I2C);
}
void loop()
{
// Update and then sleep
BHY2.update(100);
}
```
And I compiled and uploaded the **accelerometer.ino** code to the **Asset Tracker board**. Here is the code:
```
#include "Arduino.h"
#include "Arduino_BHY2Host.h"
SensorXYZ accel(SENSOR_ID_ACC);
void setup()
{
// debug port
Serial.begin(115200);
while(!Serial);
BHY2Host.begin();
accel.begin();
}
void loop()
{
static auto printTime = millis();
Serial.println("loop()");
BHY2Host.update();
if (millis() - printTime >= 1000) {
printTime = millis();
Serial.println(String("Acceleration values: ") + accel.toString());
}
}
```
Does anyone have any ideas on this? I'm fairly new to programming devices like this.
Thanks for any help.
Regards,
...John
1 Like
jalway
November 13, 2022, 12:14am
3
An update.
I found that when I had the Nicla Sense plugged into the COM port everything worked, i.e. I2C communicated. This is a mystery to me, because we want to power the Nicla Sense through the Asset Tracker's qwiic cable.