Comments (4)
Well, we have three different levels: The Adafruit Library and the underlaying wire Library and last but not least the i2c communication of the sensor. So, debugging means understanding all three of those levels. I had very quick look at the Adafruit Library and the spec of the bosch sensor and then your modified parts. It's hard to tell what is going wrong, especially since I don't have the sensor, so I cannot check i2c timings with the scope.
I will have a further look at it, probably next week.
ps: When "migrating" from wire Library to brzo_i2c, I would start with having a look at the i2c communication of the sensor and not the actual calls to the wire Library. So, some of the sensors need clock stretching, burst read or .... So, it is this combination of i2c read/writes and the timing which is the crucial thing.
from brzo_i2c.
Hmmm, without the i2c device it is hard to tell where the problem is...
The only thing I could think of: According to the datasheet, section 6.2.1 the i2c master should send: START, Slave address, register address, register data, STOP. Now, in your code you are writing register and register data seperately, i.e. with two brzo_i2c_write
calls. The first call brzo_i2c_write(i2c_buffer, 1, false);
will send a STOP at the end. So, the i2c device "sees" this as the end of a write transaction, cf. figure 9 in the datasheet. So, I would combine the writes and thus avoiding the STOP between register address and register data.
I would do brzo_i2c_write(i2c_buffer, 2, false)
from brzo_i2c.
Thank you for your answer, brzo_i2c_write(i2c_buffer, 2, false)
did the trick.
I assumed the STOP is sent when transmission is closed :(
from brzo_i2c.
@jlohmoeller : I've added a wiki section on "How to migrate from Wire Library", see here
from brzo_i2c.
Related Issues (20)
- I2C stucks after clock stretching time exceeds HOT 25
- Question: Logic Levels and ... HOT 2
- Cannot compile for Heltec Wifi Kit 32 HOT 3
- INA219 HOT 8
- Multiple I2C HOT 2
- gpio_init() will cause I2C bus busy (code: 1) HOT 5
- Migrating ADS1015 from Wire HOT 5
- AM2320 sensor not found HOT 11
- I2C bus handle for multiple instances posibility HOT 1
- Support speeds < 100KHz HOT 2
- after 1 slave fails others stop working HOT 4
- Have you thought about a i2c slave implementation. HOT 2
- Novice obsession HOT 2
- GCC 10 compilation issue with Arduino HOT 5
- SDA set before SCL while preparing STOP in brzo_i2c_read() HOT 7
- MEMW not always present
- Clock stretch logic
- Arduino IDE compile error with new ESP8266 core 3.0.0 HOT 30
- SCL cock stretching HOT 3
- Platformio installation instructions confusing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brzo_i2c.