Go Down

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

ElectroNick


Can you use all the pins on this device (the reset pin, too) without a bootloader?! (my reading from various forums says NO, not without setting the fuse so the pin is no longer RESET and needing a high-voltage programmer to reprogram the device)


"Burn Bootloader" as far as ATtiny13 and other chips burned using a programmer are concerned, is a euphemism. There's no bootloader (and no need for one either)  - all this Arduino IDE function does is to burn proper configuration fuses so the MCU operates using the right clock frequency and so your time-dependent programs, such as the LED blinker, work properly. There are plenty of other configuration variables set by the config fuses but the timing is probably most important from the practical stand point - most others are left on defaults.

You cannot use the Reset pin if you're planning to re-flash the MCU using an ICSP programmer. Unless you have a high-voltage programmer, just consider ATtiny13 a 5xI/O MCU - makes development easier.

 /\_/\      ARDUINO
((@v@))     CNC
()~|~()

mrares

Got it! Once reading the spec of the attiny13a it looks like with a bit of elbow grease and a 12V power supply one can reset the fuses off a chip with the help of an Uno and a custom sketch.

Is it possible to write the fuses from within the code on the chip? (eg: set the reset pin enabled or disabled from your sketch, say... on a spi command received)

Tom Carpenter


Is it possible to write the fuses from within the code on the chip? (eg: set the reset pin enabled or disabled from your sketch, say... on a spi command received)

No, you can't. The device can only be programmed when held in Reset (ISP), or with a high voltage programmer.
Furthermore, if the reset pin is disabled, then the ISP won't work as there is no way for it to hold the chip in reset.
~Tom~

pswag

#123
Feb 11, 2013, 10:48 am Last Edit: Feb 11, 2013, 11:12 am by pswag Reason: 1
ADMUX = (1<<REFS0) | pin & 7; //Setup ADC

Hi,

the analog mux has only 4 channels on T13. Ain't it better giving the user the ability to select the analog reference?
What about this:

ADMUX = ADMUX & _BV(REFS0) | pin & 3; //Setup ADC, preserve REFS0

and implement analogReference():

void analogReference(uint8_t mode){
   if(mode==INTERNAL)
      ADMUX |= _BV(REFS0)
   else
      ADMUX &= ~_BV(REFS0)
}

Cheers, Peter

smeezekitty


ADMUX = (1<<REFS0) | pin & 7; //Setup ADC

Hi,

the analog mux has only 4 channels on T13. Ain't it better giving the user the ability to select the analog reference?
What about this:

ADMUX = ADMUX & _BV(REFS0) | pin & 3; //Setup ADC, preserve REFS0

and implement analogReference():

void analogReference(uint8_t mode){
   if(mode==INTERNAL)
      ADMUX |= _BV(REFS0)
   else
      ADMUX &= ~_BV(REFS0)
}

Cheers, Peter

To be quite honest, I did not realize the '13 had an analog reference other than +V. The "& 7" is a bug. I will fix it in the next release.

I still do not really see the point in supporting analogReference.
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!

pswag

#125
Feb 14, 2013, 01:25 am Last Edit: Feb 14, 2013, 01:31 am by pswag Reason: 1
I am wondering why analogRead() explicitely sticks the REFS0 bit to 1 every time it is called (1<<REFS0), which selects the INTERNAL 1V1 reference, hence A/D range is limited to an input voltage from 0 to 1.1 V. This is no good.

However the Arduino uses 0 to VCC by default.

The datasheet says:
0 VCC used as analog reference. -> #define DEFAULT 0
1 Internal Voltage Reference. -> #define INTERNAL 1

Users would actually not expect that analogRead() was setting the analog reference.
analogReference() is intended for doing the job.

#defines are provided in wiring.h

See also
http://arduino.cc/en/Reference/AnalogReference

What's the problem with implementing analogReference()? This is pretty easy, and the T13 can do it. So people can make use of it.

pswag

I'd like to share the modifications I have already done to your code.

smeezekitty


I am wondering why analogRead() explicitely sticks the REFS0 bit to 1 every time it is called (1<<REFS0), which selects the INTERNAL 1V1 reference, hence A/D range is limited to an input voltage from 0 to 1.1 V. This is no good.

Oh yikes. Thanks for catching that. It is a bug.
These things are hard to debug without a Serial interface.


Although quite honestly I was not even aware of the 1.1V reference. I thought that was only on the higher end chips.


I will evaluate your changes and determine if it is worth including. Please standby.
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!

Somnitec

A small feature request: Could you add PinMode(pin,INPUT_PULLUP)?  This makes simple buttons easier!

smeezekitty


A small feature request: Could you add PinMode(pin,INPUT_PULLUP)?  This makes simple buttons easier!

I could. As it is, it uses Arduino 022 style so
Code: [Select]

pinMode(pin,INPUT);
digitalWrite(pin,1);

will enable the pullup.
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!

Erni

Quote
These things are hard to debug without a Serial interface.


You might be interested in this:

Using Coding Badly's TinyISP and knockbang library, it is posiible to get debug output from a tiny13 and your core:

http://arduino.cc/forum/index.php/topic,123388.msg1033756.html#msg1033756

smeezekitty

#131
Mar 03, 2013, 07:36 pm Last Edit: Mar 03, 2013, 07:38 pm by smeezekitty Reason: 1
You know, oddly enough I created an synchronous serial debugging system for the Attiny13 but I got fed up of flashing the Arduino between the ISP sketch and the serial receive sketch.

I will look at that. Thanks.

Side note: Version 0.18 is in progress.
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

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!

Erni

Is the newest core called 017 ?

I downloaded from the link in the first post in this thread

smeezekitty


Is the newest core called 017 ?

I downloaded from the link in the first post in this thread

No, the new version is 0.18.
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!

Go Up