Giter VIP home page Giter VIP logo

Comments (4)

pasko-zh avatar pasko-zh commented on July 4, 2024

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.

igagis avatar igagis commented on July 4, 2024

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.

pasko-zh avatar pasko-zh commented on July 4, 2024

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.

igagis avatar igagis commented on July 4, 2024

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)

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.