Go Down

Topic: Tiny Core 2 + ATtiny861 (Read 24577 times) previous topic - next topic

Coding Badly

Jun 22, 2013, 09:24 am Last Edit: Jun 22, 2013, 09:32 am by Coding Badly Reason: 1

Tiny Core 2 is ready (enough) for human consumption.  It's available in the usual place... http://code.google.com/p/arduino-tiny/downloads/list  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[font=Courier New] tc_build_options.h [/font]is created under a new variant.  Here's the[font=Courier New] tc_build_options.h [/font]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... http://forum.arduino.cc/index.php?topic=51984.msg1269301#msg1269301

Coding Badly


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

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


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...  ;) ). 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?

hiduino

I installed the TinyCore2 core and TinyTuner2 library.

I am trying your TinyTuner2 example but I am having an error with TinyDebugKnockBang.
Code: [Select]

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


Am I missing an option in the core2?


Erni


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

line 42

Code: [Select]
#if defined( __AVR_ATtiny13__ ) || defined( __AVR_ATtiny25__ ) || defined( __AVR_ATtiny45__ ) || defined( __AVR_ATtiny85__ )|| defined( __AVR_ATtiny861__ )

Erni

#5
Jun 22, 2013, 12:53 pm Last Edit: Jun 22, 2013, 04:04 pm by Erni Reason: 1
With the above mentioned correction to TinyKnockBang.h

I got TinyTuner2 running.

Running t861 @1MHz I got this result :

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

Code: [Select]


  // Initial value of OSCCAL is 0x9F;


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



Erni

Quote
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

hiduino

Okay, I have these results.

t861A @ 1MHz:
Code: [Select]

  // Initial value of OSCCAL is 0xAD;


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


t861A @ 8MHz:
Code: [Select]

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



Coding Badly


Thank you @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...  ;) ).


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.

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


Excellent!

Quote
2) 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.

Coding Badly

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.

Coding Badly

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


No amendments needed.  Just refresh.

Coding Badly

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


Excellent.  Thank you @Erni!

Coding Badly

Okay, I have these results.


Excellent.  Thank you @hiduino!

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


Erni

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

Go Up