I've also edited the _TinyISP_BuildOptions.h according to the information on ernstc.dk 's instruction.
I uploaded successfully PrintUsingKnockBang.ino to an ATTiny85
After that I start up the serial monitor, send an ! and the message ---Monitor starting--- appears.
But that's it.
I connected XTAL2 (which is pin3 on the tiny85) to digital pin3 on the arduino (right pin?). Arduino's reset pin stays unconnected
Am I missing something, or do I have to change tiny85's fuses first?
Thank you very much for helping me.
tobitop:
I've installed TinyISP according to this manual Tuning the internal osccillator on AVR chips
I've also edited the _TinyISP_BuildOptions.h according to the information on ernstc.dk 's instruction.
Did you modify _TinyISP_BuildOptions.h then upload to your Uno? Or upload then modify?
...or do I have to change tiny85's fuses first?
Both tuners work as long as the target is running at 1 MHz or faster. You will only need to change the fuses if you have set them so the target's clock runs slower than 1 MHz.
Thank's for your reply. This is the content of _TinyISP_BuildOptions.h I first did the modifications and then uploaded it to the Arduino Uno.
#ifndef _TinyISP_BuildOptions_h
#define _TinyISP_BuildOptions_h
#define PROGRAMMER_SPI_CLOCK SLOW
//Set to 1 if using KnockBang and comment out #include <SoftwareSerial.h> in TinyISP
#define RELAY_KNOCK_BANG_ENABLED 1
#define RELAY_KNOCK_BANG_USE_ALTERNATE_PIN 1
//Set to 1 if using Serial Relay, and uncomment #include <SoftwareSerial.h> in TinyISP
//Transmit on Arduino is A0
#define RELAY_SERIAL_ENABLED 0
//Set to 1 if using TinyTuner2
//Tuning signal pin 3 on UNO, connect to xtal2 on target
#define TUNING_SIGNAL_ENABLED 1
#define TICK_TOCK_ENABLED 0
#endif
Fuses are set to -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
Thank you very much, now I can see some results, but it seems to be still faulty:
--- Monitor starting ---
// Add the following line of code to the top of setup...
OSCCAL = 0x62;
// Add the following line of code to the top of setup...
OSCCAL = 0x7F;
--- Knock-Bang fault: 15 ---
--- Knock-Bang fault: 15 ---
The same tiny85 showed OSCCAL = 0x80 with TinyTuner 1
on the serial monitor it says "Knock Bang fault" which makes me think of an error
TinyTuner 1 says 0x80 and TinyTuner 2 says 0x62; shouldn't the values be more or less identical concerning one µC?
And of course I am not so deep into the technical aspects. I've read the calibration chapter in Atmel's datasheet. As far as I understand it, the internal frequency (and so the +/- inaccuracy) mainly depends on voltage+temperature. By writing the OSCCAL byte you can "correct" the frequency to a little bit higher or lower. So for example 0x80 "tunes" the chip higher than 0x62.
But, to be honest, that's all I've understood (meaning: is 0x80 twice 0x40 ?).
Still learning
on the serial monitor it says "Knock Bang fault" which makes me think of an error
Have you checked the Knock Bang source code?
TinyTuner 1 says 0x80 and TinyTuner 2 says 0x62; shouldn't the values be more or less identical concerning one µC?
I've read the calibration chapter in Atmel's datasheet.
Read it again (emphasis added)...
ATtiny85 Datasheet:
The CAL7 bit determines the range of operation for the oscillator. Setting this bit to 0 gives the lowest frequency range, setting this bit to 1 gives the highest frequency range. The two frequency ranges are overlapping, in other words a setting of OSCCAL = 0x7F gives a higher frequency than OSCCAL = 0x80.
The figure labeled Calibrated 8 MHz RC Oscillator Frequency vs. OSCCAL Value will help.
Thank you very much for your patience, still learning
I've found the meaning of the "error code" in the code, thanks for the hint.
And I've read it again: if you still have the patience, may I try to get it right?
The value 0x80 is written in HEX and corresponds to a value of 128 in DEC.
So a value of 0x40 (HEX) corresponds to 64 (DEC) and therefore means a frequency of roughly 6 Mhz (according to the figure you've mentioned).