Skip to content
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

Portenta H7 Lite: BMI270 library causes a BUS FAULT on Wire Ports #72

Open
mjs513 opened this issue Feb 10, 2025 · 0 comments
Open

Portenta H7 Lite: BMI270 library causes a BUS FAULT on Wire Ports #72

mjs513 opened this issue Feb 10, 2025 · 0 comments

Comments

@mjs513
Copy link

mjs513 commented Feb 10, 2025

Describe the bug
While testing the I2c (Wire, wire1 and wire2) found that the bosch api libraries for the BMI270 and BMM150 result in a Bus Fault Error. However when testing with a MPU9250 it works on with out issue under Zephyr.

NOTE: if I run the same skech/library(sparkfun) under Mbed it runs without issue.

Target board + cli verbose compilation output
Full verbose compilation output, ideally with arduino-cli invocation or from IDE 2.3.3+
Issues without the full verbose output will be discarded as invalid.

dfu-util 0.11-arduino4

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
Device ID 2341:035b
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading element to address = 0x08040000, size = 288828

Erase   	[                         ]   0%            0 bytes
Erase   	[                         ]   0%            0 bytes
Erase   	[=                        ]   4%        12288 bytes
Erase   	[==                       ]   8%        24576 bytes
Erase   	[===                      ]  12%        36864 bytes
Erase   	[====                     ]  17%        49152 bytes
Erase   	[=====                    ]  21%        61440 bytes
Erase   	[======                   ]  24%        69632 bytes
Erase   	[=======                  ]  28%        81920 bytes
Erase   	[========                 ]  32%        94208 bytes
Erase   	[=========                ]  36%       106496 bytes
Erase   	[==========               ]  41%       118784 bytes
Erase   	[===========              ]  45%       131072 bytes
Erase   	[============             ]  48%       139264 bytes
Erase   	[=============            ]  52%       151552 bytes
Erase   	[==============           ]  56%       163840 bytes
Erase   	[===============          ]  60%       176128 bytes
Erase   	[================         ]  65%       188416 bytes
Erase   	[=================        ]  68%       196608 bytes
Erase   	[==================       ]  72%       208896 bytes
Erase   	[===================      ]  76%       221184 bytes
Erase   	[====================     ]  80%       233472 bytes
Erase   	[=====================    ]  85%       245760 bytes
Erase   	[======================   ]  89%       258048 bytes
Erase   	[======================   ]  90%       262144 bytes
Erase   	[=======================  ]  92%       266240 bytes
Erase   	[======================== ]  96%       278528 bytes
Erase   	[=========================] 100%       288828 bytes
Erase    done.

Download	[                         ]   0%            0 bytes
Download	[                         ]   2%         8192 bytes
Download	[=                        ]   4%        12288 bytes
Download	[==                       ]   8%        24576 bytes
Download	[===                      ]  12%        36864 bytes
Download	[====                     ]  17%        49152 bytes
Download	[=====                    ]  21%        61440 bytes
Download	[======                   ]  24%        69632 bytes
Download	[=======                  ]  28%        81920 bytes
Download	[========                 ]  32%        94208 bytes
Download	[=========                ]  36%       106496 bytes
Download	[==========               ]  41%       118784 bytes
Download	[===========              ]  45%       131072 bytes
Download	[============             ]  48%       139264 bytes
Download	[=============            ]  52%       151552 bytes
Download	[==============           ]  56%       163840 bytes
Download	[===============          ]  60%       176128 bytes
Download	[================         ]  65%       188416 bytes
Download	[=================        ]  68%       196608 bytes
Download	[==================       ]  72%       208896 bytes
Download	[===================      ]  76%       221184 bytes
Download	[====================     ]  80%       233472 bytes
Download	[=====================    ]  85%       245760 bytes
Download	[======================   ]  89%       258048 bytes
Download	[=======================  ]  92%       266240 bytes
Download	[======================== ]  96%       278528 bytes
Download	[=========================] 100%       288828 bytes
Download done.
File downloaded successfully
Submitting leave request...
Transitioning to dfuMANIFEST state

Output of Serial Monitor

  1. If you have an USB-to-Serial adapter, paste the complete output of the console crash, starting from
*** Booting Zephyr OS build v3.7.0-8126-g33bc8a018ecc ***
[00:00:00.573,000] <err> os: ***** BUS FAULT *****
[00:00:00.580,000] <err> os:   Precise data bus error
[00:00:00.588,000] <err> os:   BFAR Address: 0x258a554a
[00:00:00.596,000] <err> os: r0/a1:  0x24025500  r1/a2:  0x258a5548  r2/a3:  0x00000001
[00:00:00.607,000] <err> os: r3/a4:  0x00003fff r12/ip:  0x00000014 r14/lr:  0x0806b111
[00:00:00.618,000] <err> os:  xpsr:  0x81003800
[00:00:00.625,000] <err> os: s[ 0]:  0x0000000c  s[ 1]:  0x0806b235  s[ 2]:  0x00010000  s[ 3]:  0x24001514
[00:00:00.638,000] <err> os: s[ 4]:  0x24025500  s[ 5]:  0x00010000  s[ 6]:  0x00000010  s[ 7]:  0x00000000
[00:00:00.650,000] <err> os: s[ 8]:  0x24001528  s[ 9]:  0x0806b509  s[10]:  0x00000000  s[11]:  0x00000000
[00:00:00.663,000] <err> os: s[12]:  0x24001514  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000010
[00:00:00.676,000] <err> os: fpscr:  0x00010000
[00:00:00.683,000] <err> os: Faulting instruction address (r15/pc): 0x0806b0ec
[00:00:00.693,000] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:00:00.703,000] <err> os: Current thread: 0x24003200 (main)
[00:00:00.712,000] <err> os: Halting system
.```
2. If you don't, compile the sketch in `Debug` mode (see *Troubleshooting section* in README) and paste the output after invoking `sketch` command
In debug mode see no output on serial or uart2

**Output of readelf**
NA since its a bus fault

**Optional: attach the elf file**

[Example01_BasicReadingsI2C.ino.zip](https://github.com/user-attachments/files/18734482/Example01_BasicReadingsI2C.ino.zip)

**Optional: attach the sketch**

#include <Wire.h>
#include "SparkFun_BMI270_Arduino_Library.h"

// Create a new sensor object
BMI270 imu;

// I2C address selection
uint8_t i2cAddress = BMI2_I2C_PRIM_ADDR; // 0x68
//uint8_t i2cAddress = BMI2_I2C_SEC_ADDR; // 0x69

void setup()
{
// Start serial
Serial.begin(115200);
Serial.println("BMI270 Example 1 - Basic Readings I2C");

// Initialize the I2C library
Wire.begin();
Wire.setClock(400000);
// Check if sensor is connected and initialize
// Address is optional (defaults to 0x68)
while(imu.beginI2C(BMI2_I2C_PRIM_ADDR, Wire) != BMI2_OK)
{
    // Not connected, inform user
    Serial.println("Error: BMI270 not connected, check wiring and I2C address!");

    // Wait a bit to see if connection is established
    delay(1000);
}

Serial.println("BMI270 connected!");

}

void loop()
{
// Get measurements from the sensor. This must be called before accessing
// the sensor data, otherwise it will never update
imu.getSensorData();

// Print acceleration data
Serial.print("Acceleration in g's");
Serial.print("\t");
Serial.print("X: ");
Serial.print(imu.data.accelX, 3);
Serial.print("\t");
Serial.print("Y: ");
Serial.print(imu.data.accelY, 3);
Serial.print("\t");
Serial.print("Z: ");
Serial.print(imu.data.accelZ, 3);

Serial.print("\t");

// Print rotation data
Serial.print("Rotation in deg/sec");
Serial.print("\t");
Serial.print("X: ");
Serial.print(imu.data.gyroX, 3);
Serial.print("\t");
Serial.print("Y: ");
Serial.print(imu.data.gyroY, 3);
Serial.print("\t");
Serial.print("Z: ");
Serial.println(imu.data.gyroZ, 3);

delay(20);

}


**Additional context**
Add any other context about the problem here.
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

1 participant