Open starrobin34 opened 3 weeks ago
@starrobin34
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.
bool setup(const uint8_t addr, const MPU9250Setting& mpu_setting = MPU9250Setting(), WireType& w = Wire)
{
...
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
include
include
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!