Tiny Core 2 + ATtiny861

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

0,25%. Excellent.

Differences between the two...

v1...

• Has a minor bug. In rare circumstances it selects a value one-off. The difference in calibration will be very small (typically less than 0.1%).

• Most processors have a split range: 0 through 127 is one range; 128 through 255 is the other. The ranges overlap. Calibration is only performed in the range of the factory OSCCAL value.

• Because it requires sending 'x' characters by hand it can be tedious to tune a processor.

v2...

• Eliminates the bug; it should be a very tiny bit more accurate.

• Calibration is performed on both ranges.

• Is fully automatic.

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

Ultimately, it makes sense to store the calibration in EEPROM (which makes Tiny Tuner significantly smaller). Eventually, Tiny Core 2 will (optionally) automatically load and use an OSCCAL value. I even have an EEPROM address range in mind for configuration data. If you're interested just let me know.

My leOS2 works like a sharm, but I didn't have any doubt as it uses the watchdog as a timer.
BWT leOS1 doesn't. I'm finding some problems trying to do working my library with the new chip Attiny861 because my lib should use timer 0 but it is already used by Tiny 2 core.

Is there an option to move millis to timer 1, like on the actual Tiny core?
I only found an option to use WDT instead of timer 0.

I think I missed something... what happens to the -015 tiny library. I really enjoy working with the tiny cores... A 328, 644, 1284 or 2560 isn't a challenge to get something running.
And are there instructions for installation?

Doc

Docedison:
I think I missed something... what happens to the -015 tiny library.

-0015 is still there. You have to Search All Downloads for a blank. (Nearly all the old versions are there. The Google Code folks discourage removing downloads.)

However, version 1 has had two minor upgrades. The download now has -0017 on the end. The most recent version 1 is available from the Project Home tab... Google Code Archive - Long-term storage for Google Code Project Hosting. ...click Download the latest version for Arduino 1.0 in the middle-top section. The latest version(s) will always be available there.

This thread is about version 2; a work-in-progress. If you decide to play with version 2 be prepared to run into trouble. It is far from complete.

Going forward, the vast majority of my time will be on version 2 (but version 1 will always be available at Google Code).

I really enjoy working with the tiny cores...

Excellent!

And are there instructions for installation?

I try to keep the README file up-to-date with installation instructions... Google Code Archive - Long-term storage for Google Code Project Hosting. The README file should also be available in the download.

Edit: I probably misunderstood the last question. Are you asking if there are instructions for installing version 2?

leo72:
My leOS2 works like a sharm, but I didn't have any doubt as it uses the watchdog as a timer.

Excellent.

Is there an option to move millis to timer 1, like on the actual Tiny core?

There is an option but it will not work. I have not coded the veneer for timer 1. That's the first and only request so it's top priority. I will let you know when the update is ready.

Using Tiny Tuner v2 on a ATTiny13 @1.2MHz

I deleted most of the debugging text which gives a sketch size: 986 bytes
The tuned frequence was 1.194 MHz !

I even have an EEPROM address range in mind for configuration data. If you're interested just let me know.

I am interested

Besides the other improvements of TinyTuner you mention, I think the biggest advantage is that it can be used with TinyDebugKnockBang.
No more fidling with Serial/USB converter and wiring.

Once again Thankyou for maintaining and improving the Tiny core

Thanks :wink:

i've installed the core into the hardware directory, made a boards.txt using the attiny85at8 option, and ran my previous-working sketch through the IDE and it came back with this lot:

tiny_rgb_fade.ino: In function ‘void doFade(int, int&, int&)’:
tiny_rgb_fade.ino:20:37: error: ‘analogWrite’ was not declared in this scope
tiny_rgb_fade.ino:21:17: error: ‘delay’ was not declared in this scope
tiny_rgb_fade.ino:26:37: error: ‘analogWrite’ was not declared in this scope
tiny_rgb_fade.ino:27:17: error: ‘delay’ was not declared in this scope
tiny_rgb_fade.ino:31:37: error: ‘analogWrite’ was not declared in this scope
tiny_rgb_fade.ino: In function ‘void setup()’:
tiny_rgb_fade.ino:39:29: error: ‘randomSeed’ was not declared in this scope

is the '85 support not ready or do i have to do something with one of the buildoptions header files?

P.S. will this core allow the third PWM pin like 0017 does? bloody marvellous feature that is BTW :grin:

ah your sketch doesn't work for me either, perhaps its not been tested on linux with a recent gcc-avr that's the usual issue when its moans about consts/scope etc?

/home/simon/programming/c++/arduino/hardware/tiny-core2/cores/tiny/Print.h:12:2: warning: #warning BIN previously defined; probably in a processor specific header. [-Wcpp]
In file included from tiny2_test.ino:2:0:
/home/simon/programming/c++/arduino/libraries/tinytuner2/TinyTuner2.h:34:2: error: #error TC_XTAL2 must be defined for the selected processor. The definition goes in the processor specific header file. See tc_hardware_mapping_t861.h for an example.
In file included from tiny2_test.ino:2:0:
/home/simon/programming/c++/arduino/libraries/tinytuner2/TinyTuner2.h:254:53: error: macro "TC_PIN_Z" requires 4 arguments, but only 1 given
/home/simon/programming/c++/arduino/libraries/tinytuner2/TinyTuner2.h:255:24: error: macro "TC_DIO_BIT_Z" requires 4 arguments, but only 1 given
In file included from /home/simon/programming/c++/arduino/libraries/knockbang/TinyDebugKnockBang.h:28:0,
                 from tiny2_test.ino:1:
/home/simon/programming/c++/arduino/hardware/tiny-core2/cores/tiny/Arduino.h: In static member function ‘static uint16_t TinyTuner2Class::TimeOnePulse()’:
/home/simon/programming/c++/arduino/hardware/tiny-core2/cores/tiny/Arduino.h:485:22: error: ‘TC_PIN_Z’ was not declared in this scope
In file included from tiny2_test.ino:2:0:
/home/simon/programming/c++/arduino/libraries/tinytuner2/TinyTuner2.h:255:24: error: ‘TC_DIO_BIT_Z’ was not declared in this scope

No. I have ver .015 installed, I am unsure about how to proceed... I HATE to ask for hand holding type guidance but I LOVE the tiny cores and yours is the greatest... It's not only well supported but I learn something every time I use them...
Waaah.. I want to upgrade and I'm somewhat confused about the disposition of the 015 cores/ I really appreciate all that's been done and contributed to the use of the cores.

Doc

Docedison:
No. I have ver .015 installed, I am unsure about how to proceed... I HATE to ask for hand holding type guidance but I LOVE the tiny cores and yours is the greatest... It's not only well supported but I learn something every time I use them...
Waaah.. I want to upgrade and I'm somewhat confused about the disposition of the 015 cores/ I really appreciate all that's been done and contributed to the use of the cores.

Doc

The Tiny Core 2 is still under development so you should continue to use 015 unless you want to get involved with the development.

leo72:
Is there an option to move millis to timer 1, like on the actual Tiny core?

There is now. Instructions...

• Download the update...
http://arduino-tiny.googlecode.com/files/tiny-core-2-0100-0002.zip

• Navigate to the {SketchbookFolder}/hardware/tiny2/variants/ directory

• Create a new folder named leo72

• Navigate to the standard ( {SketchbookFolder}/hardware/tiny2/variants/standard/ ) directory

• Select and copy the tc_build_options.h file

• Navigate to the leo72 ( {SketchbookFolder}/hardware/tiny2/variants/leo72/ ) directory

• Paste the tc_build_options.h file into the leo72 directory

• Open the tc_build_options.h file in your favourite text editor

• Locate the following section, remove the comment from the #define, save the file, close the text editor

/*=============================================================================
  Which timer should be used for millis
=============================================================================*/

#define TC_TIMER_TO_USE_FOR_MILLIS  1

• Navigate to the {SketchbookFolder}/hardware/tiny2/ directory

• Open the boards.txt file in your favourite text editor

• Locate a ATtiny861 board entry that most closely matches the settings you want. For example, I will be working with the attiny861at8 entry.

• Select and copy the entire board entry

• Navigate to the bottom of the file and paste

• Change the the keyword of the new section to something unique. For example, I changed attiny861at8 to leo72.

• Change the board name to something descriptive. For example, I changed u ATtiny861 @ 8 MHz (internal oscillator; BOD disabled)[/u] to Leo's Test.

• Change the BOARD.build.variant value to leo72. For example, I changed leo72.build.variant=standard to leo72.build.variant=leo72.

• This is my complete example...

################################################################################

leo72.name=Leo's Test

#------------------------------------------------------------------------------#
# The following programmers DO work (pick one)...
#

leo72.upload.using=arduino:arduinoisp

#  leo72.upload.using=arduino:usbtinyisp
#  leo72.upload.protocol=avrispv2
#  leo72.upload.using=pololu
#------------------------------------------------------------------------------#

#------------------------------------------------------------------------------#
# The following programmers do NOT work...
#  leo72.upload.using=avrispv2
#  leo72.upload.using=Pololu USB AVR Programmer
#------------------------------------------------------------------------------#

#------------------------------------------------------------------------------#
# Fuse settings and processor speed...
#
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms; [CKSEL=0010 SUT=10]; default value
# 
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]

leo72.bootloader.low_fuses=0xE2
leo72.bootloader.high_fuses=0xD7
# The extended fuse always reads back as 0x01 on my ATtiny861.  Only bit 0 is defined so we'll just use 0x01.
# leo72.bootloader.extended_fuses=0xFF
leo72.bootloader.extended_fuses=0x01
leo72.build.f_cpu=8000000L

# rmv leo72.bootloader.path=empty
# rmv leo72.bootloader.file=empty85at8.hex
# rmv? fix? leo72.bootloader.unlock_bits=0xFF
# rmv? fix? leo72.bootloader.lock_bits=0xFF
leo72.build.mcu=attiny861
leo72.upload.maximum_size=8192
leo72.build.core=tiny
leo72.build.variant=leo72
# leo72.build.core=empty

#------------------------------------------------------------------------------#
# From the factory values (for reference)...
#  avrdude: Device signature = [fix]
#  avrdude: safemode: lfuse reads as 62
#  avrdude: safemode: hfuse reads as DF
#  avrdude: safemode: efuse reads as 01
#------------------------------------------------------------------------------#

################################################################################

• Save the file and close the text editor

• Start the Arduino IDE

• Ensure the new board is selected

• Execute Tools / Burn Bootloader to ensure the fuses are correct

• Enjoy!

Erni:
The tuned frequence was 1.194 MHz !

Excellent!

Besides the other improvements of TinyTuner you mention, I think the biggest advantage is that it can be used with TinyDebugKnockBang.
No more fidling with Serial/USB converter and wiring.

No doubt!

Once again Thankyou for maintaining and improving the Tiny core

You are welcome.

I even have an EEPROM address range in mind for configuration data. If you're interested just let me know. ... I am interested

The header file of interest is tc_eeprom_config.h.

Most (all?) folks start at address zero and work towards the end of EEPROM. In an attempt to avoid conflicts, I am working the other direction; from the end of EEPROM towards address zero. The address of each configuration item is expressed as an offset from the end of EEPROM. I will use this as an example...

const uint16_t TC_EEPROM_CONFIG_1V1_REFERENCE_O         = (E2END - 11);

Address (E2END - 11) is used to store the 1.1 volt reference voltage for that processor. The value is a single byte so this line of code could be used to read the value...

uint16_t ReferenceVoltageX1000 = eeprom_read_byte( (const uint8_t *) TC_EEPROM_CONFIG_1V1_REFERENCE_O ) + 1000;

If ReferenceVoltageX1000 is equal to 1255, a value is not available.

I have space reserved for three OSCCAL values (the clock divider makes a difference), three numerators (for "super tuning"), a processor ID (for networking and tracking), and the 1.1 volt reference.

As I have time, I will round out the helper functions in that header file (for example, tcReadEepromConfig1(uint16_t) is missing).

sej7278:
i've installed the core into the hardware directory, made a boards.txt using the attiny85at8 option, and ran my previous-working sketch through the IDE and it came back with this lot:

Thank you for the feedback.

is the '85 support not ready or do i have to do something with one of the buildoptions header files?

Complete support is not ready for any processor.

P.S. will this core allow the third PWM pin like 0017 does? bloody marvellous feature that is BTW :grin:

It will when I finish the veneer for timer 1 on the t85 processor. (I'm glad to know you like it.)

ah your sketch doesn't work for me either, perhaps its not been tested on linux with a recent gcc-avr that's the usual issue when its moans about consts/scope etc?

Neither Linux nor the compiler are the issue. It is simply a deficiency (bug) in the core.

At this point, Tiny Tuner 2 will only work with the t861 processor.

Docedison:
No. I have ver .015 installed, I am unsure about how to proceed...

Don't bother. If you are content with -0015 stick with it. I just reviewed the changes: Not enough is different from -0015 to -0017 to warrant upgrading unless you have run into either of the two very minor problems that were fixed. (And you would know if you had run into either problem.)

I HATE to ask for hand holding type guidance but I LOVE the tiny cores and yours is the greatest...

I'm glad you like it! Hopefully, the new version will be significantly better!

Wops... I forgot this thread... I'll try your instructions as soon as possible. Thanks for your work :wink:

Tiny Tuner 2 now works with the usual suspects: t13, t84, t85, t2313, t861, m328 (and other members of those families). It is also core independent.

Excellent, will be testing this week.

It is also core independent.

Indeed it is, I just tried with an ATtiny 13 and Smeezekitty's core and got the expected result.

One thing that didn't work was the WriteToEEPROM example on the t13, nothing is written to EEPROM.
I tried tu use #include <EEPROM.h> instead of #include <avr/eeprom.h> but no luck.

On the other hand it works on an ATtiny85, so I've probably made ??some mistakes

Indeed it is, I just tried with an ATtiny 13 and Smeezekitty's core and got the expected result.

Excellent.

One thing that didn't work was the WriteToEEPROM example on the t13...

I assume the sketch is too big for the t13. Does this one change get it to fit...

const bool ReportStatus = false;

hiduino:
Excellent, will be testing this week.

Please let me know how it goes.