Comments (5)
Well... You cannot mix brzo_i2c
and the wire
library! This will never work was never intended to work. Also note that brzo_i2c
is not designed as a drop-in replacement for the wire
library, it uses a different approach with the notion of i2c transactions.
Thus, please have a look at
- the wiki to learn about i2c transactions,
- some examples for a couple of sensors,
- on how to migrate from
wire
library tobrzo_i2c
from brzo_i2c.
Could you please give some more details about the issue? Maybe some code? Are you on the native or Arduino toolchain? etc... thanks
from brzo_i2c.
on Arduino toolchain.
issue #1: when using gpis_init() before the brzo code, brzo will not work.
issue #2: when using brzo_i2c_setup the entire i2c bus is locked/blocked by the native Arduino Wire.cpp
Atm I have the problem that once I use brzo_i2c_setup(SDA,SCL) all further i2c communication using the Wire.read(), Wire.write() etc. is blocked.
If I have gpis_init() before brzo_i2c_setup() brzo i2c functions (read/write) won't work anymore.
This is on wemos d1 lite and wemos d1 mini R2.
do the i2c_scan() before brzo_i2c_setup(SDA,SCL) and after.
i2c_scan();
brzo_i2c_setup(SDA,SCL);
i2c_scan();
first there will be some devices and after the i2c_setup there won't be any.
This must have something todo with putting the pin to OPEN_DRAIN and the brzo_i2c_reset_bus().
Im wondering on how I could revert back the chip so the Arduino function will work again until I call
brzo_i2c_setup() again?
bool i2c_scan()
{
bool found = false;
Wire.begin();
for (uint8_t n=8; n < 120; n++)
{
Wire.beginTransmission(n);
byte error = Wire.endTransmission();
/* got device or error */
if (error == 0)
{
Serial.print("I2C device found at address ");
Serial.println(n, HEX);
found = true;
}
}
Serial.println(found);
return found;
}
found will always be false.
Can I provide more info?
from brzo_i2c.
ok! understood. I was able to mix broth libraries by setting up using brzo_i2c_setup(), do the transaction and releasing the bus with release_i2c_brzo().
Unfortunately there are too many libraries that use Wire
library so I cannot completely migrate to brzo. However, I like your work at a lot and thus prefer to mix it.
inline void release_i2c_brzo()
{
uint16_t sda_bitmask = (uint16_t)(1 << SDA);
uint16_t scl_bitmask = (uint16_t)(1 << SCL);
int32_t a_set, a_temp1;
asm volatile (
"MOVI %[r_set], 0x60000304;"
"MOVI.N %[r_temp1], 30;"
"S16I %[r_scl_bitmask], %[r_set], 4;"
"MEMW;"
"S16I %[r_sda_bitmask], %[r_set], 4;"
"l_ksh_%=:"
"addi %[r_temp1], %[r_temp1], -1;"
"NOP;"
"BNEZ %[r_temp1], l_ksh_%=;"
: [r_set] "+r" (a_set), [r_temp1] "+r" (a_temp1)
: [r_sda_bitmask] "r" (sda_bitmask), [r_scl_bitmask] "r" (scl_bitmask)
: "memory"
);
}
from brzo_i2c.
OK, thanks for the clarification. Thus, I will close this issue then.
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
- 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.