ATtiny167 with I2C character LCD?

I am trying to compile some code for a tiny167, specifically the “Hello world” sketch from this library: https://github.com/marcoschwartz/LiquidCrystal_I2C

According to the ATTinyCore Github page, the TinyWireM library must be used. I tried it, but to no avail.

The code fails to compile, giving me this output (I removed the non-error stuff because this post was too long):

Arduino: 1.6.12 (Linux), Board: "ATtiny87/167 (No bootloader), Disabled, ATtiny167, 8 MHz (internal), B.O.D. Disabled, New style (down each side)"

In file included from /home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/cores/tiny/Arduino.h:165:0,
                 from /tmp/arduino_build_350492/sketch/HelloWorld_t167.ino.cpp:1:
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:65:0: warning: "PIN_A3" redefined
 #define PIN_A3  ( 4)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:64:0: note: this is the location of the previous definition
 #define PIN_A3  ( 3)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:66:0: warning: "PIN_A3" redefined
 #define PIN_A3  ( 5)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:65:0: note: this is the location of the previous definition
 #define PIN_A3  ( 4)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:67:0: warning: "PIN_A3" redefined
 #define PIN_A3  ( 6)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:66:0: note: this is the location of the previous definition
 #define PIN_A3  ( 5)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:68:0: warning: "PIN_A3" redefined
 #define PIN_A3  ( 7)
 ^
/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New/pins_arduino.h:67:0: note: this is the location of the previous definition
 #define PIN_A3  ( 6)
 ^
Compiling libraries...
Compiling library "TinyWireM"
Using previously compiled file: /tmp/arduino_build_350492/libraries/TinyWireM/TinyWireM.cpp.o
"/home/henry/Desktop/arduino-1.6.12/hardware/tools/avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD  -mmcu=attiny167 -DF_CPU=8000000L -DARDUINO=10612 -DARDUINO_AVR_ATTINYX7 -DARDUINO_ARCH_AVR   "-I/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/cores/tiny" "-I/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/variants/tinyX7_New" "-I/home/henry/Arduino/libraries/TinyWireM" "-I/home/henry/Arduino/libraries/LiquidCrystal_I2C" "-I/home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/libraries/Wire" "/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp" -o "/tmp/arduino_build_350492/libraries/TinyWireM/USI_TWI_Master.cpp.o"
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp: In function 'void USI_TWI_Master_Initialise()':
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:48:3: error: 'PORT_USI' was not declared in this scope
   PORT_USI |= (1<<PIN_USI_SDA);           // Enable pullup on SDA, to set high as released state.

   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:48:19: error: 'PIN_USI_SDA' was not declared in this scope
   PORT_USI |= (1<<PIN_USI_SDA);           // Enable pullup on SDA, to set high as released state.

                   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:49:19: error: 'PIN_USI_SCL' was not declared in this scope
   PORT_USI |= (1<<PIN_USI_SCL);           // Enable pullup on SCL, to set high as released state.

                   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:51:3: error: 'DDR_USI' was not declared in this scope
   DDR_USI  |= (1<<PIN_USI_SCL);           // Enable SCL as output.

   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp: In function 'unsigned char USI_TWI_Start_Transceiver_With_Data(unsigned char*, unsigned char)':
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:196:7: error: 'PORT_USI' was not declared in this scope
       PORT_USI &= ~(1<<PIN_USI_SCL);                // Pull SCL LOW.

       ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:196:24: error: 'PIN_USI_SCL' was not declared in this scope
       PORT_USI &= ~(1<<PIN_USI_SCL);                // Pull SCL LOW.

                        ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:201:7: error: 'DDR_USI' was not declared in this scope
       DDR_USI  &= ~(1<<PIN_USI_SDA);                // Enable SDA as input.

       ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:201:24: error: 'PIN_USI_SDA' was not declared in this scope
       DDR_USI  &= ~(1<<PIN_USI_SDA);                // Enable SDA as input.

                        ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:234:7: error: 'DDR_USI' was not declared in this scope
       DDR_USI   &= ~(1<<PIN_USI_SDA);               // Enable SDA as input.

       ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:234:25: error: 'PIN_USI_SDA' was not declared in this scope
       DDR_USI   &= ~(1<<PIN_USI_SDA);               // Enable SDA as input.

                         ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp: In function 'unsigned char USI_TWI_Master_Transfer(unsigned char)':
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:273:14: error: 'PIN_USI' was not declared in this scope
     while( !(PIN_USI & (1<<PIN_USI_SCL)) );// Wait for SCL to go high.

              ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:273:28: error: 'PIN_USI_SCL' was not declared in this scope
     while( !(PIN_USI & (1<<PIN_USI_SCL)) );// Wait for SCL to go high.

                            ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:281:3: error: 'DDR_USI' was not declared in this scope
   DDR_USI |= (1<<PIN_USI_SDA);             // Enable SDA as output.

   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:281:18: error: 'PIN_USI_SDA' was not declared in this scope
   DDR_USI |= (1<<PIN_USI_SDA);             // Enable SDA as output.

                  ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp: In function 'unsigned char USI_TWI_Master_Start()':
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:291:3: error: 'PORT_USI' was not declared in this scope
   PORT_USI |= (1<<PIN_USI_SCL);                     // Release SCL.

   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:291:19: error: 'PIN_USI_SCL' was not declared in this scope
   PORT_USI |= (1<<PIN_USI_SCL);                     // Release SCL.

                   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:296:20: error: 'PIN_USI_SDA' was not declared in this scope
   PORT_USI &= ~(1<<PIN_USI_SDA);                    // Force SDA LOW.

                    ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp: In function 'unsigned char USI_TWI_Master_Stop()':
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:316:3: error: 'PORT_USI' was not declared in this scope
   PORT_USI &= ~(1<<PIN_USI_SDA);           // Pull SDA low.

   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:316:20: error: 'PIN_USI_SDA' was not declared in this scope
   PORT_USI &= ~(1<<PIN_USI_SDA);           // Pull SDA low.

                    ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:317:19: error: 'PIN_USI_SCL' was not declared in this scope
   PORT_USI |= (1<<PIN_USI_SCL);            // Release SCL.

                   ^
/home/henry/Arduino/libraries/TinyWireM/USI_TWI_Master.cpp:318:12: error: 'PIN_USI' was not declared in this scope
   while( !(PIN_USI & (1<<PIN_USI_SCL)) );  // Wait for SCL to go high.  

            ^
Using library TinyWireM at version 1.0.0 in folder: /home/henry/Arduino/libraries/TinyWireM 
Using library LiquidCrystal_I2C at version 1.1.2 in folder: /home/henry/Arduino/libraries/LiquidCrystal_I2C 
Using library Wire at version 1.0 in folder: /home/henry/.arduino15/packages/ATTinyCore/hardware/avr/1.1.2/libraries/Wire 
exit status 1
Error compiling for board ATtiny87/167 (No bootloader).

FWIW, the modified sketch is attached.

HelloWorld_t167.ino (630 Bytes)

Thank you - you've found a bug in my core. These sorts of issues aren't very surprising on the less-popular tiny series like the x7.

I've created issues for this, you can follow that issue to be notified when a fix is available in the github version. I just need to do the leg work of looking up what those defines should be. I'm going to a concert tonight so I probably won't be able to get a fix in until saturday or sunday.

https://github.com/SpenceKonde/ATTinyCore/issues/93 (defines required for USI missing)

https://github.com/SpenceKonde/ATTinyCore/issues/92 (warnings about redefinition - easy fix)

Hm, actually, it's a bug in the version of TinyWireM you're using. Issue created for solving it in the version I maintain. Should have it sorted this weekend in any case.

https://github.com/SpenceKonde/TinyWireM/issues/1