-
Notifications
You must be signed in to change notification settings - Fork 23
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
Bus Invalid State sda=1, scl=0 #48
Comments
@gulbo Are you using this branch? It is outdated, I would recommend you use the Official repo at Arduino-ESP32. Try that version, if you still have problems I'll help. Chuck. |
@stickbreaker Hi, actually I tried them both. I ended up in this branch since I read something about the fact that the main repo provides a poor implementation of the wire library. But probably it was an old comment! Anyway, I tried |
@gulbo I think you are running into a timeout issue, the ESP32 with CPU clock speed above 80mhz only allows a 13.1ms I2C timeout, if the slave device stretches SCL (during sample conversion) longer than this period, the I2C hardware fails and aborts the communication sequence. You are going to have to review the datasheet for your sensor and use the polling method for sample acquisition instead of SCL stretching. I recommend you use the main branch of Arduino-Esp32 version v1.0.2. Chuck. |
@stickbreaker thank you, but now even if I run a simple i2c scanner, the result are 20 lines of |
Do you have pullups on SCL and SDA? 3.3k is what i recommend. Looks like the sensor needs a power cycle. |
@stickbreaker no I don't! Now I put 3k, is it ok? Should I disable the internal ones of esp32? The sensor has internal pullups of 2.2k also. |
I believe the sensor is getting locked up when the command sequences are aborted during an error. You could test the sensor using an UNO or Mega2560. I would say step back and write a simple test sketch that just configures it and reads it. Verify the sensor works, that you are not fighting a hardware error. Chuck. |
Ok I'll take an UNO. It will take a day or two. What about the pull-ups I told you? And the low-pass filter? Since I changed 3 sensors, and I ran always the same code, I belive it is something more software related! But who knows.... Thank you again!! |
Tried with UNO. |
you are using a voltage level convert with the Uno? The sensor is 3.3v only. I would use 3.3k pullups to 3.3v on each of the i2c pins (SCL,SDA). For Uno's I use AdaFruits 4-channel I2c. I put two more resistors on each channel, one on the 3.3v side 10k to 3.3v, and another 10k to 5v on the 5v side. This gives and effective resists of about 3k Chuck. |
No, without voltage converter! But actually I have always used this sensor with Arduino at 5V, and it has always worked! Also I tried with the two remaining sensors I have, and it works perfectly, with or without pullups. Ofc I just tried for few seconds, because I don't want them to go in the same state as the others... I have no idea at all... |
Hardware:
Board: DOIT Esp32 DevKit v1
Core Installation/update date: last release
IDE name: Platform.io
Flash Frequency: 40Mhz
Upload Speed: 115200
Description:
I'm working on a project to upload on a Google Sheet accelerations read by the MPU6050, connected with wifi. There are 2 taks, one to read accelerations (readData) and one to upload them using HTTP (postRequest). The problem is: everything works, until when this error occurs! At that point the accelerometer doesn't show up anymore even running a simple i2c scanner sketch. Dead. If I change accelerometer (did it 3 times), everything works again... This for 10mins, or 1 day maybe, but sooner or later the error returns. I attach also the hardware layout I am using. Am I burning accelerometers? Is it just a code problem? pls save me
![MVIMG_20190425_115932](https://user-images.githubusercontent.com/26251005/56727889-e8f6a180-6751-11e9-95e3-6c2a8564f8a2.jpg)
Sketch:
Debug Messages:
The text was updated successfully, but these errors were encountered: