Tiny Core 2 + ATtiny861

Tiny Core 2 is ready (enough) for human consumption. It's available in the usual place... Google Code Archive - Long-term storage for Google Code Project Hosting. On the Source tab, it's under the "core2" repository.

There is support for the t861, t13, t85, and t84 processors but it is not complete. Expect to find bugs and things missing.

If you have a request, please post it here. More requests = higher priority.

If you have a question, please post it here.

If you find a bug, please post it here.

There are two goals with this core: smaller and configurable. To accomplish the first goal, there are generally two versions for every Arduino function. An inline version and a normal version. The inline version is used when key parameters are constants. The normal version is used otherwise. pinMode is a perfect example. If the two parameters are constants, pinMode reduces to one or two machine instructions. If pin is constant, pinMode typically reduces to fewer than six machine instructions.

The "variants" feature is used to configure the core. A file named tc_build_options.h is created under a new variant. Here's the tc_build_options.h for the "standard" variant...
http://code.google.com/p/arduino-tiny/source/browse/variants/standard/tc_build_options.h?repo=core2
By changing various #defines the core can be modified to support different applications. For example, it is possible to move millis to the watchdog timer. This allows timer 0 to be used as you please. Or, the default prescaler can easily be changed to increase the PWM frequency.

The pin mapping is available here... Arduino Tiny - #284 by Coding_Badly - Microcontrollers - Arduino Forum

@hiduino, @Erni, @leo72, and anyone else who wants to work with the ATtiny861 family, I have a specific request. Please...

• Download and install the new core.
• Download and install Tiny Tuner 2 (it's a library).
• Try uploading and running the following sketch; you will have to use TinyISP with it configured to output a tuning signal.

#include <TinyDebugKnockBang.h>
#include <TinyTuner2.h>

static const uint8_t NO_PIN = (uint8_t)(-1);
static const uint8_t TogglePin = NO_PIN; // 3;

static void OutputOSCCALAssignment( void )
{
  Debug.print( F( "\r\n\r\n  // Add the following line of code to the top of setup...\r\n  OSCCAL = 0x" ) );

  TinyTuner2.tune();

  Debug.print( OSCCAL, HEX );
  Debug.println( F( ";" ) );

//  delay( 2500 );
  _delay_ms( 2500 );
}

void setup( void )
{
  Debug.begin( 250000 );
  
  if ( TogglePin != NO_PIN)
  {
    digitalWrite( TogglePin, HIGH );
    pinMode( TogglePin, OUTPUT );
  }

  Debug.print( F( "\r\n\r\n  // Initial value of OSCCAL is 0x" ) );
  Debug.print( OSCCAL, HEX );
  Debug.println( F( ";" ) );
  _delay_ms( 1000 );

  OutputOSCCALAssignment();
}

void loop( void )
{
  OutputOSCCALAssignment();
}
  1. I downloaded and installed the new Tiny Core 2 (a little headache before to understand that you named the file boards.txt to another thing... :wink: ). Then I used it to set the fuses to 8 MHz. Then I compiled and uploaded the BlinkWithoutDelay sketch.
    Everything was perfect.

  2. if you explain me how to do the test you requested.... what's TinyISP? How do I have to use it?

I installed the TinyCore2 core and TinyTuner2 library.

I am trying your TinyTuner2 example but I am having an error with TinyDebugKnockBang.

TinyTuner2_test:9: error: 'Debug' was not declared in this scope

Am I missing an option in the core2?

I think you have to ammend the t861 In TinyKnockBang.h

line 42

#if defined( __AVR_ATtiny13__ ) || defined( __AVR_ATtiny25__ ) || defined( __AVR_ATtiny45__ ) || defined( __AVR_ATtiny85__ )|| defined( __AVR_ATtiny861__ )

With the above mentioned correction to TinyKnockBang.h

I got TinyTuner2 running.

Running t861 @1MHz I got this result :

 // Initial value of OSCCAL is 0x9F;

  // Add the following line of code to the top of setup...
  OSCCAL = 0x

Edit:
After remembering to connect the tune pin to XTAL2, I get:

  // Initial value of OSCCAL is 0x9F;


  // Add the following line of code to the top of setup...
  OSCCAL = 0x9B;

what's TinyISP?

It is a replacement for ArduinoISP.
One of the great features is that it use the MISO line to communicate, so you don't have to use a Serial/USB converter every time you want to have debugging output

http://forum.arduino.cc/index.php?topic=123388.30

There are several options, but the TinyTuner2 example use TinyKnockBang, see reply #37

Here is an overview

http://www.ernstc.dk/arduino/tinycom.html

Okay, I have these results.

t861A @ 1MHz:

  // Initial value of OSCCAL is 0xAD;


  // Add the following line of code to the top of setup...
  OSCCAL = 0xA9;

t861A @ 8MHz:

  // Initial value of OSCCAL is 0xAD;


  // Add the following line of code to the top of setup...
  OSCCAL = 0xA9;


  // Add the following line of code to the top of setup...
  OSCCAL = 0xAA;

Thank you @leo72!

leo72:

  1. I downloaded and installed the new Tiny Core 2 (a little headache before to understand that you named the file boards.txt to another thing... :wink: ).

The intent is for you to maintain your own boards.txt. That way you can keep the list as short or as long as you want and you don't need to worry about an update overwriting any changes you make.

Then I used it to set the fuses to 8 MHz. Then I compiled and uploaded the BlinkWithoutDelay sketch. Everything was perfect.

Excellent!

  1. if you explain me how to do the test you requested.... what's TinyISP? How do I have to use it?

@Erni has a good tutorial on his website.

hiduino:
Am I missing an option in the core2?

TinyDebugKnockBang (it's a library). I wonder if it should just be included in the core? Thoughts?

I added it to Google Code so you won't have to visit two websites.

Erni:
I think you have to ammend the t861 In TinyKnockBang.h

No amendments needed. Just refresh.

Erni:
After remembering to connect the tune pin to XTAL2, I get:

Excellent. Thank you @Erni!

hiduino:
Okay, I have these results.

Excellent. Thank you @hiduino!

I was still on the old version. I needed to refresh it. I think it will be convenient to have it included, unless one wants to use it with other cores. I guess it will be more flexible as a library.

I like the flexibilty of a library.
I have used it with other cores for example attiny13 and Atmega8 and Atmega328.

Ok. I remembered myself to look at this thread too late... sorry :sweat_smile:

Just a couple of questions:

  1. the Tiny 2 core is, at this stage, a complete replacement of the original Tiny core or not?
  2. at this stage, is the Tiny 2 core supporting almost the most important features of the AttinyX61 family (I mean digital read/write, analog read, timers, interrupts)?

I'll try to add the support for the AttinyX61 MCUs in my libraries (swRTC, leOS/leOS2, looper and analogComp) :wink:

Erni:
I like the flexibilty of a library.

I wonder if it can be both...

leo72:

  1. the Tiny 2 core is, at this stage, a complete replacement of the original Tiny core or not?

No.

I'm working on a Google Spreadsheet that summarizes the status.

  1. at this stage, is the Tiny 2 core supporting almost the most important features of the AttinyX61 family (I mean digital read/write, analog read, timers, interrupts)?

These should be working...
millis
digitalRead( constant )
digitalWrite( constant )
analogRead( constant )

I'll try to add the support for the AttinyX61 MCUs in my libraries (swRTC, leOS/leOS2, looper and analogComp) :wink:

Excellent. If you run into anything missing or anything you believe would be better placed in the core just let me know.

[quote author=Coding Badly link=topic=173408.msg1290123#msg1290123 date=1372053017]

Erni:
I like the flexibilty of a library.

I wonder if it can be both...[/quote]

While it does work it creates a situation that has the potential to be a support nightmare. So, TinyDebugKnockBang remains a library.

So, TinyDebugKnockBang remains a library.

That's good news, thankyou.

I did an experiment with a Attin85 @ 8MHz and TinyTuner2

First I tuned it with the "old" TinyTuner, and then with TinyTuner2

Both gave the same OSCALL values, and the tuned frequence was approx. 8,02 MHz

Next I will try Attiny13, it is a tight fit, but deleting some of the debug text should do it.