arduino/ArduinoCore-mbed

4.2.2 Causes Nicla ME to crash when receiving input over I2C

kdinev-IEC opened this issue · 0 comments

Description

I have the bare-bones configuration with Nicla ME and Portenta H7. Running the "App.ino" example from BHY2 library on Nicla ME and "Temperature.ino" example from BHY2Host library on Portenta H7. Connected as a shield configuration.

When using the latest version of the mbed core (4.2.2), whenever the Nicla receives any data over I2C, mbed crashes with the following msg:

Error Log

++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x20005284, Not allowed in ISR context
Location: 0x1C0A3
Error Value: 0x20005284
Current Thread: I2CSlave Id: 0x20009EA8 Entry: 0x49E31 StackSize: 0x800 StackMem: 0x20009EF0 SP: 0x2000A35C 
For more info, visit: https://mbed.com/s/error?error=0x80010133&tgt=NICLA
 -- MbedOS Error Info --

Fix

This error does not appear when using version 4.2.1, and everything works fine.

Source Code

Portenta H7:

#include "Arduino.h"
#include "Arduino_BHY2Host.h"

Sensor temp(SENSOR_ID_TEMP);

void setup()
{
  Serial.begin(115200);
  while(!Serial);

  BHY2Host.begin(false, NICLA_AS_SHIELD);
  temp.begin();
}

void loop()
{
  static auto printTime = millis();
  BHY2Host.update();

  if (millis() - printTime >= 1000) {
    printTime = millis();
    Serial.println(String("Temperature: ") + String(temp.value(), 3));
  }
}

Nicle ME:

#include "Arduino_BHY2.h"

void setup()
{
  BHY2.begin(NICLA_I2C, NICLA_AS_SHIELD);
}

void loop()
{
  // Update and then sleep
  BHY2.update(100);
}