Go Down

Topic: Where to start: arduino-tiny (Read 973 times) previous topic - next topic

bill2009

Jan 09, 2014, 01:58 pm Last Edit: Jan 09, 2014, 03:55 pm by bill2009 Reason: 1
I have another project where I would like to include an attiny - right now it's an attiny84.  It would be an spi slave on one side connected to PC-serial on the other side - needs to be bidirectional.  

-downloaded the latest 1.0-type library from here 0018 from google code
https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0018.zip

-put it in the sketch folder and copied the "attiny84at8.name=ATtiny84 @ 8 MHz  (internal oscillator; BOD disabled)" board type to a new boards.txt

-cobble up a breadboard connection for the '84 and start playing with code

Is there a worked example or tutorial somewhere?

I bet a lot of people would appreciate it if there was a sticky at the head of this forum that would point to the latest stable tiny cores and tutorials/examples of use.

Edit: And the sticky should tell you how to track which pin is which and what is supported e.g. serial in/out

bill2009

Ok, I've switched to a 2313 and I have my breadboard setup working to do a blink under avr studio 4.

next step: the IDE with attiny2313at8.name=ATtiny2313 @ 8 MHz


ralphd

The Serial class in tiny cores is ouput only, so you'll need to use another serial library to receive.
Unthinking respect for authority is the greatest enemy of truth - Einstein.

bill2009

#3
Jan 09, 2014, 03:54 pm Last Edit: Jan 09, 2014, 03:56 pm by bill2009 Reason: 1

The Serial class in tiny cores is ouput only, so you'll need to use another serial library to receive.



thanks: is this true for the 2313 as well?  It might just be easier for me to use avr studio.  I have a good sized arduino program that I want to port though so I'd much rather stick with the IDE.

also: how do i map which pin is where for the various processors?

bill2009

well here's a bunch of no fun - it compiles but it won't load.  I know it works in studio with avrisp on com4 so I've selected "attiny2313at8.upload.protocol=avrispv2"  and port com 4.  I get the first set of gibberish.  Tried using "upload using programmer" with programmer set to avrisp and i get the second set of gibberish - which looks a bit more informative at least.

ralphd



The Serial class in tiny cores is ouput only, so you'll need to use another serial library to receive.



thanks: is this true for the 2313 as well?  It might just be easier for me to use avr studio.  I have a good sized arduino program that I want to port though so I'd much rather stick with the IDE.

also: how do i map which pin is where for the various processors?


Even though the 2313 has a UART, I don't think tiny cores uses it.  Better check the code to be sure though.
For mapping the pins you have to change the TinyDebugSerial library code.  Here's another thread discussing serial options:
http://forum.arduino.cc/index.php?topic=207467.0

Unthinking respect for authority is the greatest enemy of truth - Einstein.

Erni

You can find the pin asignment in pins_arduino.c

This is for ATtiny2313:

Code: [Select]
// ATMEL ATTINY2313
//
//                   +-\/-+
//      (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


http://www.ernstc.dk/arduino/2313.htm

bill2009


You can find the pin asignment in pins_arduino.c

This is for ATtiny2313:

Code: [Select]
// ATMEL ATTINY2313
//
//                   +-\/-+
//      (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


http://www.ernstc.dk/arduino/2313.htm

Brilliant - thanks.  I foolishly looked in pins.arduino.h thinking they'd be in a header file.

bill2009

And I can get it to load by manually issuing the same command the ide was using changing its -c parameter from -cstk500v1 to -cavrispv2 based on reading the pololu programmer web site.

Code: [Select]
C:\Users\Bill>H:\apps\arduino-1.05\arduino-1.0.5\hardware/tools/avr/bin/avrdude
-CH:\apps\arduino-1.05\arduino-1.0.5\hardware/tools/avr/etc/avrdude.conf -pattin
y2313 -cavrispv2 -P\\.\COM4 -Uflash:w:C:\Users\Bill\AppData\Local\Temp\build4423
638441239336499.tmp\Blink.cpp.hex:i


That led me to try changing the boards.txt to "attiny2313at8.upload.using=pololu" but nope, that wants a usb connection.

I wonder if "programmers.txt" is still a thing.

Erni

#9
Jan 09, 2014, 04:32 pm Last Edit: Jan 09, 2014, 04:34 pm by Erni Reason: 1
This is the entry in programmers.txt  I used when I used the pololu programmer

Code: [Select]

pololu.name=Pololu USB AVR Programmer
pololu.communication=serial
pololu.protocol=avrispv2


edit:
and in boards.txt uncomment pololu programmer

Code: [Select]
# The following DO work (pick one)...
#attiny85at16e.upload.using=arduino:arduinoisp
# attiny85at16e.upload.protocol=avrispv2
attiny85at16e.upload.using=pololu

bill2009


This is the entry in programmers.txt  I used when I used the pololu programmer

Code: [Select]

pololu.name=Pololu USB AVR Programmer
pololu.communication=serial
pololu.protocol=avrispv2


edit:
and in boards.txt uncomment pololu programmer

Code: [Select]
# The following DO work (pick one)...
#attiny85at16e.upload.using=arduino:arduinoisp
# attiny85at16e.upload.protocol=avrispv2
attiny85at16e.upload.using=pololu



**YES SIR**
Thank you VERY much.

Erni


bill2009

ok, thanks again.  I got the 2313 working and i've now got the '84 working, I understand software serial works there so I'll be using that.


bill2009

Thanks again for the help, software serial works fine at 57600 - now on to the spi bridge and memory challenges.  For one thing I need a 256 byte input buffer!

Go Up