No text on OLED 128x64 from ATTiny85

Some good news.
The ‘SDA and SCL are low’ is still there but I also tested with one of the ‘new’ Tinys and it worked too.

Suddenly today when trying to upload I get an upload error again. Is there a way to get more information on the error? Can I set verbose on the upload? How and where do I do it?

> Executing task in folder I2C_scanner: C:\Users\hans\.platformio\penv\Scripts\platformio.exe run --target upload <

Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny85.html
PLATFORM: Atmel AVR (3.2.0) > Generic ATtiny85
HARDWARE: ATTINY85 8MHz, 512B RAM, 8KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr-attiny 1.3.2
 - tool-avrdude 1.60300.200527 (6.3.0)
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SoftI2CMaster> 2.1.3
|-- <SoftwareSerial> 1.0
Building in release mode
Checking size .pio\build\attiny85\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  54.7% (used 280 bytes from 512 bytes)
Flash: [=====     ]  45.8% (used 3756 bytes from 8192 bytes)
Configuring upload protocol...
AVAILABLE: usbtiny
CURRENT: upload_protocol = usbtiny
Looking for upload port...
Uploading .pio\build\attiny85\firmware.hex

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

*** [upload] Error 1
================================== [FAILED] Took 4.03 seconds ==================================
The terminal process "C:\Users\hans\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

That’s saying the programmer tried to program the chip (by sending SPI commands in this case) and heard nothing back.

You can add

upload_flags =  -vvvv

in the platformio.ini to add more verbosity to AVRdude, that’s even better than what would happen with the project task “Advanved → Verbose Upload”.

Yes, that is more information but difficult to understand.

Uploading .pio\build\attiny85\firmware.hex

avrdude: Version 6.3, compiled on Sep 12 2016 at 17:24:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\hans\.platformio\packages\tool-avrdude\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f     
         AVR Part                      : ATtiny85
         Chip Erase delay              : 400000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled    
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack    
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff    
                                  Block Poll               Page                       Polled    
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack    
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff    
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack    
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled    
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00    
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack    
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack    
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00    
                                  Block Poll               Page                       Polled    
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00    

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

*** [upload] Error 1
================================= [FAILED] Took 12.56 seconds ================================= 
The terminal process "C:\Users\hans\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

The USBtinyISP is found, but the chip is not responding.

Either the chip is dead or it is inserted in some wrong way, or something else has gone wrong.

Is the ATTiny disconnected from everything else in the circuit but the programmer?

Other possibility: Haunted setup. :smiley:

Disconnected everything from the circuit and still failed. Tried a second Tiny - failed. Tried a third Tiny - success. It looks like I’ve bricked two Tinys. I found AVRdudeSS and wanted to read the fuses in the Tinys to compare. I was warned not write anything and I didn’t. I only tried to read the fuses and not being sure about the parameters I emailed Zak Kemble and got some help but I never got it working. I don’t think I could have ruined the Tiny but who am I to know.
BTW, the upload flags you gave me
upload_flags =
-U
lfuse:w:0xE2:m
-U
hfuse:w:0x5F:m
-U
efuse:w:0xFF:m
-U
lock:w:0xFF:m

are they to be used just once and then taken out? Do the fuse values stick until you set them to something else?

This is not good o_o. But I also don’t know what it could be. I’ve had zero issues with the ATTiny85 on my Digispark Mini (that’s what they seem to call it nowadays) regarding that yet.

Maybe the clock settings are still wrong for avrdude and it’s programming it faster than it can handle. Maybe Attiny85 usbasp programming - works on Arduino IDE, fails on PlatformIO - #12 by marcosjl31 is still valid. Can you try one of your bricked ATTinys with the addition of those upload_flags?

You may also try higher values for -B, see HELP!!! | USBtinyISP | Adafruit Learning System

Those upload flags gives an error:

upload_flags =
   -U
   lfuse:w:0xE2:m
   -U
   hfuse:w:0x5F:m
   -U
   efuse:w:0xFF:m
   -U
   lock:w:0xFF:m
   -vvvv
   -Pusb -B5

avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\.\libusb0-0001–0x1781-0x0c9f
avrdude: Error: Invalid -P value: ‘usb -B5’
Use -P usb:bus:device

Must be in separate newlines.

Also -Pusb might actually be optional.

I tested the simple sketch again and it fails too on upload so I think I need a few more Tinys.

#include <Arduino.h>

void setup() 
{ 
  Serial.begin(9600); 
}

void loop() 
{ 
  Serial.println("Test"); delay(500); 
}

When you use the Arduino IDE with the GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8 and choose USBtinyasp as your programmer, is it also not possible to upload via “Upload using programmer”?

OK, i made a High Voltage Programmer PCB and tested three suspected TTiny85s and they were all good. I resumed my test with the I2C_Scanner sketch with one OLED display wired up and I get a lot of garbled output on serial monitor. I’ve set monitor speed to 9600 in the source and in platformio.ini.
I measured the voltages and GND-SCL = 3.8V, GND-SDA = 2.1V. If I remove the display I get GND-SCL = 5V, GND-SDA = 2V. I use 4.7kΩ pullups.
I removed the SCL and SDA wires from the Sparkfun programmer and measured voltages and SCL-GND = 1.4V and SDA-GND = 4.8V. Is that a clue?

Using ATTinyCore, programmer USBTinyISP and “uploading using programmer” the sketch now uploads and runs fine.

1 Like

While still trying to get the I2C_Scanner sketch to work I changed pullup resistors to 2.7kΩ and voltages change a bit: SCL-GND 4.1V and GND-SDA 2.3V but there was no improvement. What recommended voltages are looking for on the SCL and SDA pins? This is the output on the serial monitor.

They must be pulled up to the supply voltage. If they’re not, something is either driving them low or the resists are not working correctly.

It’s either reading noise, or at the wrong baud rate, which might again indicate a wrong fuse setting for crystal / clock frequency

OK, I replaced the OLED with a 16x2 display and now the SCL-GND=5V and SDA-GND=2V. The display lights up during upload and it looks promising but another error came up. I have now added a 10kΩ resistor Vcc - Reset.

    avrdude: 3670 bytes of flash written
avrdude: verifying flash memory against .pio\build\attiny85\firmware.hex:
avrdude: load data flash data from input file .pio\build\attiny85\firmware.hex:
avrdude: input file .pio\build\attiny85\firmware.hex contains 3670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 7.43s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x4a
avrdude: verification error; content mismatch

avrdude: safemode: lfuse changed! Was 62, and is now 0

Try adding -e to the upload_flags of the platformio.ini for an erase.

The upload_flag took care of the error. The SCA-GND voltage is now 5V but SDA-GND is 2.18V so I tried with a 1.5kΩ resistor on PB0 and raised it to 2.6V. If I disconnect the SDA & SCL wires and measure voltages on PB0 and PB2 I get 1.4V and 1.8V. I don’t know if that is normal or not. How can I test the Sparkfun Programmer for faults?

maxgerhardt
I sent a question to Sparkfun through their support page explaining the problems I have with the voltage levels and this is what they said:

AVR Tiny Programmer is only intended to program an ATtiny, it can’t act as a development board after programming. The reason it won’t work is the circuitry on the programmer will interfere with any attached device that’s not an ATtiny.
If you remove your chip from the programmer it should function as programmed though.

So I’m using the programmer in a way it wasn’t intended for. It makes sense, or …?

Well makes sense to me, I didn’t take into account what other circuitry you have on the programmer. Probably explains why it’s working so painlessly for me and Digistump ATTiny85 board, it gets programmed via only two USB lines (D+, D-) and I don’t use those pins for display or UART so they’re all free.