Giter Club home page Giter Club logo

Comments (2)

greiman avatar greiman commented on May 18, 2024

I don't have a pro micro. I ran your example on a Leonardo for 20 minutes with no problem.

Your display may be very sensitive to timing of signals on the I2C bus. I suspect there are many USB interrupts with the ATmega32U4.

AvrI2c does not disable interrupts while doing I2C operations. Wire handles transfers in an ISR with interrupts disabled.

AvrI2c uses 400 kHz I2c by default. You could try 100 kHz by editing this line in SSD1306Ascii.h and set AVRI2C_FASTMODE TO zero.

/** AvrI2c uses 400 kHz fast mode if AVRI2C_FASTMODE is nonzero else 100 kHz. */
#define AVRI2C_FASTMODE 1

Another possibility is to disable interrupts during I2C writes by adding noInterrupts() and interrupts() to the write function in SSD1306AsciiAvrI2c.h like this.

  void writeDisplay(uint8_t b, uint8_t mode) {
    noInterrupts(); // Disable interrupts  <<--ADD
    if ((m_nData && mode == SSD1306_MODE_CMD)) {
      m_i2c.stop();
      m_nData = 0;
    }
    if (m_nData == 0) {
      m_i2c.start((m_i2cAddr << 1) | I2C_WRITE);
      m_i2c.write(mode == SSD1306_MODE_CMD ? 0X00 : 0X40);
    }
    m_i2c.write(b);
    if (mode == SSD1306_MODE_RAM_BUF) {
      m_nData++;
    } else {
      m_i2c.stop();
      m_nData = 0;
    }
    interrupts();  // Enable Interrupts  <<-- ADD
  }

from ssd1306ascii.

harperrc avatar harperrc commented on May 18, 2024

thanks so much for this turning off fast mode fixed the issue i have been chasing for a week.

from ssd1306ascii.

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.