AtTiny84 - Few questions

Hello

I am just building an an IO board for a project, which will have its own processor on board, and I have decided to use the AtTiny84.

I am just wanting to check a few things as I havent used a AtTiny before where so many things are shared on pins.

One of these is how to hook up the header for programming in the bootloader, just to make sure I have it right .

Very noob type question, but just want to make sure - pretty sure this is right, but I have been fooled before.

The 6 or 10 pin ISCP header, are these correct?:
MOSI goes to PA6 (which does state MOSI in the description)
MISO goes to PA5 (which states MISO in the desc)
SCK goes to PA4? (it states USCK, assume this is correct?)
RESET goes to PB3 (assuming as RESET is in the desc)

The datasheet refers to these ports as part of the 'USI 3 wire mode' - which I havent heard of referenced as that before, but I assume this is what the bootloader is programmed over.

For I2C comms, are these correct?:
I2C-SCL goes to PA4?
I2C-SDA goes to PA6?

The datasheet refers to these as part of the 'USI 2 wire mode' which I assume is the TWI/I2C?

From reading on here, there is a bootloader already written to suit the '84, I can only assume it works as desired and people are using it no problems...

This particular board will be communicating to a main board which will have a ATMega1284P on it, via I2C comms.
The board is going to be used solely for counting pulses, basically a high speed counter board. I need to utilise either 2 of 4 external interrupts. I notice this chips has INT0 and then has Pin Change interrupts... another assumption is that these pin change interrupts function in a similar way to the normal external interrupts say on a standard Arduino board?
I need to do more reading, but if someone knows straight off if these can be used just like a normal interrupt, where they can trigger an ISR etc, then that would be great to tell me.

Thanks in advance

James

Datasheet here:

Talking from a general point of view, not the IDE as I've not used it yet.

PCIs generate an interrupt almost the same as INT0. If you only have 1 PCI then for your application they are essentially the same.

If you have 2 on seperate ports (ie A and B) then each will get its own vector and once again almost the same as INT0, any more than that and you have to decide which pin changed state and that will take a little bit longer so there is a slight time penalty in doing so.

Ah I see - I knew there had to be some sort of sacrifice.

So with these Tiny's, there are only 2 ports, bugger.

I see the pin that INT0 uses is also PCINT10... how does that work?
From what I can tell, INT0 has the highest priority, but why would you use PCINT10 if you could use INT0?

PCINT10 in on Port B, and INT0 is therefore on Port B too... But I assume INT0 will have its own vector?
So in saying that, can I have 3 interrupts which use seperate vectors? INT0, a PCINT from Port A and a PCINT from Port B?

Is that correct, or assuming incorrectly.

Ta

Actually, looking further - Port B only has the two XTAL pins, the Reset pin, and the INT0 pin... so thats not much use.

hmm.

I see the pin that INT0 uses is also PCINT10... how does that work?

I would think that if they both occured at the same time (and of course both enabled) then INT0 would be served first because it's vector is lower. When you exit the ISR you'll get the PCI10. I doubt there's any reason to use both but there may be something I can't think of right now.

So in saying that, can I have 3 interrupts which use seperate vectors? INT0, a PCINT from Port A and a PCINT from Port B?

That's right, but if you are using a crystal and normal ISP then you only have two vectors to use INT0/PCI10 and any PCI on port A.

If you use high-voltage programming you can also use PCI11 on PB3 (the reset pin) but you won't have a reset function, often this doesn't matter.

Having said all this I think you'd have to be counting something pretty fast to be worried about the time taken to determine which PCI was received, so you should be able to use all the port A PCIs.

Another question on this... how do you program these chips with arduino IDE if there is no serial port for a FTDI header? I know you can put the bootloader in via the ICSP header, but can you program the chip with Arduino IDE through this too, or do you have to use another program?

Thanks

Forget that, a quick search found a discussion for the attiny85 which is in the same boat.
Maybe I will use a slightly larger, but still small atmega instead of the 85, one with a UART - im not pressed for size and making the upload progress easier until a 'proper' method of uploading using IDE is found - I think I will just wait.

I use a command line and avr dude, but what your doing is connecting the spi ports together

84<> arduino setup with/as avrisp

4<>10
7<>11
8<>12
9<>13

if you modify your preferences.txt to use your programmer you can click to load

now if your using another programmer you need to look up what ICSP pins do what, but its the same deal

PS: proper? you should get familiar with avrdude anyway and there is nothing really proper about the IDE other than it functions

Maybe I will use a slightly larger, but still small atmega instead of the 85, one with a UART - im not pressed for size and making the upload progress easier until a 'proper' method of uploading using IDE is found - I think I will just wait.

To work with these limited capacity devices, you really need a programmer, and once you have one you don't need a bootloader. There is no real challenge for an experienced programmer to write an AtTiny bootloader, but there is also no need for one.

Porting Arduino to AtTiny is more of a programming exercise than anything else. Those individuals who work on the port will learn a lot about the AVR architecture in general as well as the Arduino core and IDE specifically. For the rest of us however there really isn't much to gain from this that we don't have already.

To learn about programming a wider range of the AVR family - then get yourself a programmer and start reading datasheets. If you want to stay within the comfort zone of Arduino, the better approach is to stick to the fully supported devices.

Hi guys, thanks for the replies.

I am familar with AVR Dude, and have used Bascom-AVR and Pony-prog etc prior to moving to Arduino IDE.

By proper I meant for an offical type method from the Arduino IDE, rather than skipping to another program in order to achieve the desired result.

What I am trying to do is build a Arduino programmed modular system which I can use on a number of projects, both private and commercial which I can just use 1 programming package for, rather than writing the main code in Arduino and then having to go to something else to program or write the code.

I have a old Parallel ICSP programmer aswell as a newer Sparkfun USB programmer which I use to program the bootloaders.

I have now redesigned the board I had the 85 on, to use a standard 168 instead, as there isnt much in the cost and a few more pins dont matter - just the ease of use with Arduino IDE appealed, and using the same cable. Petty I know.

Thanks for the replies
James

Looking at the 2313 datasheet, I could have actually used that as it has INT0 and INT1, plus 2 other ports for PCINT's, seperate XTAL pins, I2C and a UART.

Ah well.

course you change 1 line and you can click n go with a programmer, to me the programmer would be the odd step not editing a line in a config file