Pages: 1 ... 4 5 [6] 7 8 ... 14   Go Down
Author Topic: SoftwareSerial with ATTiny84 using ATtiny library  (Read 38873 times)
0 Members and 1 Guest are viewing this topic.
Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Bad news:

I have killed my poor little Attiny13, I think it was during fiddling with the fuses. It is totally unresponsive, I tried my USBasp and Pololu programmer but no luck.
I will report back as soon as my new chips arrive, oh so close ...

There has not been anything connected to MISO during this testing. I will try your tip with pullups.

Thank you for your help so far
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Don't give up yet!  Two things I've discovered about the t13...

After changing the clock choice (fuses), mine sometimes becomes unresponsive until I toggle power.  Try toggling the target's power.

There is a minimum pulse time for RESET.  All the processors I've used don't seem to care if the minimum is or is not met.  Except the t13.  If the pulse is too short, it will reset but refuse to enter programming mode.  If you've changed the clock to 128 KHz, the minimum pulse maybe longer than the pulse provided by USBasp or Pololu.  I know the minimum pulse is longer than the one provided by ArduinoISP.  I just change TinyISP to provide the correct reset pulse for the t13 @ 128 KHz.

Bear in mind I also changed how build options are specified.  If you decide to try TinyISP and need help getting it working the way it was just let me know.
« Last Edit: December 11, 2012, 06:49:18 pm by Coding Badly » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

--- Knock-Bang fault: 11 ---

You are running TinyISP on what board?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Success... ! (almost)

I got a new attiny13 today and tried it with the factory settings, and a very short connection to MISO, and here is the result:

Code:
t13 test..
t13 test..
t13 test..
t13 test..
--- Knock-Bang fault: 4 ---
t13 test..
t13 test..
t13 test..
t13 test..
--- Knock-Bang fault: 13 ---
t13 test..
t13 test..

I will try with another cpu-speed setting to see if I can reduce the errors.
Also I will try your updated TinyISP

Quote
--- Knock-Bang fault: 11 ---



You are running TinyISP on what board?

I am using Arduino Uno (I think it is R2)

And another success, I was able to get my dead tiny back to live by using this HV-programmer

http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/

It seems OK now, atleast it passed the blink test

Update:

At 4,8 mHz it is a total succes, no errors at all.

« Last Edit: December 12, 2012, 10:52:20 am by Erni » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


It works at 4.8 MHz but not at 9.8 MHz?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It also works without errors at 9,6 mHz
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


It does not work at 1.2 MHz but does work at higher frequencies?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Now I am confused. According to the datasheet (if i read it correct) , the only options are 128kHz, 4,8 mHz and 9,6 mHz. I can see that the factory default is 9,6 mHz (I thought it was 128 kHz)
Another thing that is confusing is the fuse settings I am using. They are mainly copied from the thread about core 13, and I think they maybe are wrong, because I am know in the same situation as yesterday with an unresponding attiny, after I tried to "burn bootloader" 128 kHz.

This is my boards.txt

Code:
###########################################################################

attiny13int.name=Attiny13 @ 128 KHz (internal watchdog oscillator)
attiny13int.upload.using=arduino:arduinoisp
attiny13int.bootloader.low_fuses=0x7B
attiny13int.bootloader.high_fuses=0xFF
attiny13int.upload.maximum_size=1024
attiny13int.build.mcu=attiny13
attiny13int.build.f_cpu=128000
attiny13int.build.core=core13

###########################################################################

attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
attiny13at4.upload.using=arduino:arduinoisp
attiny13at4.bootloader.low_fuses=0x69
attiny13at4.bootloader.high_fuses=0xff
attiny13at4.upload.maximum_size=1024
attiny13at4.build.mcu=attiny13
attiny13at4.build.f_cpu=600000
attiny13at4.build.core=core13
###########################################################################

attiny13at9m.name=ATtiny13 @ 9.6 Mhz
attiny13at9m.bootloader.low_fuses=0x7A
attiny13at9m.bootloader.high_fuses=0xff
attiny13at9m.upload.maximum_size=1024
attiny13at9m.build.mcu=attiny13
attiny13at9m.build.f_cpu=9600000
attiny13at9m.build.core=core13

###########################################################################




Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

According to the datasheet (if i read it correct) , the only options are 128kHz, 4,8 mHz and 9,6 mHz.

Divide by 8 is also an option.

Quote
I can see that the factory default is 9,6 mHz (I thought it was 128 kHz)

Divided by 8.  (1.2 MHz)

Quote
They are mainly copied from the thread about core 13, and I think they maybe are wrong, because I am know in the same situation as yesterday with an unresponding attiny, after I tried to "burn bootloader" 128 kHz.

Code:
attiny13int.bootloader.low_fuses=0x7B
attiny13int.bootloader.high_fuses=0xFF

Yeah, that looks suspicious.  I think mine are 0x33 and 0xFF.  One moment... http://www.engbedded.com/fusecalc ... 0x33 and 0xFF will definitely work.  0x7B and 0xFF will also work.  The differences are start-up time and EEPROM save.

Bear in mind what I wrote earlier about the RESET pulse time.  The symptoms you've described exactly match the ones I had.
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Bear in mind what I wrote earlier about the RESET pulse time

Oh yes, sorry I got a little overexcited because it worked (to a certain point) !
So now I use your changed TinyISP, and now I can change fuses without problems. No need for HV programmer as I thought.

Thank you Coding Badly for this update

The funny thing is that Knockbang only works at some clock frequences

0x69 0xFF  4,8mhz /div8   ok
0x79 0xff  4,8mHz  Knockbbang error 15
0x7A 0xFF  9,6mHz ok
0x6A 0xFF  9,6mHz /div8  Knockbang error 11  
0x6A 0xFF  9,6mHz /div8  Knockbang error 11  
0x62 0xFF  9,6mHz /div8  Knockbang error 11  
0x66 0xFF  9,6mHz /div8  Knockbang error 11  

« Last Edit: December 13, 2012, 04:17:13 pm by Erni » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So now I use your changed TinyISP, and now I can change fuses without problems. No need for HV programmer as I thought.

Excellent.

Quote
0x69 0xFF  4,8mhz /div8   ok
0x79 0xff  4,8mHz  Knockbbang error 15
0x7A 0xFF  9,6mHz ok
0x6A 0xFF  9,6mHz /div8  Knockbang error 11 
0x6A 0xFF  9,6mHz /div8  Knockbang error 11 
0x62 0xFF  9,6mHz /div8  Knockbang error 11 
0x66 0xFF  9,6mHz /div8  Knockbang error 11

Wow.  Everything about that list is bizarre.  Does any of the data arrive in the error 15 case?

What's the goal?  Are you helping to make Knock-Bang more reliable?  Or do you just need to get it working so you can move on with your project?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

One thing I've noticed about this core is the timing of the delay function is unaccurate, and especially at the frequencies where KnockBang gives error messages

In the blink sketch with 1 second delay I get:

X66 0xFF -> 10 seconds
x7a  0xFF-> 1.3 seconds
x69  0xFF-> 1.5 seconds
x79  0xFF-> 0.3 seconds

I do not know how or if this affects KnockBang

Quote
Does any of the data arrive in the error 15 case?

No nothing but the error message

Quote
What's the goal?  Are you helping to make Knock-Bang more reliable?  Or do you just need to get it working so you can move on with your project?

I would like to help with your KnockBang, but my lack of programming skills, does that I will be more trouble than help.
Thank you for the help, I am sure that others can benefit from it also.
« Last Edit: December 14, 2012, 12:38:43 pm by Erni » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

One thing I've noticed about this core is the timing of the delay function is unaccurate, and especially at the frequencies where KnockBang gives error messages ... I do not know how or if this affects KnockBang

Excellent observation.  If delay is wrong because the F_CPU value is wrong than Knock-Bang would most definitely not function correctly.  Please post your boards.txt file with the other entries (or ensure the F_CPU entries are correct).

Quote
I would like to help with your KnockBang...

Including 128 KHz, which clock speed is your highest priority?

Other than 128 KHz, which clock speed is your highest priority?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If delay is wrong because the F_CPU value is wrong than Knock-Bang would most definitely not function correctly

Oh yes of course, I had only made corrections to the fuses and forgot the f_cpu value. Sigh now i feel stupid

So now KnockBang works on Attiny13, whit clockspeeds 9.6 4.8 1.2 and 0.6 mHz.

Below is the correct boards.txt.

To summarize using smeezekitty's core13 with Coding Badly's KnockBang:

Core13:
http://sourceforge.net/projects/ard-core13/


1. Delete line (#55) from TinyDebugKnockBang.h

2. In the Wprogram.h add these lines (in the coe13 libary):
Code:
class __FlashStringHelper;
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
#include <avr/pgmspace.h>
#include "print.h"

3. When changing fuses (burn bootloader):
Use this changed TinyISP
https://github.com/Coding-Badly/TinyISP

4. Use a short and thick wire as MISO, and maybe use pullup resistor


Code:
attiny13int.name=Attiny13 @ 128 KHz (internal watchdog oscillator - no KnockBang)
attiny13int.upload.using=arduino:arduinoisp
attiny13int.bootloader.low_fuses=0x33
attiny13int.bootloader.high_fuses=0xFF
attiny13int.upload.maximum_size=1024
attiny13int.build.mcu=attiny13
attiny13int.build.f_cpu=128000
attiny13int.build.core=core13

###########################################################################

attiny13at4d.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock/8)
attiny13at4d.upload.using=arduino:arduinoisp
attiny13at4d.bootloader.low_fuses=0x69
attiny13at4d.bootloader.high_fuses=0xff
attiny13at4d.upload.maximum_size=1024
attiny13at4d.build.mcu=attiny13
attiny13at4d.build.f_cpu=600000
attiny13at4d.build.core=core13
###########################################################################

attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
attiny13at4.upload.using=arduino:arduinoisp
attiny13at4.bootloader.low_fuses=0x79
attiny13at4.bootloader.high_fuses=0xff
attiny13at4.upload.maximum_size=1024
attiny13at4.build.mcu=attiny13
attiny13at4.build.f_cpu=4800000
attiny13at4.build.core=core13
###########################################################################


attiny13at9dm.name=ATtiny13 @ 9.6 Mhz/div8
attiny13at9dm.bootloader.low_fuses=0x66
attiny13at9dm.bootloader.high_fuses=0xff
attiny13at9dm.upload.maximum_size=1024
attiny13at9dm.build.mcu=attiny13
attiny13at9dm.build.f_cpu=1200000
attiny13at9dm.build.core=core13

###########################################################################

attiny13at9m.name=ATtiny13 @ 9.6 Mhz
attiny13at9m.bootloader.low_fuses=0x7A
attiny13at9m.bootloader.high_fuses=0xff
attiny13at9m.upload.maximum_size=1024
attiny13at9m.build.mcu=attiny13
attiny13at9m.build.f_cpu=9600000
attiny13at9m.build.core=core13

########################################################################
« Last Edit: December 15, 2012, 12:32:53 pm by Erni » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sigh now i feel stupid

Why?  Were you born knowing how to modify boards.txt?  If not (and we both know you were not) you are not even close to "stupid".

You made a mistake.  We all do.  To be "stupid" you would have to refuse to acknowledge your mistake then correct it.  Clearly that is not the case.

Quote
So now KnockBang works on Attiny13, whit clockspeeds 9.6 4.8 1.2 and 0.6 MHz.

Excellent!

(Except for 0.6 MHz.  I'm surprised that works.  As the clock speed is reduced below 1 MHz, the protocol becomes less reliable.  At 0.5 MHz it should fail.)
Logged

Pages: 1 ... 4 5 [6] 7 8 ... 14   Go Up
Jump to: