Skip to content

Nano sense 33 BLE BMI270 failing to start again with latest changes as of 4/12/25 #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mjs513 opened this issue Apr 13, 2025 · 5 comments

Comments

@mjs513
Copy link

mjs513 commented Apr 13, 2025

Rerunning BMI270 test sketches on the Sense is showing failing to start the BMI270 using the Sparkfun library so ran the Arduino BMI270-BMM150 library in debug mode.

Now getting the following error:

[00:00:08.562,713] �[1;31m<err> llext: Failed to allocate extension symbol table, ret -12�[0m
@pillo79
Copy link

pillo79 commented Apr 14, 2025

Unfortunately -12 is ENOMEM so it means the LLEXT_HEAP_SIZE was not big enough to load the sketch. Can you try varying that to see if it improves?

@mjs513
Copy link
Author

mjs513 commented Apr 14, 2025

Sorry didn't error didn't register yesterday - probably because GIGA stuff had me crazy.

Anyway changed llext_heap_size to 128 from 96 and that seems to have fixed it so that we don't get that error anymore. Now sure what happened that not the BMI270 isn;t working with the sparkfun lib. With the Arduino version it says started but not seeing any data so something is up. Have to dig but may wait to dig into the libraries.

You want a PR for the change?

@mjs513
Copy link
Author

mjs513 commented Apr 15, 2025

@pillo79 - @facchinm

Even after making the the BMI270 was failing to start as I mentioned. But found something interesting. After uploading the sketech I will get Device not found error. But if I re-burn the bootloader the sketch starts and runs correctly:

Image

Also works if I upload the sketch after I do a double of the reset button???

Of course if I power off and power on I get back to not finding the BMI270???? Unless I leave it off for 10 or more seconds - go figure!!!!!!

EDIT: Forgot to mention I am using the sparkfun BMI270 library.

@mjs513
Copy link
Author

mjs513 commented Apr 15, 2025

@pillo79 - @facchinm - @KurtE

Did finally get the Arduino_BMI270_BMM150 library working with Zephyr. But again strange things happen.

  1. When I first upload the sketch I loose the com port/serial monitor. To get it back I have to cycle power. This happens fairly consistently and the resultant data is off - all accel axes are off.
-0.50	-0.50	0.50
-0.50	-0.50	0.50
-0.50	-0.50	0.50

If I cycle power I will get good data"

0.01	0.01	0.99
0.01	0.01	0.99
0.01	0.01	0.99
  1. If the sketch loads and I don't loose the com port its hit or miss getting good data with out cycling power as mentioned above. Most of the time it takes several attempts at cycling power to get it working correctly. Most of the time you have to wait a couple of minutes.

Here is the modified library if you want to try.

Arduino_BMI270_BMM150.zip

Just using the accelerometer sketch to test with.

@mjs513
Copy link
Author

mjs513 commented Apr 16, 2025

Was experimenting a little more with this and begining to think there is some sort of memory issue.

While a basic sketch appears to work to get the IMU data after a power cycle - think the issue is the BMI270 since the BMM150 seems to always work and give good data.



#include "Arduino_BMI270_BMM150.h"
//#include <MadgwickAHRS.h>

//Madgwick filter;
unsigned long microsPerReading, microsPrevious;

void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 5000);

  Serial.println("Started");
  while (!IMU.begin()) {
    Serial.println("Failed to initialize IMU!");
    delay(1000);
  }

  Serial.println("SAMPLE RATES (HZ):"  );
  Serial.print("Accelerometer: ");  Serial.println(IMU.accelerationSampleRate());
  Serial.print("Gyroscope: ");      Serial.println(IMU.gyroscopeSampleRate());
  Serial.print("Magnetometer: ");   Serial.println(IMU.magneticFieldSampleRate());
  Serial.println("==================");
  Serial.println();

  // initialize variables to pace updates to correct rate
  microsPerReading = 1000000 / IMU.accelerationSampleRate();
  microsPrevious = micros();

}

void loop() {
  float ax, ay, az;
  float gx, gy, gz;
  float mx, my, mz;
  float roll, pitch, heading;
  unsigned long microsNow;

  // check if it's time to read data and update the filter
  microsNow = micros();
  if (microsNow - microsPrevious >= microsPerReading) {

    if (IMU.accelerationAvailable()) {
      IMU.readAcceleration(ax, ay, az);

      Serial.print("Accel (x, y, z):\t");
      Serial.print(ax);
      Serial.print('\t');
      Serial.print(ay);
      Serial.print('\t');
      Serial.println(az);
    }

    if (IMU.gyroscopeAvailable()) {
      IMU.readGyroscope(gx, gy, gz);
      Serial.print("Gyro (x, y, z):\t\t");

      Serial.print(gx);
      Serial.print('\t');
      Serial.print(gy);
      Serial.print('\t');
      Serial.println(gz);
    }

    if (IMU.magneticFieldAvailable()) {
      IMU.readMagneticField(mx, my, mz);
      Serial.print("Mag (x, y, z):\t\t");

      Serial.print(mx);
      Serial.print('\t');
      Serial.print(my);
      Serial.print('\t');
      Serial.println(mz);
    }
/*
    // update the filter, which computes orientation
    filter.update(gx, gy, gz, ax, ay, az, mx, my, mz);

    // print the heading, pitch and roll
    roll = filter.getRoll();
    pitch = filter.getPitch();
    heading = filter.getYaw();
    Serial.print("Orientation: ");
    Serial.print(heading);
    Serial.print(" ");
    Serial.print(pitch);
    Serial.print(" ");
    Serial.println(roll);
*/
    // increment previous time, so we keep proper pace
    microsPrevious = microsPrevious + microsPerReading;

    Serial.println("==================");

  }

}

Now if I try to add in the MadgwichAHRS library I loose serial (Com port). If I enter debug mode and I type sketch in the serial monitor nothing shows in either the Serial Monitor or on Serial1.

More fun.

EDIT: Using @KurtE;s trick of typing sketch in Serial1 found the issue is probably another item has to be added to llexte_exports.c. Have to add atan2f.

UPDATE: see Llext heap fix for nano33 and Fixes for LLEXT_EXPORTS.C #109
that resolves issues with atan2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants