Maker Pro
Maker Pro

TWI code example for two AVR

S

SioL

pidy said:
uhm... what u mean??

It means you just need to configure one of the AVR as a slave and
the other as a master. Should be pretty easy.

I suggest you setup the master first and than test it with a known working
slave, perhaps eeprom. Once that is working setup the other AVR as a slave
and work on it until the entire system is working.

It may be helpful to have storage scope or logic analyzer to check the bus,
if you get stuck.

C source for slave and master is available from atmel or avrfreaks, its the asm
code that's a bit harder to find from my experience (but it exists as well).

http://www.atmel.com/dyn/products/app_notes.asp?family_id=607
check avr310,avr311 and others

SioL
 
E

Eeyore

SioL said:
It means you just need to configure one of the AVR as a slave and
the other as a master. Should be pretty easy.

I suggest you setup the master first and than test it with a known working
slave, perhaps eeprom.

Exactly what I'd do too.

Once that is working setup the other AVR as a slave
and work on it until the entire system is working.

It may be helpful to have storage scope or logic analyzer to check the bus,
if you get stuck.

I've never needed it. It's so easy to code it's hardly worth that kind of trouble.

C source for slave and master is available from atmel or avrfreaks, its the asm
code that's a bit harder to find from my experience (but it exists as well).

http://www.atmel.com/dyn/products/app_notes.asp?family_id=607
check avr310,avr311 and others

Philips ( NXT ) have or did have asm51 code for I2C.

Graham
 
S

SioL

Eeyore said:
I've never needed it. It's so easy to code it's hardly worth that kind of trouble.

The "hardware" TWI/I2C on Tiny26 is truly lame, I got stuck there.

Mega8 for example with true hw I2C is so much easier. So is just banging
two pins via SW.

SioL
 
R

Rich Grise

Hi,

I need code examples using TWI between two AVR units (in a Master->Slave
configuration)

I have seen examples either with only a Master and an EEPROM or something
else slave, but no examples of a full-blown communication channel between
two AVRs.

I m using AT90CAN128 but i think also code for generic AVR device its ok.

You're supposed to study the master code, and figure out how to implement
the slave.

That's why it's called "school".

It's not a difficult assignment, if you've been paying attention in class
so far.

Good Luck!
Rich
 
Top