You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may not be required before you even initialise the bus. Wire.end();
Just checked the library you were using, the mpu setup function accepts the I2C interface as the third argument. So, you should pass the TwoWire instance you created to that function.
Hey,
I tried doing the same as you. I can find the I2C address when scanning but can't get the I2C devices to initialize.
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include "MPU9250.h"
// -----------------I2C-----------------
#define I2C_SDA 14 // SDA Connected to GPIO 14
#define I2C_SCL 15 // SCL Connected to GPIO 15
TwoWire WIRE = TwoWire(0);
int flashPin = 4;
MPU9250 mpu;
void setup()
{
Serial.begin(115200);
while (!Serial)
;
Serial.println("Test");
Wire.end();
WIRE.begin(I2C_SDA, I2C_SCL, 100000);
// WIRE.begin(I2C_SDA, I2C_SCL, 50000);
delay(2000);
I am getting this error:
[ 2464][E][Wire.cpp:422] beginTransmission(): could not acquire lock
[ 2470][E][Wire.cpp:526] write(): NULL TX buffer pointer
[ 2475][E][Wire.cpp:448] endTransmission(): NULL TX buffer pointer
I2C ERROR CODE : 4
[ 2482][E][Wire.cpp:481] requestFrom(): NULL buffer pointer
Help greatly appreciated!
The text was updated successfully, but these errors were encountered: