Comments (4)
You wrote
But, if I disconnect 1 of the slaves, all 3 stop working.
So you don't do a "hot disconnect", i.e. while your esp is running, right?
Furthermore, I understood you do first a "find all the slaves being present on the bus" and then "communicate with the present ones", right?
And if understood correctly, the first part fails, right? If so, could you please post your code of this first phase?
from brzo_i2c.
Yes, it is not hot-disconnect. I turn everything off then disconnect, then turn on.
And I don't search for devices on the bus, I just know the addresses and try to send/receive data to/from those addresses. And if one send/recieve fails, then all subsequent fail as well.
But now I'm not sure if the problem is exactly like this, I need to experiment more. Because right now I encountered another problem. If I try to do several subsequent send operations from master to slave then second one fails for some reason and third one succeeds, fourth fails and so on. The failure reported by brzo is "bus not free", i.e. it fails in the very beginning of the operation when checking for free bus.
I'm working on 400 kHz.
One of the slave devices on i2c bus is AVR microcontroller (atmega8), coded by me. Problem can be also if I coded something wrong there, as using its hardware TWI is not obvious.
I also marked all brzo functions as ICACHE_FLASH_ATTR
because I had problems with fitting it to iram
. Can that cause this kind of problems?
from brzo_i2c.
What other i2c slaves are you using?
Maybe one of the slaves does not free the bus fast enough? And then following i2c commands fail?
I also marked all brzo functions as ICACHE_FLASH_ATTR because I had problems with fitting it to iram. Can that cause this kind of problems?
This is most likely not the source of your issues. The esp8266 uses some sort of instruction "caching" . So, when it has to move some instructions out of iram
and load others into it, then you encounter some delays. And since it's a software-based i2c implementation this means some stretching of SDA or SCL signals, cf. my issue here.
And since the goal of brzo_i2c
is to offer i2c timing as precisely as possible, I moved all instructions into iram
to remove such stretchings.
from brzo_i2c.
Maybe one of the slaves does not free the bus fast enough?
Yes, looks like you were right. My ATmega8 slave running on 8MHz does not release line fast enough. I added 1ms delay after each communication with it and all works fine now!
Thanks for help!
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
- 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.