Go Down

Topic: core13: An Arduino core for the Attiny13 *testers wanted* (Read 49636 times) previous topic - next topic

gizmoDave



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: [Select]

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

smeezekitty




#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: [Select]

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.
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!

Coding Badly

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.

gizmoDave


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.

gizmoDave





#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: [Select]

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

smeezekitty



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/
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!

gizmoDave

#96
Aug 24, 2012, 10:50 pm Last Edit: Aug 24, 2012, 11:03 pm by gizmoDave Reason: 1



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

smeezekitty

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.
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!

malukens

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: [Select]
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



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

gizmoDave

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: [Select]
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);
  }
}

smeezekitty


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: [Select]
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.
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!

smeezekitty


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: [Select]
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.
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!

gizmoDave



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

Tom Carpenter

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: [Select]
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.
...
~Tom~

gizmoDave


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: [Select]
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.

Go Up