I can't find any problems.
using the latest and greatest core
Did you get it from the Source tab, Downloads tab, or the Home tab? Maybe one of the links is pointing to something out-of-date.
I can't find any problems.
using the latest and greatest core
Did you get it from the Source tab, Downloads tab, or the Home tab? Maybe one of the links is pointing to something out-of-date.
downloads tab
I think I figured it out, using the instructions here
http://arduino.cc/playground/Linux/Debian
under
Arduino 1.0 and Arduino UNO on Debian squeeze (6.0.3)
arduino would not work correctly, so looking back though what I did I installed arduino and arduino core from the normal repositories, which gives you version 18, then ran the above which gives you 1.0 functioning, but apparently it does not upgrade everything. I tried the version of tiny for arduino 19 and guess what, it works
least for me
so yea I have 1.0 as the IDE and apparently .18 for most of the core files ... !@*#$! linux
Hello, Coding Badly!
Huge thanks for your tiny core!
I've been playing around with a small sketch for Tiny85 (a multifunction 1-Wire slave). I'm not using real Tiny85 yet, but Proteus simulation.
I'm using Arduino v0.22.
At some point I started to get R_AVR_13_PCREL error on each compile.
Then I upgraded WinAVR according to your instructions in your post:
The error has gone and I accomplished everything I wanted.
Today I tried to write some code for Uno board. The code compiles without errors, but when uploading I get error:
avrdude: stk500_getsync(): not in sync: resp=0x00
I can only get rid of it after renaming the old backup "avr_old" folder back to "avr".
Does it mean, that I'll always need to use obsolete toolchain when working with Uno? Or I'm just doing someting wrong?
And 2 more questions:
Hello Kyrill,
Huge thanks for your tiny core!
You are welcome.
Does it mean, that I'll always need to use obsolete toolchain when working with Uno?
I have not had to. I've been using the latest version of WinAVR since long before I created that post. I use my Uno nearly everyday and have had no upload problems.
Or I'm just doing someting wrong?
Could be. Collect verbose output from an upload attempt and post it to the forum.
- Is it possible to run Tiny85 at 16Mhz using internal oscillator and PLL as clock source?
Yes. I think the latest version has a boards entry for it ... yup ... Google Code Archive - Long-term storage for Google Code Project Hosting.
- delay() seems not to work on Tiny85 at 8Mhz (int. osc.). (might be Proteus simulation bug, but it works ok with HLT core).
By default, the Tiny Core uses timer 1 for millis on the ATtiny85 processor whereas the HLT core uses timer 0. Timer 1 on the ATtiny85 is unique in the AVR world. I suspect Proteus does not simulate the timer correctly.
Collect verbose output from an upload attempt and post it to the forum.
I get only one red line:
avrdude: stk500_getsync(): not in sync: resp=0x00
The behaviour of board LEDs is also different. When using old toolchain, after compilation finishes the board resets, then Rx/Tx LEDs flash several times (1/2 seconds for small 2K code), then the board starts to execute code.
With new version, after compilation the board only resets and starts old code execution. The arduino environment still waits about 20 sec with status "uploading", then displays the above described single red line.
By the way, I tried to upload to a Mega1280 board, erevything works ok with both old and new version.
I think the latest version has a boards entry for it
That's cool, didn't notice version 0012 is out. Will definitely try it ASAP.
Timer 1 on the ATtiny85 is unique in the AVR world. I suspect Proteus does not simulate the timer correctly.
OK. Thanks for clarification.
I'm using the arduino tiny software (Google Code Archive - Long-term storage for Google Code Project Hosting.) to try and control two servos with an ATtiny84. I have quite some timing problems as it seems to be. When I connect one servo to pin PA6 and use this software:
// Based on Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
// Changed by Johan
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
int posMin = 17;
int posMax = 65;
void setup()
{
myservo.attach(4); // attaches the servo on pin 4 to the servo object
}
void loop()
{
for(pos = posMin; pos < posMax; pos += 1) // goes from posMin degrees to posMax degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
delay(3000);
for(pos = posMax; pos>=posMin; pos-=1) // goes from posMax degrees to posMin degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
delay(3000);
}
This works well...
However, I need to control two servos. Their position should be the same so I tried to connect them to one output. This makes the servos to jiggle with no avail. I also can't seem to get the servos work on another port.
I have tried using internal clock at 8Mhz and 16Mhz with an external resonator. Also capacitors.
Any ideas?!
Update:
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
int posMin = 17;
int posMax = 65;
void setup()
{
myservo1.attach(4); // attaches the servo on pin 9 to the servo object
myservo2.attach(5); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = posMin; pos < posMax; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo1.write(pos);
delay(7);
myservo2.write(pos); // tell servo to go to position in variable 'pos'
delay(7); // waits 15ms for the servo to reach the position
}
delay(3000);
for(pos = posMax; pos>=posMin; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo1.write(pos);
delay(7);
myservo2.write(pos); // tell servo to go to position in variable 'pos'
delay(7); // waits 15ms for the servo to reach the position
}
delay(3000);
}
this also works when connecting one servo to 4 or 5 but not when I connect two servos to either port.
@jopiek:
One servo on one pin works?
One servo on one pin and a second servo on a second pin works?
Two servos on on pin does not work?
Kyrill:
Collect verbose output from an upload attempt and post it to the forum.
I get only one red line:
avrdude: stk500_getsync(): not in sync: resp=0x00
If you don't get a long sign-on message from avrdude it is not in verbose mode.
I'm using Arduino v0.22.
Hold down the Shift key when you click upload.
@Coding Badly:
Almost:
A with one servo works (B no servo)
B with one servo works (A no servo)
Problems when:
1 connecting two servos to either A or B
2 connecting servos to A and B
Do I need to do anything special to get the 85 working at 128KHz? I had to comment out serial commands and I still get this error:
In file included from C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny\wiring.c:30:
C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny/core_adc.h:55:4: error: #error Add an entry for the selected processor speed.
C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny\wiring.c: In function 'init':
C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny\wiring.c:257: error: 'ADC_ARDUINO_PRESCALER' undeclared (first use in this function)
C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny\wiring.c:257: error: (Each undeclared identifier is reported only once
C:\Users\Nick\Documents\Arduino\hardware\tiny\cores\tiny\wiring.c:257: error: for each function it appears in.)
This is my code, nothing fancy just sequencing the PWM:
int list[7] = {
-1,-1,-1,-1,-1,-1,-1};
byte const set[7] = {
B001,B010,B011,B100,B101,B110,B000};
boolean redo = true;
int x = 0;
int count = 0;
int count7 = 0;
int LED1 = 0;
int LED2 = 1;
int LED3 = 4;
int curVal[3] = {
0,0,0};
int lastVal[3] = {
0,0,0};
int nextVal[3] = {
0,0,0};
void setup(){
//Serial.begin(9600);
//Serial.println("Reset");
randomSeed(analogRead(0));
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
writeList();
for (int i = 0;i<3;i++){
nextVal[i] = (bitRead(set[list[0]],i)==1)? 255:0;
}
//Serial.print(list[0]);
}
void loop(){
for(int i=0;i<3;i++){
curVal[i] = map(count,0,255,lastVal[i],nextVal[i]);
}
analogWrite(LED1,curVal[0]);
analogWrite(LED2,curVal[1]);
analogWrite(LED3,curVal[2]);
if(count==255){
count = 0;
if (++count7==7){
count7 = 0;
//Serial.println(" ");
writeList();
}
for (int i = 0;i<3;i++){
lastVal[i] = nextVal[i];
nextVal[i] = (bitRead(set[list[count7]],i)==1)? 255:0;
}
//delay(map(analogRead(1),0,1023,1,50) * 200);
delay(200);
// Serial.print(list[count7]);
}
count++;
//delay(map(analogRead(1),0,1023,1,50));
delay(1);
}
void writeList(){
int l = list[6];
for(int i = 0;i<7;i++){
list[i] = -1;
}
for(int i = 0;i<7;i++){
redo = true;
while(redo){
x=random(7);
if(list[x]==-1){
redo=false;
list[x] = i;
}
}
}
if(list[0]==l){
int y = random(1,7);
x= list[y];
list[y] = list[0];
list[0] = x;
}
}
It works fine on any of the other attiny85 settings
thanks
stoopkid:
Do I need to do anything special to get the 85 working at 128KHz?
Huh. I don't remember why I added that board option. I know I didn't test it. Oh well.
• Open core_build_options.h
• Change INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER from 1 to zero. The are of interest is...
http://code.google.com/p/arduino-tiny/source/browse/trunk/hardware/tiny/cores/tiny/core_build_options.h#28
• Save and close core_build_options.h
Bear in mind that analogRead will no longer be available.
Hello,
I am trying to compile a small test sketch for Attiny4313 using latest core and Arduino 1.0 IDE. The sketch below compiles for Attiny2313, compiling under Attiny4313 throws an error:
unknown MCU 'attiny4313' specified
Known MCU names:
avr2
at90s2313
at90s2323
at90s2333
...
Is attiny4313 recognized in the (older) version of WinAVR included with ARDUINO 1.0, or am I doing something wrong?
Thanks,
George
/* Attiny4313 example (G.Small, 24Mar2012)
Example of Attiny4313 on Arduino Tiny core, with serial comms test
ATMEL 6 PIN ISP CONNECTOR TOP VIEW:
+---+
MISO 1 |o o| 2 +Vcc
(SCL, to UNO A5) SCK 3 |o o| 4 MOSI (SDA, to UNO A4)
/RESET 5 |o o| 6 GND
+---+
ATMEL AttinyX313/ARDUINO:
+-\/-+
(D 17) PA2 1| |29 VCC
RX (D 0) PD0 2| |19 PB7 (D 16)
TX (D 1) PD1 3| |18 PB6 (D 15)
(D 2) PA1 4| |17 PB5 (D 14)
(D 3) PA0 5| |16 PB4 (D 13)*
INT0 (D 4) PD2 6| |15 PB3 (D 12)*
INT1 (D 5) PD3 7| |14 PB2 (D 11)*
(D 6) PD4 8| |13 PB1 (D 10)
*(D 7) PD5 9| |12 PB0 (D 9)
GND 10| |11 PD6 (D 8)
+----+
* indicates PWM port
These arrays map port names (e.g. port B) to the appropriate addresses
for various functions (e.g. reading and writing)
*/
#define LED_PIN 6 // ATtiny Pin 8 (D6)
void setup(){
pinMode(LED_PIN,OUTPUT); // for general DEBUG use
LED_Blink(LED_PIN,2); // show it's alive
Serial.begin(9600);
}
void loop() {
int test = 31;
Serial.print("test");
LED_Blink(LED_PIN,1); // show it's alive
}
// LED blinker for status
void LED_Blink(byte pin, byte times){
for (byte i=0; i< times; i++){
digitalWrite(pin,LOW);
delay (1000);
digitalWrite(pin,HIGH);
delay (1000);
}
}
Is attiny4313 recognized in the (older) version of WinAVR included with ARDUINO 1.0,
No.
or am I doing something wrong?
Nope. Compiles just fine.
There are instructions in the forum for upgrading to the latest version of WinAVR. If you can't find them, let me know.
Thanks once again for the help. I updated my Arduino WinAVR. I had to copy over avrdude.exe 5.11 and avrdude.conf from Arduino 1.0 folder to get my Pololu AVR USB Programmer to work but everything is now functional!
Thanks,
George
- delay() seems not to work on Tiny85 at 8Mhz (int. osc.). (might be Proteus simulation bug, but it works ok with HLT core).
By default, the Tiny Core uses timer 1 for millis on the ATtiny85 processor whereas the HLT core uses timer 0. Timer 1 on the ATtiny85 is unique in the AVR world. I suspect Proteus does not simulate the timer correctly.
I finally tried on real hardware, yes, delay() works ok, that's really a Proteus bug.
- Is it possible to run Tiny85 at 16Mhz using internal oscillator and PLL as clock source?
Yes. I think the latest version has a boards entry for it ... yup ... Google Code Archive - Long-term storage for Google Code Project Hosting.
I've tried running both options - 8 MHz and 16 Mhz PLL - blink works ok on both, timing is correct.
But I ran into problem with Serial (one-way-tx-only). At 8 MHz it works ok. I even successfully ran TinyTuner. But at 16 Mhz PLL it doesn't work. Even at 9600 bps nothing is transmitted.
I use IDE v.1.0 and tiny core ver. 0012.
What do you think could be wrong?
An one more question: the guys mentioned a "modded" NewSoftSerial, could you give a hint where to find it?
One
Kyrill:
I finally tried on real hardware, yes, delay() works ok, that's really a Proteus bug.
Excellent. (that it works not that Proteus has a bug)
I've tried running both options - 8 MHz and 16 Mhz PLL - blink works ok on both, timing is correct.
More good news. Nice!
But I ran into problem with Serial (one-way-tx-only).
The stuff that comes with the Tiny Core? Tiny Debug Serial?
At 8 MHz it works ok. I even successfully ran TinyTuner. But at 16 Mhz PLL it doesn't work. Even at 9600 bps nothing is transmitted.
#if F_CPU <= 8000000L
// port B bit 3 (PB3)
#define TINY_DEBUG_SERIAL_REGISTER 0x18
#define TINY_DEBUG_SERIAL_BIT 3
#else
// port B bit 2 (PB2)
#define TINY_DEBUG_SERIAL_REGISTER 0x18
#define TINY_DEBUG_SERIAL_BIT 2
#endif
A different pin is used at 16 MHz. I assumed that a crystal or resonator would be connected. You can either adjust the code above (in TinyDebugSerial.h) or use the alternate pin.
An one more question: the guys mentioned a "modded" NewSoftSerial, could you give a hint where to find it?
There was a discussion here in the forum. Try searching. If you can't find it, report back and I'll make an attempt.
You can either adjust the code above (in TinyDebugSerial.h) or use the alternate pin.
Thank you. I preferred to edited the file. After OSCCAL adjustment it works perfectly, even at 115200 bps.
Dear Coding Badly
I've now run into another problem.
After studying the Attiny85 datasheet I'm tryin to utilize timer1 for precise pulse control.
I freed timer1 by modifying wiring.c (as you wrote earlier).
My intent is to be able to set precise pause length and pulse length of aech indiviual pulse.
I use following setup:
void setup() {
pinMode(4,OUTPUT); //needed for OC1B
digitalWrite(4,LOW);
pinMode(3,OUTPUT); //needed for myself
digitalWrite(3,LOW);
TCCR1 = 0b1000; // clock ck/128
GTCCR =
(1<<PWM1B) |
(1<<COM1B1) | (1<<COM1B0) ; // <<PROBLEM HERE
OCR1B = 41;
OCR1C = 100;
}
I need the pin to go low on OCR1C compare match and then go high on OCR1B compare match.
So according to above code I should get a pause of 41 ticks and then a pulse of 59 ticks and so on.
But something goes wrong. I get only a constant HIGH state on pin4.
I tried to use (1<<COM1B1) | (0<<COM1B0) instead, and it works ok (!), but the signal gets actually inverted, that's not what I need.
(0<<COM1B1) | (1<<COM1B0) also works ok, I get signal on two pins and one of them (pin 3) is "inverted inverted", thus suitable for me, but that wastes one pin (pin4), which I need to use as I/O, so that's not ok for me also.
Could you give a hint?
I'll try to look more closely at it tomorrow but I believe you have to set CTC1 in TCCR1...
TCCR1 =
(1 << CTC1)
| (0 << PWM1A)
| (0 << COM1A1) | (0 << COM1A0)
| (1 << CS13) | (0 << CS12) | (0 << CS11) | (0 << CS10);
The datasheet says that in PWM mode the counter is reset on OCR1C compare match regardless of CTC1 bit state. Anyway I already tried setting CTC1, that didn't help.