LCD "no such device"

I have an ATTiny85 on a Sparkfun AVR Programmer and a 16x2 LCD with backpack connected. When I run I2C_scanner I get "Unknown error at address 0xnn" for every address it tests. The error is actually "RV_ENXIO=-4; no such device or address". I moved the LCD to Arduino Mega and it tested fine, address 0x27. Is there something I have overlooked? SCL > pin 7, SDA > pin 5 on Tiny. The first row of the LCD is lit up which indicates it's correctly wired.

Show us the sketch & circuit diagram.

What i2c library are you using? (Not all of them are ATTiny compatible)

I'm using hd44780
I have modified the 'standard' I2C_scanner sketch to using SoftwareSerial.

Wiring
USB-Serial cable:
White > tiny 4
Green > tiny 3
LCD:
Yellow (SCL) > tiny 2
Green (SDA) > tiny 0
and the rest is Vcc and GND.

    // I2C_scanner with Software Serial
    //
    // Version 6, November 27, 2015.
    //    Added waiting for the Leonardo serial communication.
    //
    // This sketch tests the standard 7-bit addresses
    // Devices with higher bit address might not be seen properly.
    //
     
    #include <Wire.h>
    #include <SoftwareSerial.h>
    #include <hd44780.h>
    #include <hd44780ioClass/hd44780_I2Cexp.h>
   
   const int Rx = 3;
   const int Tx = 4;
   
   SoftwareSerial SSerial(Rx, Tx);
   hd44780_I2Cexp LCD; // Auto locate & auto config expander chip
   int status;
   status = LCD.begin(16,2);  
    void setup()
    {
    pinMode(Rx, INPUT);
    pinMode(Tx, OUTPUT);
    SSerial.begin(9600);
    Wire.begin();
     
//      while (!Serial);             // Leonardo: wait for serial monitor
      SSerial.println("\nI2C Scanner");
    }
      
    void loop()
    {
      byte error, address;
      int nDevices;
     
      SSerial.println("Scanning...");
     
      nDevices = 0;
      for(address = 1; address < 127; address++ )
      {
        // The i2c_scanner uses the return value of
        // the Write.endTransmission to see if
        // a device did acknowledge to the address.
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
     
        if (error == 0)
        {
          SSerial.print("I2C device found at address 0x");
          if (address<16)
            Serial.print("0");
          SSerial.print(address,HEX);
          SSerial.println("  !");
     
          nDevices++;
        }
        else if (error==4)
        {
          SSerial.print("Unknown error at address 0x");
          if (address<16)
            SSerial.print("0");
          SSerial.println(address,HEX);
        }    
      }
      if (nDevices == 0)
        SSerial.println("No I2C devices found\n");
      else
        SSerial.println("done\n");
     
      delay(5000);           // wait 5 seconds for next scan
    }

Is Wire.h compatible with the ATTiny85?

GypsumFantastic:
Is Wire.h compatible with the ATTiny85?

It's part of ATTinyCore.

Maybe this can help you, to use with TinyWireM library

This sketch works with my tiny85 (ATTinyCore, 8MHz internal) and 16x2 I2C LCD. SCL > physical pin 7, SDA > physical pin 5 on Tiny.

#include <Wire.h>
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip


// LCD geometry
const int LCD_COLS = 16;
const int LCD_ROWS = 2;

void setup()
{
   lcd.begin(LCD_COLS, LCD_ROWS);
   lcd.print("Hello, World!");
}

void loop()
{
   static unsigned long timer = 0;
   unsigned long interval = 500;
   if (millis() - timer >= interval)
   {
      timer = millis();
      lcd.setCursor(0, 1);
      lcd.print("millis =        ");
      lcd.setCursor(8, 1);
      lcd.print(millis());
   }
}

groundFungus

When I run your sketch it uploads OK but nothing happens.
If I return to my sketch, it fails on LCD.begin(); with error "RV_ENXIO=-4; no such device or address" and after that nothing happens of course. I checked the wiring to the LCD. How can I troubleshoot this problem?

but nothing happens.

Not even the row(s) of boxes?

I've no idea what this means.

Not really. Google "avrdude: verification error; content mismatch" might give you some ideas.

What programmer are you using?

I connected a 20x4 and uploaded the code, modified for that LCD. It works fine.

groundFungus:
Not even the row(s) of boxes?

I burned the boot loader again. It still fails on LCD.begin but the first row (of 2) is lit up and the cursor blinks in 4th position. (I'm still concentrating on the 16x2 LCD.)

Not really. Google "avrdude: verification error; content mismatch" might give you some ideas.

No, it doesn't.

What programmer are you using?

Sparkfun AVR programmer

I connected a 20x4 and uploaded the code, modified for that LCD. It works fine.

There is something fundamentally wrong but I can't find it. I run the I2C_scanner sketch but I see on the Serial Monitor that it doesn't find any display at all. The display lights up the upper row but that's all. The display has a backpack wired SCL > PB2 and SDA > PB0 on the ATTiny85. The display is tested on my MEGA and is working fine. I'm running the Tiny at 8MHZ and I have burned the bootloader. I have two 4.7 kOhm pullup resistors Vcc-SCL and Vcc-SDA. I've run out of ideas. Any help much appreciated.

#include <TinyWireM.h>
#include <SoftwareSerial.h>

const int Rx = 3;
const int Tx = 4;

SoftwareSerial SSerial(Rx, Tx);

void setup()
{
  pinMode(Rx, INPUT);
  pinMode(Tx, OUTPUT);
  SSerial.begin(9600);
  TinyWireM.begin();

  while (!SSerial);             // Leonardo: wait for serial monitor
  delay(1000);
  SSerial.println("\nI2C Scanner");
}

void loop()
{
  byte error, address;
  int nDevices;

  SSerial.println("Scanning...");

  nDevices = 0;
  for (address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    TinyWireM.beginTransmission(address);
    error = TinyWireM.endTransmission();

    if (error == 0)
    {
      SSerial.print("I2C device found at address 0x");
      if (address < 16)
        SSerial.print("0");
      SSerial.print(address, HEX);
      SSerial.println("  !");
      nDevices++;
    }
    else if (error == 4)
    {
      SSerial.print("Unknown error at address 0x");
      if (address < 16)
        SSerial.print("0");
      SSerial.println(address, HEX);
    }
  }
  if (nDevices == 0)
    SSerial.println("No I2C devices found\n");
  else
    SSerial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

Since I don't know all of the details of your setup I went with my setup and the I2C scanner that I use (modified for software serial). My tiny85 is programmed with the ATTiny core by DrAzzy at 8MHz internal.

Here is the schematic of my setup.

Here is the scanner code:

// I2C scanner by Nick Gammon.  Thanks Nick.
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 4); // RX, TX
#include <Wire.h>

void setup()
{
   mySerial.begin (9600); //*****  make sure serial monitor baud matches *****
   mySerial.println ();
   mySerial.println ("I2C scanner. Scanning ...");
   byte count = 0;

   Wire.begin();
   for (byte i = 1; i < 120; i++)
   {
      Wire.beginTransmission (i);
      if (Wire.endTransmission () == 0)
      {
         mySerial.print ("Found address: ");
         mySerial.print (i, DEC);
         mySerial.print (" (0x");
         mySerial.print (i, HEX);
         mySerial.println (")");
         count++;
         delay (1);  // maybe unneeded?
      } // end of good response
   } // end of for loop
   mySerial.println ("Done.");
   mySerial.print ("Found ");
   mySerial.print (count, DEC);
   mySerial.println (" device(s).");
}  // end of setup

void loop() {}

And the scanner code output from serial monitor:

I2C scanner. Scanning ...
Found address: 39 (0x27)
Done.
Found 1 device(s).

Load the scanner code to the tiny85, open serial monitor (9600 baud) and reset the tiny85 to get the scanner output.

Since I don't know all of the details of your setup I went with my setup and the I2C scanner that I use (modified for software serial). My tiny85 is programmed with the ATTiny core by DrAzzy at 8MHz internal.

Will this code compile with MCUdude micro core also?

Will this code compile with MCUdude micro core also?

I do not know, having never used MicroCore. What happens when you try?