Giter Club home page Giter Club logo

Comments (36)

mjs513 avatar mjs513 commented on June 22, 2024

Hi Kris,

Reopened since the new ESP32 core seems to be conflicting with the board. Its opened as Issue #342 on the ESP32 GitHub site. Not sure if you are seeing this same problem.

Mike

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Hi Kris,

Think this is now fixed, at least with the latest changes on GitHub. But I am running into another problem, not sure if it is associated with the bootloader. I press the boot button and press and then release the reset button. Everything seems to upload no errors. But when I press and release the rst button again to put in run mode the sketch doesn't seem to run. Tested it on my sketch, then the blink sketch with ledpin on 5 and a couple of others

Any idea?

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Did you choose 4 MByte flash, DOUT for flashing?

Thanks for reminding me about this. They added your board to dropdown list of boards in boards managed. So I went back in and checked to see the setup for the board. 4MB was correct, but it was set at DIO. I changed it DOUT and it reset into run mode and the blink sketch started working. Will give the other sketches a try to make sure they work and will let you know. I will post an issue on the esp32 GitHub so they get it fixed once I check it all out.

Thanks

_UPDATE (10:34pm EST):
Ok here we go.

  1. I ran the blink sketch and worked fine after I hit the rst button.
  2. I ran the i2cscanner.ino file that Paul S. put together. I hit rst before I opened the terminal window, but when I opened the terminal window nothing I had to hit rst to get anything out. Opening and closing after that had the sketching output fine.
  3. I used your MPU-9250 breakout board and the scanner identified 0x68 and 0x76 (accel/gyro and pressure sensor) but not the magnetometer.
  4. I loaded up your MPU9250_MS5637 sketch for the ESP32 and ran it. Had to hit rst after I opened the terminal window to get it to run. After I did that the whoami tests failed but it did identify the same i2c addresses (this worked in the past of course no problem). Here is a dump of the terminal window:
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DOUT, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:11392
entry 0x40078a9c
Scanning...
I2C device found at address 0x68  !
I2C device found at address 0x76  !
done

MPU9250 9-axis motion sensor...
MPU9250 I AM FF I should be 71
Could not connect to MPU9250: 0xFF

Something is wrong but I am at a loss. I did measure the voltage on GPIO0 (SDA) and it was at 3.29v on my multimeter. Tried recycling power, hitting reset, redid the wiring. Everything is being powered off of the USB. The only thing I haven't tried is swapping the cable but it worked fine on the T3.5 tests. Any recommendations would be appreciated.

UPDATE:12/19/17
I attached a different 9250 breakout board from Diymall and same thing happened. I decided to test with a different i2c device - Adafruit BME280 - it worked fine, no issue. I have to set up a 5v supply for the 9250 just in case its a power issue.

No joy on the power - same thing is happening when I separately power the sensor.

Mike_

Note: I did test the MS5637 separately and it works fine. I2c scanner recognizes the 9250, but whoami fails. Also, if I bypass the whoami test the magnetometer is recognized as well as the pressure sensor. Accel and gyro shows zero.

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Hi Kris,

I am beginning to think that the issue is with I2C with the ESP32 Core. I extracted and ran the following code on a T3.5 and it worked fine. It identified the WhoIAm correctly. Same code on the ESP32 board failed WhoIAm test. I did a little digging and it is almost reminiscent of Issue #90 that you opened up on the Arduino-ESP32 core library. There was another issue with I2C but it was fixed - espressif/arduino-esp32#834

#include "Wire.h"   

#define MPU9250_ADDRESS 0x68  // Device address when ADO = 0
#define WHO_AM_I_MPU9250 0x75 // Should return 0x71


void setup() 
{
  Serial.begin(115200);
  delay(4000);

  Wire.begin(400000); //(SDA, SCL) (21,22) are default on ESP32, 400 kHz I2C clock
  delay(1000);

  // Set up the interrupt pin, its set as active high, push-pull
  pinMode(5, OUTPUT);
  digitalWrite(5, LOW);

  I2Cscan();// look for I2C devices on the bus
  delay(1000);

  // Read the WHO_AM_I register, this is a good test of communication
  Serial.println("MPU9250 9-axis motion sensor...");
  uint8_t c = readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250);  // Read WHO_AM_I register for MPU-9250
  Serial.print("MPU9250 "); Serial.print("I AM "); Serial.print(c, HEX); Serial.print(" I should be "); Serial.println(0x71, HEX);
  
}

void loop() {
  // put your main code here, to run repeatedly:

}

// simple function to scan for I2C devices on the bus
void I2Cscan() 
{
    // scan for i2c devices
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
}

  uint8_t readByte(uint8_t address, uint8_t subAddress)
{
  uint8_t data = 0;                        // `data` will store the register data   
  Wire.beginTransmission(address);         // Initialize the Tx buffer
  Wire.write(subAddress);                  // Put slave register address in Tx buffer
  Wire.endTransmission(false);             // Send the Tx buffer, but send a restart to keep connection alive
  Wire.requestFrom(address, 1);  // Read two bytes from slave register address on MPU9250 
  data = Wire.read();                      // Fill Rx buffer with result
  return data;                             // Return data read from slave register
}

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

I did that when I ran it on the ESP32. The code I posted was the T3.5 version. Sorry, should have been clearer.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Yep. Just changed the board to the esp32 dev board so I could change the core debug level and here is the error for reading the whoiam register:

MPU9250 9-axis motion sensor...
[W][esp32-hal-i2c.c:235] i2cWrite(): Ack Error! Addr: 68
[W][esp32-hal-i2c.c:334] i2cRead(): Ack Error! Addr: 68
MPU9250 I AM FF I should be 71

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

I am using a git pull from a few days ago but didn't see anything in the new commits that would affect I2C.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Just as a FYI I just tested the BNO055 and that appears to work as well as the BME280. As for the pull - was looking for the link to latest release but for reason couldn't find it so I used the latest core pull.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

For your board no pullups (thought there were onboard 4.7k's), on the DIYMALL 9250 board there are 4.7k pullups on the sda/scl lines already. Both are behaving exactly the same.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Tried both boards with a T3.5 and they worked - along with a couple different versions of a 9250 library. That's one of the first thing I tried. Going to add 4.7k's to your board and see what happens I have the mini version and it looks like I am suppose to solder the back side to activate the 4.7k's?

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

You may want to check this issue out: espressif/arduino-esp32#834

Maybe makes more sense to you.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Yeah, I know I saw you issue #90 for the ESP32. It looks like they changed the wire API about a month or so ago to try and resolve more issues, but looks like broke it at least for the 9250 or 6050 (will have to test it later). Think I read in the thread that they are saying that those boards are special cases :( - yeah I know. Think I should go ahead and generate an issue for them :)

Have to dig up my old version of the core - think I have it on a hard drive somewhere.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Ok. Dug out my old copy from around Feb of this year works fine for the 9250.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Planning on it. Was just waiting to here your opinion. :)

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Ok here is the issue I posted, if you want to add for it: espressif/arduino-esp32#937

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Hope me-no-dev works this. He seems to have a good handle on what's going on.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Think I isolated to when the problem started - it was when they incorporated the commit for long I2C reads. I posted what I found so maybe that is a starting point for them.

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

See issue 90 for problem and how to fix it. Have to read 2 bytes. Was your original issue back in Dec 2016.

Merry christmas.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Kris. From what I can see it was fixed until they added support for long i2c addressimg. On a hunch I went ahead and tried the two byte read in issue 90 and it worked. There long addressing broke it. Now it's up to them to fix it I guess. Just wanted to let you know.

from esp32.

kriswiner avatar kriswiner commented on June 22, 2024

from esp32.

mjs513 avatar mjs513 commented on June 22, 2024

Yes I did in the same issue that I opened up. I referenced issue 90 (even gave them the link) and mentioned that me-no-dev fixed it. They will get around to it eventually. Think they are working on a new i2c/wire wrapper - me-no-dev is involved with that one.

Can't wait for the ble support for the Arduino library. Like you said still immature in a lot of respects. Can't blame them - there's a lot there.

from esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.