HELP!! ATtiny88 Everything was ok but now i can only program it, program does not execute.

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys,

 

I have a strange problem. I am developing on-board RC glow plug driver. Everything was ok till today. I have ordered prototype PVCs, soldered them and started to write the code. After about two weeks suddenly my board stopped to work. I can program it but nothings looks to work. I cant even lit a diode. Fuses are checked. Strange is that diodes should be ON on boot (they are connected to Vcc). But hey are dead. I have 3.45-350V on the pins.

 

I have made another board and it doesn't work as well.

 

Can anyone help please?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"3.45-350V on the pins."

 

There's the problem.

 

Seriously, if the boards worked at first, but you have been modifying the code, there is probably an issue with the code. Without more information, nobody will be able to give solid advice.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Need to post a schematic of the exact circuit you have built, and post a photo of the PCB.

 

Can you correctly read the Signature of the micro?

 

Have you programmed the Fuses?

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes I can, i have made second board. The board is (was actually)  ok as it was working for last 3 weeks. I can change fuses, read fuses, read and write eeprom and flash, but I cant do anything else :(. The code is now 2000 lines long. Strange is that the new pcb behaves exactly same way.  Of course, I wrote simple program to see what is going on. But nothing is happening. I was changing the clock and clock divider - and it is actually affecting the uC, as I had to slow down avrusb to program it again.

 

PS the second board was build from another brand new parts.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

" it was working for last 3 weeks"

 

"the new pcb behaves exactly same way."

 

Strong indicators that something in your code is wacky. 

 

But.

 

Have you tried exercising the board, but without connection to the glow plug?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was changing the clock and clock divider

Much more likely you bricked your micro.

 

Have a look at Cliff's tutorial on unbricking your micro and report back!

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have started to change the clock after. I can change it back, I can read and write micro. Strange is the voltage on the pins connected to LEDs (3.5V). for the second board I have used new micro and all new parts. Glow is not connected. I was writing the code using this board for last couple of week without any problems. I have bricked many micros in my life but usually I could not program them anymore. This ones I can. But it looks like the mirco is not executing any code. I have tried to change logical levels on another ports (a to measure it) but there are not changing their state. Of course now i use only very simple C program - it only changes ports, but unfortunatelly nothing happens.

Last Edited: Tue. Nov 24, 2015 - 12:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you certain you are actually uploading the new simple test program?  How are you sure?

 

Post your 'simple' test program, post the .lss or .hex, and also dump the flash to another .hex file and post it too.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#include <avr/io.h>
#include <util/delay.h>

volatile char str[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int main(void)
{

		DDRB |= 1 << PB0;
		DDRB |= 1 << PB1;

	    while(1) {

	    	PORTB =0x00;
	    	_delay_ms(500);
	    	PORTB =0xff;
	    	_delay_ms(500);

	    }

}

 

:1000000013C025C024C023C022C021C020C01FC0EF
:100010001EC01DC01CC01BC01AC019C018C017C00C
:1000200016C015C014C013C011241FBECFEFD2E0FC
:10003000DEBFCDBF11E0A0E0B1E0E4E8F0E002C037
:1000400005900D92A031B107D9F702D019C0D8CFD1
:10005000209A219A8FEF15B82FEF34E39CE02150BE
:1000600030409040E1F700C0000085B92FEF34E345
:100070009CE0215030409040E1F700C00000EBCF01
:04008000F894FFCF22
:10008400000102030405060708090A0B0C0D0E0FF4
:00000001FF

 

Before:

>>> d f
0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude>

After:

avrdude> d f 0 512
>>> d f 0 512
0000  13 c0 25 c0 24 c0 23 c0  22 c0 21 c0 20 c0 1f c0  |.└%└$└#└"└!└ └.└|
0010  1e c0 1d c0 1c c0 1b c0  1a c0 19 c0 18 c0 17 c0  |.└.└.└.└.└.└.└.└|
0020  16 c0 15 c0 14 c0 13 c0  11 24 1f be cf ef d2 e0  |.└.└.└.└.$.ż.´ĎÓ|
0030  de bf cd bf 11 e0 a0 e0  b1 e0 e4 e8 f0 e0 02 c0  |. ═ .ÓáÓ▒ÓńŔ­Ó.└|
0040  05 90 0d 92 a0 31 b1 07  d9 f7 02 d0 19 c0 d8 cf  |.É ĺá1▒..¸.đ.└ě.|
0050  20 9a 21 9a 8f ef 15 b8  2f ef 34 e3 9c e0 21 50  | Ü!ÜĆ´.Ş/´4ŃťÓ!P|
0060  30 40 90 40 e1 f7 00 c0  00 00 85 b9 2f ef 34 e3  |0@É@.¸.└...╣/´4Ń|
0070  9c e0 21 50 30 40 90 40  e1 f7 00 c0 00 00 eb cf  |ťÓ!P0@É@.¸.└..Ű.|
0080  f8 94 ff cf 00 01 02 03  04 05 06 07 08 09 0a 0b  |°ö...........   |
0090  0c 0d 0e 0f ff ff ff ff  ff ff ff ff ff ff ff ff  |  ..............|
00a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0100  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0110  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0120  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0130  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0150  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0160  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

The volatile string in the code is only to see if the known sequence of bytes is programmed into the micro.

 


tests.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         00000010  00800100  00000084  000000f8  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         00000084  00000000  00000000  00000074  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .stab         000006cc  00000000  00000000  00000108  2**2
                  CONTENTS, READONLY, DEBUGGING
  3 .stabstr      00000097  00000000  00000000  000007d4  2**0
                  CONTENTS, READONLY, DEBUGGING
  4 .comment      0000002f  00000000  00000000  0000086b  2**0
                  CONTENTS, READONLY

Disassembly of section .text:

00000000 <__vectors>:
   0:	13 c0       	rjmp	.+38     	; 0x28 <__ctors_end>
   2:	25 c0       	rjmp	.+74     	; 0x4e <__bad_interrupt>
   4:	24 c0       	rjmp	.+72     	; 0x4e <__bad_interrupt>
   6:	23 c0       	rjmp	.+70     	; 0x4e <__bad_interrupt>
   8:	22 c0       	rjmp	.+68     	; 0x4e <__bad_interrupt>
   a:	21 c0       	rjmp	.+66     	; 0x4e <__bad_interrupt>
   c:	20 c0       	rjmp	.+64     	; 0x4e <__bad_interrupt>
   e:	1f c0       	rjmp	.+62     	; 0x4e <__bad_interrupt>
  10:	1e c0       	rjmp	.+60     	; 0x4e <__bad_interrupt>
  12:	1d c0       	rjmp	.+58     	; 0x4e <__bad_interrupt>
  14:	1c c0       	rjmp	.+56     	; 0x4e <__bad_interrupt>
  16:	1b c0       	rjmp	.+54     	; 0x4e <__bad_interrupt>
  18:	1a c0       	rjmp	.+52     	; 0x4e <__bad_interrupt>
  1a:	19 c0       	rjmp	.+50     	; 0x4e <__bad_interrupt>
  1c:	18 c0       	rjmp	.+48     	; 0x4e <__bad_interrupt>
  1e:	17 c0       	rjmp	.+46     	; 0x4e <__bad_interrupt>
  20:	16 c0       	rjmp	.+44     	; 0x4e <__bad_interrupt>
  22:	15 c0       	rjmp	.+42     	; 0x4e <__bad_interrupt>
  24:	14 c0       	rjmp	.+40     	; 0x4e <__bad_interrupt>
  26:	13 c0       	rjmp	.+38     	; 0x4e <__bad_interrupt>

00000028 <__ctors_end>:
  28:	11 24       	eor	r1, r1
  2a:	1f be       	out	0x3f, r1	; 63
  2c:	cf ef       	ldi	r28, 0xFF	; 255
  2e:	d2 e0       	ldi	r29, 0x02	; 2
  30:	de bf       	out	0x3e, r29	; 62
  32:	cd bf       	out	0x3d, r28	; 61

00000034 <__do_copy_data>:
  34:	11 e0       	ldi	r17, 0x01	; 1
  36:	a0 e0       	ldi	r26, 0x00	; 0
  38:	b1 e0       	ldi	r27, 0x01	; 1
  3a:	e4 e8       	ldi	r30, 0x84	; 132
  3c:	f0 e0       	ldi	r31, 0x00	; 0
  3e:	02 c0       	rjmp	.+4      	; 0x44 <__SREG__+0x5>
  40:	05 90       	lpm	r0, Z+
  42:	0d 92       	st	X+, r0
  44:	a0 31       	cpi	r26, 0x10	; 16
  46:	b1 07       	cpc	r27, r17
  48:	d9 f7       	brne	.-10     	; 0x40 <__SREG__+0x1>
  4a:	02 d0       	rcall	.+4      	; 0x50 <main>
  4c:	19 c0       	rjmp	.+50     	; 0x80 <_exit>

0000004e <__bad_interrupt>:
  4e:	d8 cf       	rjmp	.-80     	; 0x0 <__vectors>

00000050 <main>:
  50:	20 9a       	sbi	0x04, 0	; 4
  52:	21 9a       	sbi	0x04, 1	; 4
  54:	8f ef       	ldi	r24, 0xFF	; 255
  56:	15 b8       	out	0x05, r1	; 5
  58:	2f ef       	ldi	r18, 0xFF	; 255
  5a:	34 e3       	ldi	r19, 0x34	; 52
  5c:	9c e0       	ldi	r25, 0x0C	; 12
  5e:	21 50       	subi	r18, 0x01	; 1
  60:	30 40       	sbci	r19, 0x00	; 0
  62:	90 40       	sbci	r25, 0x00	; 0
  64:	e1 f7       	brne	.-8      	; 0x5e <main+0xe>
  66:	00 c0       	rjmp	.+0      	; 0x68 <main+0x18>
  68:	00 00       	nop
  6a:	85 b9       	out	0x05, r24	; 5
  6c:	2f ef       	ldi	r18, 0xFF	; 255
  6e:	34 e3       	ldi	r19, 0x34	; 52
  70:	9c e0       	ldi	r25, 0x0C	; 12
  72:	21 50       	subi	r18, 0x01	; 1
  74:	30 40       	sbci	r19, 0x00	; 0
  76:	90 40       	sbci	r25, 0x00	; 0
  78:	e1 f7       	brne	.-8      	; 0x72 <main+0x22>
  7a:	00 c0       	rjmp	.+0      	; 0x7c <main+0x2c>
  7c:	00 00       	nop
  7e:	eb cf       	rjmp	.-42     	; 0x56 <main+0x6>

00000080 <_exit>:
  80:	f8 94       	cli

00000082 <__stop_program>:
  82:	ff cf       	rjmp	.-2      	; 0x82 <__stop_program>

 

Last Edited: Tue. Nov 24, 2015 - 08:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Micro is working. So it is another problem.

 

Will try to figure out where the problem is.

 

I tried to write EEPROM from the program and it works

 

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


void EEPROM_write(uint8_t addr, uint8_t value) {
	while(EECR & (1 << EEPE)) ;   			//wait for write enable bit to clear
	EECR &= ~((1 << EEPM1) | (1 << EEPM0)); // "atomic" write (erase & write in one operation)
	EEARL = addr;                           // set the address
	EEDR = value;							// set value to be written
	EECR |= (1 << EEMPE);						// set EEPROM Master Write Enable
	EECR |= (1 << EEPE);						// set EEPROM Master Write Enable
}

volatile char str[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int main(void)
{
		uint8_t  ind;


		DDRB |= 1 << PB0;
		DDRB |= 1 << PB1;

		for(ind = 0; ind < 16; ind++) {
			EEPROM_write(ind,ind);
		}

	    while(1) {

	    	PORTB =0x00;
	    	_delay_ms(500);
	    	PORTB =0xff;
	    	_delay_ms(500);

	    }

}
avrdude> d ee
>>> d ee
0000  00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f  |.........     ..|
0010  10 11 12 13 14 15 16 17  18 19 1a 1b 1c 1d 1e 1f  |................|
0020  20 21 22 23 24 25 26 27  28 29 2a 2b 2c 2d 2e 2f  | !"#$%&'()*+,-./|
0030  30 31 32 33 34 35 36 37  38 39 3a 3b 3c 3d 3e 3f  |0123456789:;<=>?|

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

It has started to work without any changes in the code and with no hardware changes.

 

Miracle.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what about the reset pin, is that at correct level, (perhaps your programmer hold it).

perhaps BOD has been set to higher than you batt. level. (or very close).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:

what about the reset pin, is that at correct level, (perhaps your programmer hold it).

perhaps BOD has been set to higher than you batt. level. (or very close).

 

BOD is disabled.

 

Reset pin works fine. Everything works fine now.

 

Probably I had a bad day yesterday.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It 's just nice to know why it didn't work yesterday!!!

So you don't have the same problem tomorrow :)

What did you do different (I don't need to know you do).
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:

It 's just nice to know why it didn't work yesterday!!!

So you don't have the same problem tomorrow :)

What did you do different (I don't need to know you do).
 

 

That is the most interesting question :)

 

I have left it in the evening and started to test again in the morning.

 

The only difference is that I have started to change EEPROM just to see if the micro is working (as I could not change LEDs), and I needed to see if something is changing during the program execution.