1
\$\begingroup\$

Im using an arduino uno to upload code via TPI to an Attiny10-TSHR on breadboard. Communicating with the chip works fine and uploading code but it never runs the code. By dumping the chip memory I can see that i has uploaded the code fine.

But when I upload some simple code to toggle PB0/PB1/PB2, disconnect MCU and restart nothing happens. I have tried all GPIO is with oscilloscope and multimeter. I use the same VCC/GND when running the program as when i program it.

It's like its stuck in some programming mode or something. Or the binary im uploading is bogus?

Anyone have any idea? This is the code im compiling with Atmel studio for attiny10.

#define F_CPU 12000000UL         /* 12MHz internal oscillator */

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
int i;

// PB0 and PB1 outputs
DDRB = (1<<PB0) | (1<<PB1);
// Timer0 in mode 14, fast PWM with ICR0 as top.
// Enable OC0A and OC0B, lower mode bits
TCCR0A = (1<<COM0A1) | (1<<COM0B1) | (1<<WGM01);
// Set top to 1000
ICR0 = 1000;
// Start timer with prescaler 1:8 and set upper mode bits
TCCR0B = (1<<CS01)  | (1<<WGM03) | (1<<WGM02);

while(1)
{
    for (i = 0; i <= 1000; i++)
    {
        OCR0A = i;
        OCR0B = 1000-i;
        _delay_ms(1);
    }
    for (i = 1000; i >= 0; i--)
    {
        OCR0A = i;
        OCR0B = 1000-i;
        _delay_ms(1);
    }
}
}

It outputs the binary;

:100000000AC011C010C00FC00EC00DC00CC00BC084
:100010000AC009C008C011271FBFCFE5D0E0DEBF6E
:10002000CDBF02D039C0ECCF43E041B942EA4EBD6A
:1000300048EE53E053BD42BD4AE14DBD68EE73E06A
:1000400040E050E057BD46BD862F972F841B950B8F
:1000500095BD84BD87EB9BE081509040E9F700C0DF
:1000600000004F5F5F4F493E93E0590759F748EE54
:1000700053E057BD46BD862F972F841B950B95BD2A
:1000800084BD87EB9BE081509040E9F700C0000001
:0C0090004150510B70F7D4CFF894FFCF13
:00000001FF

When I read the flash of the chip it returns;

**NVM lock**
3F00: FF FF
**configuration**
3F40: FF FF
**calibration**
3F80: 7B FF
**device ID**
3FC0: 1E 90 03 FF

**program**

4000: A0 0C 11 0C 01 0C F0 0C E0 0C D0 0C C0 0C B0 0C
4010: A0 0C 90 0C 80 0C 11 72 F1 FB FC 5E 0D 0E ED FB
4020: DC FB 20 0D 93 0C CE FC 34 0E 14 9B 24 AE E4 DB
4030: 84 EE 35 0E 35 DB 24 DB A4 1E D4 DB 86 EE 37 0E
4040: 04 0E 05 0E 75 DB 64 DB 68 F2 79 F2 48 B1 59 B0
4050: 59 DB 48 DB 78 BE B9 0E 18 05 09 04 9E 7F 00 0C
4060: 00 00 F4 F5 F5 F4 94 E3 39 0E 95 70 95 7F 84 EE
4070: 35 0E 75 DB 64 DB 68 F2 79 F2 48 B1 59 B0 59 DB
4080: 48 DB 78 BE B9 0E 18 05 09 04 9E 7F 00 0C 00 00
4090: 14 05 15 B0 07 7F 4D FC 8F 49 FF FC FF FF FF FF

I see that the printed hex from the chip is "inverted" A0 is 0A etc, is that how it's supposed to be presented?

I've spent about 10 hours on this problem now, ANY ideas would be highly appriciated..

Thanks

\$\endgroup\$
10
  • \$\begingroup\$ How are you programming it? How are you reading back the flash? \$\endgroup\$ Nov 14, 2020 at 14:03
  • \$\begingroup\$ With an Arduino Uno, wired and programmed according to this guide link \$\endgroup\$
    – Johan
    Nov 14, 2020 at 14:13
  • \$\begingroup\$ Does a Blinky program work? \$\endgroup\$ Nov 14, 2020 at 14:50
  • \$\begingroup\$ No it doesnt, all pins are dead regardless of my program. But perhaps its the program itself. I can't see how programming it would work and a blink sketch doesn't if it's hardware related. I have also tried with 3 different chips. Thanks for trying to help! \$\endgroup\$
    – Johan
    Nov 14, 2020 at 15:12
  • 1
    \$\begingroup\$ Thanks for the ideas guys. I have tried it now with the Atmel ICE programmer and it works. \$\endgroup\$
    – Johan
    Nov 21, 2020 at 7:26

1 Answer 1

1
\$\begingroup\$

I had the same problem but found an updated version of the code you linked to here and it worked great.

\$\endgroup\$
1
  • \$\begingroup\$ (Note to readers: Although answers that are only a link to elsewhere are usually not allowed on Stack Exchange (SE), this answer also gives first-hand knowledge that the original version of the TPI programming software had problems, while the linked version here worked. Also, the OP commented above that a different programmer also worked successfully (again indicating that the original version of TPI was the cause). Therefore this is not being treated as a link-only answer.) \$\endgroup\$
    – SamGibson
    May 31, 2022 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.