tcworld / attinycore Goto Github PK
View Code? Open in Web Editor NEWATTiny Core for Arduino 1.0+
ATTiny Core for Arduino 1.0+
Based on whether it's running with your tiny core or the regular Arduino core, I'd like to have my Arduino library automatically switch between SPI.h or TinySoftwareSPI.h - is there any existing define I could reliably check for, or would it be an option to include something like
#define ATTinyCore 1
into tiny/.../Arduino.h ?
Or perhaps even better, add a define USE_SOFTWARE_SPI into pins_arduino.h ?
This has been moved from another issue as it was unrelated
Hi Guys
I love this atuo SPI thing and currently have it working with RF24 library and NRF modules but am really battling to get it working with ATTINY84 ... I'm not sure how the pin mappings work . I have wired according to variants and various other combinations.
I there a walk-through and perhaps a pin mapping config I could check/change to get it working please ?
Tom I have emailed you but have had no response. Is there a way to contact you to discuss this issue ?
Regards
Den
I downloaded the latest cores as of 7 June 2014 and I get the following error when trying to compile a basic "blink" sketch with any board. I was able to do a quick n' dirty fix by using the previous HardwareSerial .cpp and .h files.
Arduino/hardware/ATTinyCore/cores/tiny/HardwareSerial.cpp:147:2: error: #else after #else
Arduino/hardware/ATTinyCore/cores/tiny/HardwareSerial.cpp:77:1: error: the conditional began here
Arduino/hardware/ATTinyCore/cores/tiny/HardwareSerial.cpp:33:1: error: unterminated #if
I am new to this chip, but this seems like a strange way of doing things and I believe this diverges from the way other attiny cores do this.
Admittedly, I could be doing something wrong. I am using the ATTiny84, and Using this pin mapping from https://github.com/TCWORLD/ATTinyCore/blob/master/tiny/variants/tinyX4/pins_arduino.h
I was expecting the following code to work by addressing the chip pin (would have been 13), but instead I had to reference pin 10.
int led = 10;
// the setup r1utine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Like I said, there is a good chance that I am missing something, but this seemed off.
I'm trying to program a blank ATtiny167 on a custom PCB with Arduino-style 6-pin ICSP header, using an Atmel AVRISPmkII (on MacOSX), but avrdude fails with "avrdude: AVR Part "attiny167" not found." (and the rest of avrdude's output lists the chips it does support, and ATtiny87/167 isn't among them).
Sure enough, there's no reference to the tiny87/tiny167 in the avrdude.conf within the stock-standard Arduino 1.0.5 IDE (& not even in the UECIDE-Core/../tools, either).
What am I missing? Do I need to dive into the 87/167 datasheet & create the required entries in avrdude.conf myself? Or were these just forgotten in the current build? ;) (please please let it be the latter! lol)
A bit of background on what i've done: I've installed this aweseome ATtinyCore package (ie. copied this package's /tiny/. into the /hardware/tiny/. ), selected "ATtiny167 @ 8MHz (internal oscillator, BOD enabled)" in Tools > Board; it compiles fine (no warnings either), & then Shift+Upload to program it with the AVRISPmkII.
thanks, Anthony.
I've been looking for a way to program an ATtiny85 using an ATmega328, but being able to select which pins are SS, MOSI, MISO because I can't use the normal SPI pins. Some googling led to your code (TinySoftwareSPI), but I don't understand how I would use it. Also since your email is hidden, had to try contacting through issue report. Sorry about that but that seems to be the only way
Please do so ๐
Hi,
I try to test the last version, and I've got this kind off error message:
"C:\Documents and Settings\Olivier\Mes documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:125: error: 'port_to_output_PGM' has a previous declaration as 'const uint16_t port_to_output_PGM []"
Can you help me ?
Olivier
I'm happy to take a shot at the pins_arduino.h file for the ATTiny88 and test on it.
Can you describe the test procedure? How do I build an empty/tiny core for the device? gcc-avr? Also, is the empty core sufficient for deploying code (ie. a blink sketch or similar) to the 88?
Michele Menniti found out in pins_Arduino.h is missing the lines:
//If Software Serial communications doesn't work, run the TinyTuner sketch provided with the core to give you a calibrated OSCCAL value.
//Change the value here with the tuned value. By default this option uses the default value which the compiler will optimise out.
//e.g
//#define TUNED_OSCCAL_VALUE 0x57
Maybe helping you, that is the stacktrace :
In file included from C:\Users\ttx\Documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:159,
from C:\Users\ttx\Documents\Arduino\hardware\tiny\cores\tiny/wiring_private.h:35,
from C:\Users\ttx\Documents\Arduino\hardware\tiny\cores\tiny\wiring_digital.c:29:
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:135: error: conflicting types for 'port_to_mode_PGM'
C:\Users\ttx\Documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:123: error: previous declaration of 'port_to_mode_PGM' was here
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:142: error: conflicting types for 'port_to_output_PGM'
C:\Users\ttx\Documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:125: error: previous declaration of 'port_to_output_PGM' was here
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:149: error: conflicting types for 'port_to_input_PGM'
C:\Users\ttx\Documents\Arduino\hardware\tiny\cores\tiny/Arduino.h:124: error: previous declaration of 'port_to_input_PGM' was here
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:158: error: 'PORT_A_ID' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:160: error: 'PORT_B_ID' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:200: error: 'TIMER1AX' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:200: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:200: error: (near initialization for 'digital_pin_to_timer_PGM[2]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:202: error: 'TIMER1AU' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:202: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:202: error: (near initialization for 'digital_pin_to_timer_PGM[4]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:203: error: 'TIMER1BU' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:203: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:203: error: (near initialization for 'digital_pin_to_timer_PGM[5]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:204: error: 'TIMER1AV' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:204: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:204: error: (near initialization for 'digital_pin_to_timer_PGM[6]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:205: error: 'TIMER1BV' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:205: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:205: error: (near initialization for 'digital_pin_to_timer_PGM[7]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:206: error: 'TIMER1AW' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:206: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:206: error: (near initialization for 'digital_pin_to_timer_PGM[8]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:207: error: 'TIMER1BW' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:207: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:207: error: (near initialization for 'digital_pin_to_timer_PGM[9]')
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:213: error: 'TIMER1BX' undeclared here (not in a function)
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:213: error: initializer element is not constant
C:\Users\ttx\Documents\Arduino\hardware\tiny\variants\tinyX7/pins_arduino.h:213: error: (near initialization for 'digital_pin_to_timer_PGM[15]')
Hi,
Thank for your job about the attiny cores, i am working with attiny84 (using jeelib) and it's works well, but i work on attiny87/167 and i've issue in my arduino IDE, about Serial not declared ...(o've had the same issue with ATTINY84 and resolved by the core updated) i've seen that your job for attiny87 is in progress? could you help me to integrate a fonctional core for attiny87 ?
Thanks for your answer,
I'm really stuck...
Michael
Hi,
I download your project and unzip in my arduino IDE(1.06) hardware folder.
and i make a new boards.txt as it:
attiny24-8.name=ATtiny24 (internal 8 MHz clock)
attiny24-8.bootloader.low_fuses=0xe2
attiny24-8.bootloader.high_fuses=0xdf
attiny24-8.bootloader.extended_fuses=0xff
attiny24-8.upload.maximum_size=2048
attiny24-8.bootloader.path=empty
attiny24-8.bootloader.file=empty24at16.hex
attiny24-8.build.mcu=attiny24
attiny24-8.build.f_cpu=8000000L
attiny24-8.build.core=tiny
attiny24-8.build.variant=tinyX4
i burn the bootloader to tiny24 and write a sketch:
void setup() {
// initialize digital pin 13 as an output.
pinMode(3, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(3, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
i burn it to tiny24 but nothing happend.
i had try the code at https://github.com/damellis/attiny/archive/master.zip
it can works but it can not compile the Serial lib.
please help!
The current code seems to allow at most 8 ADC channels (due to 'pin & 0x07' here):
https://github.com/TCWORLD/ATTinyCore/blob/master/tiny/cores/tiny/wiring_analog.c#L61
Is this intentional, as some Tinys don't have more?
Not sure where to put this. ATtiny48 tests okay using the addition to avrdude.conf below (as well as an appropriate boards.txt entry).
#------------------------------------------------------------
# ATtiny48
#------------------------------------------------------------
part
id = "t48";
desc = "attiny48";
has_debugwire = yes;
flash_instr = 0xB6, 0x01, 0x11;
eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
0x99, 0xF9, 0xBB, 0xAF;
stk500_devcode = 0x72;
# avr910_devcode = 0x;
signature = 0x1e 0x92 0x09;
pagel = 0xd7;
bs2 = 0xc2;
chip_erase_delay = 9000;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
"x x x x x x x x x x x x x x x x";
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
"x x x x x x x x x x x x x x x x";
timeout = 200;
stabdelay = 100;
cmdexedelay = 25;
synchloops = 32;
bytedelay = 0;
pollindex = 3;
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
pollmethod = 1;
pp_controlstack =
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
hventerstabdelay = 100;
progmodedelay = 0;
latchcycles = 5;
togglevtg = 1;
poweroffdelay = 15;
resetdelayms = 1;
resetdelayus = 0;
hvleavestabdelay = 15;
resetdelay = 15;
chiperasepulsewidth = 0;
chiperasepolltimeout = 10;
programfusepulsewidth = 0;
programfusepolltimeout = 5;
programlockpulsewidth = 0;
programlockpolltimeout = 5;
memory "eeprom"
paged = no;
page_size = 4;
size = 64;
min_write_delay = 3600;
max_write_delay = 3600;
readback_p1 = 0xff;
readback_p2 = 0xff;
read = " 1 0 1 0 0 0 0 0",
" 0 0 0 x x x x x",
" x a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
write = " 1 1 0 0 0 0 0 0",
" 0 0 0 x x x x x",
" x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
loadpage_lo = " 1 1 0 0 0 0 0 1",
" 0 0 0 0 0 0 0 0",
" 0 0 0 0 0 0 a1 a0",
" i i i i i i i i";
writepage = " 1 1 0 0 0 0 1 0",
" 0 0 x x x x x x",
" x a6 a5 a4 a3 a2 0 0",
" x x x x x x x x";
mode = 0x41;
delay = 20;
blocksize = 4;
readsize = 64;
;
memory "flash"
paged = yes;
size = 4096;
page_size = 64;
num_pages = 64;
min_write_delay = 4500;
max_write_delay = 4500;
readback_p1 = 0xff;
readback_p2 = 0xff;
read_lo = " 0 0 1 0 0 0 0 0",
" 0 0 0 0 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
read_hi = " 0 0 1 0 1 0 0 0",
" 0 0 0 0 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
loadpage_lo = " 0 1 0 0 0 0 0 0",
" 0 0 0 x x x x x",
" x x x a4 a3 a2 a1 a0",
" i i i i i i i i";
loadpage_hi = " 0 1 0 0 1 0 0 0",
" 0 0 0 x x x x x",
" x x x a4 a3 a2 a1 a0",
" i i i i i i i i";
writepage = " 0 1 0 0 1 1 0 0",
" 0 0 0 0 a11 a10 a9 a8",
" a7 a6 a5 x x x x x",
" x x x x x x x x";
mode = 0x41;
delay = 6;
blocksize = 32;
readsize = 256;
;
memory "lfuse"
size = 1;
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
"x x x x x x x x i i i i i i i i";
;
memory "hfuse"
size = 1;
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
"x x x x x x x x i i i i i i i i";
;
memory "efuse"
size = 1;
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
"x x x x x x x x x x x x x o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x x x i";
;
memory "lock"
size = 1;
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"x x x x x x x x x x o o o o o o";
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
;
memory "calibration"
size = 1;
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
memory "signature"
size = 3;
read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
"x x x x x x a1 a0 o o o o o o o o";
;
;
tryng to compile some code for attiny 2313 a friend of mine has error:
C:..\tiny_TCW_2.0_prove4313\cores\tiny\HardwareSerial.cpp: In function 'void __vector_8()':
C:..\tiny_TCW_2.0_prove4313\cores\tiny\HardwareSerial.cpp:192:12: error: lvalue required as left operand of assignment
line seems to be "UDR0 = c;" but this tiny should use "UDR"
I noticed two issues when using your Optiboot Makefile to make and flash bootloader code for the ATtiny84. I am specifically using an ATTiny84 at 8MHz. This issue may also be applicable to other chip variants and/or frequencies.
Once I fixed those issues, I was able to successfully make the firmware using "make attiny84" and flash the device and set the fuses with "make attiny84_isp". I attempted to use the tinytuner code but it did not seem to be set properly for the ATtiny84 either. I'll have to figure out what's going on there and submit a separate issue. Basically the instructions say to connect via software serial at 9600 baud and type "x" but it looks like it starts up at 19200 baud. My default oscillator values must have been OK since I didn't have any issue loading code from the Arduino IDE (1.0.3) when using the non-tuned Optiboot.
Thanks for your great software! It's fun being able to use ATtinys like their big brothers.
Can you explain me how to integrate attiny261 ? (I think is the same ac
Hello,
At try burn bootloader to Attiny85@16MHZ (internal PLL; 4V3 BOD):
avrdude: Device signature = 0x1e930b
avrdude: erasing chip
avrdude: reading input file "{bootloader.unlock_bits}"
avrdude: invalid byte value ({bootloader.unlock_bits}) specified for immediate mode
avrdude: read from file '{bootloader.unlock_bits}' failed
I'm using a Nano board v3.0 as Arduino ISP (Arduino ISP version 04m3) from samples code menu.
The code from https://github.com/damellis/attiny/tree/ide-1.6.x works fine, but has not 16MHZ PLL.
Thank you!
What I just did not do. WDT running is installed. But the WDT interrupt does not work. There are methods how to fix it?
ATtiny85 interrupt works!
I think (although I haven't yet got a ATTINY861A in front of me) that the final pin assignment in the digital_pin_to_bit_mask_PGM array is wrong. It currently assigns pin 15 to PB0. Digital pin 9 has already been assigned to PB0, so I think the last entry in digital_pin_to_bit_mask_PGM should be _BV(7) as that is the remaining unused pin in the PORTB block.
I am experiencing damellis/attiny#9 also with your attiny85 core.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.