Pages: 1 ... 5 6 [7] 8 9 ... 15   Go Down
Author Topic: core13: An Arduino core for the Attiny13 *testers wanted*  (Read 31669 times)
0 Members and 1 Guest are viewing this topic.
lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ver 16 downloaded, hopefully will have spare time soon to experiment with new code.

I noticed the clock seems to have changed on the last chip I programmed, fuses were burned, and it looked good on the bread board.
Once all the resistors/LEDs were soldered on the clock seems to be running faster by about 30%.
Different power source? Which oscillator?

#1 Yes Arduino power on the bread board vs voltage from the RC receiver on final install voltage is 3.8Vdc

#2 ATtiny13  @4.8MHz boards.txt located at:
 C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino
 
Code:
attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
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
Logged

Washington
Offline Offline
God Member
*****
Karma: 30
Posts: 780
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



#1 Yes Arduino power on the bread board vs voltage from the RC receiver on final install voltage is 3.8Vdc
The voltage can cause the clock to change quite significantly but 30% seems excessive. 10-15% is common of the voltage range of 1.7-5.
Quote
#2 ATtiny13  @4.8MHz boards.txt located at:
 C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino
 
Code:
attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
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
FWIW This has the clock/8 fuse set so it is running at 600KHz and not 4.8MHz.
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 178
Posts: 12288
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

10-15% is common of the voltage range of 1.7-5.

If the frequency of either internal oscillator varies by more than 3% over the voltage range the processor grossly violates the published specifications.  In other words, your processor is defective.
Logged

lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

10-15% is common of the voltage range of 1.7-5.

If the frequency of either internal oscillator varies by more than 3% over the voltage range the processor grossly violates the published specifications.  In other words, your processor is defective.

Man! I'm going to demand my .99 cents back!  For what we pay for these I am not surprised they don't perform to the specifications. This just a minor inconvenience for me as I am only driving lights for an RC toy.
Logged

lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



#1 Yes Arduino power on the bread board vs voltage from the RC receiver on final install voltage is 3.8Vdc
Quote
The voltage can cause the clock to change quite significantly but 30% seems excessive. 10-15% is common of the voltage range of 1.7-5.
Would installing a transistor between VCC & Reset force the clock to run at the same on both voltages?
Quote

#2 ATtiny13  @4.8MHz boards.txt located at:
 C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino
 
Code:
attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
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
Quote
FWIW This has the clock/8 fuse set so it is running at 600KHz and not 4.8MHz.
Thanks, I will look up the proper fuse setting for the 4.8MHz setting
Logged

Washington
Offline Offline
God Member
*****
Karma: 30
Posts: 780
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Would installing a transistor between VCC & Reset force the clock to run at the same on both voltages?
???

Quote
Thanks, I will look up the proper fuse setting for the 4.8MHz setting
http://www.engbedded.com/fusecalc/
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Would installing a transistor between VCC & Reset force the clock to run at the same on both voltages?
Quote
???
Just asking as a light set I purchased using an ATtiny13 has a component resembling a resistor (SMD 0603 style ) with  code E0l or E01 installed between VCC & reset pins. That number seems to belong to a transistor but my electronics searching often turn up bum results.
Quote
Thanks, I will look up the proper fuse setting for the 4.8MHz setting
http://www.engbedded.com/fusecalc/

Thanks I will check out the link
« Last Edit: August 24, 2012, 04:03:06 pm by gizmoDave » Logged

Washington
Offline Offline
God Member
*****
Karma: 30
Posts: 780
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually that is a resistor.
Some microcontrolers experience spurious resets without an external pull up resistor.
If it randomly resets, try a pull of resistor between 2k and 68k.
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

San Diego
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino newbie - mechanical engineer / electronics hacker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

John, I changed the low fuse to 7A and now the timing is relatively close for both 9.6 MHz and 4.8MHz; it takes only 7 sec for a 10 sec delay to finish (approx 40% fast).  The analogRead is still exhibiting the same end-biased behavior as before; the read goes from 0-1023 in approximately 25% of the rotation of the POT. 

In an article on Instructables (Make an Attiny13 based IR proximity sensor for $2.42) the author says that you need the command:
Code:
analogReference(0);//analogread won't work on Atiny13 w/o this line. Won't work on others WITH it prob'ly.
The article references your core13 but I'm not sure how since the analogReference command is not supported in your core.  I appreciate your interest in this platform.  Let me know if there is anything else I can test.

Thanks, Mark



Logged

All electronics run on smoke - when the smoke escapes they always quit working!

lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

testing pulseIn this morning with Ver1.16 and getting error that I think states there is an argument in wiring.h it can't process

Quote
C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13/wiring.h: In function 'void loop()':
C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13/wiring.h:76: error: too few arguments to function 'long unsigned int pulseIn(unsigned char, unsigned char, long unsigned int)'
SwitchRC_AUX:10: error: at this point in file

Here is the sketch that  generates the error during verification

Code:
int duration;

void setup()
{
  pinMode(PB2, INPUT);
  pinMode(PB0, OUTPUT);
}

void loop()
{
  duration = pulseIn(PB2, HIGH);
  digitalWrite(PB0, LOW);
  if (duration < 1300)
  {
    digitalWrite(PB0, HIGH);
  }
}
Logged

Washington
Offline Offline
God Member
*****
Karma: 30
Posts: 780
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

John, I changed the low fuse to 7A and now the timing is relatively close for both 9.6 MHz and 4.8MHz; it takes only 7 sec for a 10 sec delay to finish (approx 40% fast). 
The delay being spotty is a well know problem.
I will try to find a small solution but for now you can use the millis() wait loop work around if you can afford a bit more flash.
Quote
The analogRead is still exhibiting the same end-biased behavior as before; the read goes from 0-1023 in approximately 25% of the rotation of the POT. 
I will check it out soon (not sure when I will get to it though).
Quote
In an article on Instructables (Make an Attiny13 based IR proximity sensor for $2.42) the author says that you need the command:
Code:
analogReference(0);//analogread won't work on Atiny13 w/o this line. Won't work on others WITH it prob'ly.
analogReference is just a stub so I think this would just increase code size with no other effect.
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Washington
Offline Offline
God Member
*****
Karma: 30
Posts: 780
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

testing pulseIn this morning with Ver1.16 and getting error that I think states there is an argument in wiring.h it can't process

Quote
C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13/wiring.h: In function 'void loop()':
C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13/wiring.h:76: error: too few arguments to function 'long unsigned int pulseIn(unsigned char, unsigned char, long unsigned int)'
SwitchRC_AUX:10: error: at this point in file

Here is the sketch that  generates the error during verification

Code:
int duration;

void setup()
{
  pinMode(PB2, INPUT);
  pinMode(PB0, OUTPUT);
}

void loop()
{
  duration = pulseIn(PB2, HIGH);
  digitalWrite(PB0, LOW);
  if (duration < 1300)
  {
    digitalWrite(PB0, HIGH);
  }
}
On core13, pulseIn requires a time out argument.
You could set this to 0xFFFFFFFF which is the maximum of a 32 bit number. This would set the time out to about 1.2hours.
Sorry for the inconvenience.
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

testing pulseIn this morning with Ver1.16 and getting error that I think states there is an argument in wiring.h it can't process

Quote
C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13/wiring.h: In function 'void loop()':
C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13/wiring.h:76: error: too few arguments to function 'long unsigned int pulseIn(unsigned char, unsigned char, long unsigned int)'
SwitchRC_AUX:10: error: at this point in file

On core13, pulseIn requires a time out argument.
You could set this to 0xFFFFFFFF which is the maximum of a 32 bit number. This would set the time out to about 1.2hours.
Sorry for the inconvenience.

I have searched several C++ tutorials and numerous posts that refer to timeout but have found nothing that references timeout in relation to pulseIn
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 72
Posts: 1642
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

in this case, 'timeout' is a variable which you pass to pulseIn to say how long it should wait for a pulse to be detected before giving up.

The error "too few arguments to function" is generic and means that a function (in this case pulseIn) requires you to give it more values than you have.
 For example:
Code:
void functionWithThreeArguments(int arg1, byte arg2, float arg3){
   //Whatever...
}
...
  functionWithThreeArguments(someVariable); //This is not valid as only 'arg1' is given a value, not the other two.
  functionWithThreeArguments(someVariable, aSecondVariable); //This is not valid as only 'arg1' and 'arg2' are given values, not the other.
  functionWithThreeArguments(someVariable, aSecondVariable, aThirdVariable); //This is valid as the compiler knows what to put in each of the three arguments.
...
Logged

~Tom~

lost in cyber space
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

in this case, 'timeout' is a variable which you pass to pulseIn to say how long it should wait for a pulse to be detected before giving up.

The error "too few arguments to function" is generic and means that a function (in this case pulseIn) requires you to give it more values than you have.
 For example:
Code:
void functionWithThreeArguments(int arg1, byte arg2, float arg3){
   //Whatever...
}
...
  functionWithThreeArguments(someVariable); //This is not valid as only 'arg1' is given a value, not the other two.
  functionWithThreeArguments(someVariable, aSecondVariable); //This is not valid as only 'arg1' and 'arg2' are given values, not the other.
  functionWithThreeArguments(someVariable, aSecondVariable, aThirdVariable); //This is valid as the compiler knows what to put in each of the three arguments.
...

Ok I understand that as written the 3 variables must be provided, but are three really needed? Can I rewrite the line in wiring.h to only require one argument & accompanying variable? Does the variable have to be listed as a # define statement?
I read a couple of C++ tutorials over the weekend and generated more questions than answers.
Logged

Pages: 1 ... 5 6 [7] 8 9 ... 15   Go Up
Jump to: