Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

AVR Atmega TWI Module

Status
Not open for further replies.

tyassin

Advanced Member level 1
Joined
Jul 22, 2004
Messages
467
Helped
86
Reputation
170
Reaction score
41
Trophy points
1,308
Activity points
3,803
Hello,

All Atmels Atmega processors have USI(Universal Serial Interface). Then there are TWI(Two Wire Interface), which I guess is just an option in the USI. Among some processors, I have noticed some have a so-called TWI-Module.
Could someone tell what is the difference between this TWI-module and the standard TWI?

Hope someone understand and could give some input.

Regards
 

I haven't used USI, I just saw this in ATmega169 datasheet when I used this MCU. As far as I understood it is an interface that can be used as TWI, SPI, USART but with some limitations. It integrates some other modes also including timer modes and external interrupt. It seems like an interesting tool but as I said I have never used it.

With the term "TWI" we mean the protocol in general (compatible with Philips' I2C). TWI module on the other hand is meant to be all the integrated hardware that composes the TWI subunit of the MCU (containing bitrate generator, bus interface etc) and it is dedicated on this purpose only, that is TWI and nothing else.


Alexandros
 
Last edited:

Hello Alexandros,

OK I see.
What I am interested in knowing is how much extra work if any, there would be to implement the same code in the ordinary TWI compared to a processor with the TWI-module?

Thanks
 

tyassin said:
What I am interested in knowing is how much extra work if any, there would be to implement the same code in the ordinary TWI compared to a processor with the TWI-module?

What do you mean by that? The TWI module implements the TWI protocol. There is no extra work. Write your TWI functions and as soon as they work correctly you are ready. If I am missing something from your phrase, kindly elaborate.
 

OK i think I need to clarify my question.
The TWI module for instance in the ATmega16 have some registers like TWCR, TWBR, TWSR, TWDR and TWAR. I do not see these registers on a device like the Atmega169.
Is it easier to implement with these registers given above or is it the same?

Thank you very much for your patience.

Regards
 

The TWI module for instance in the ATmega16 have some registers like TWCR, TWBR, TWSR, TWDR and TWAR. I do not see these registers on a device like the Atmega169.
Is it easier to implement with these registers given above or is it the same?

OK thanks for the clarification. As I told you before, I haven't work with USI. But if you ask me, it would be more or less the same. There are some registers performing some specific actions. If you get them working, the first part of the job is done. USI or TWI module, you must configure the hardware properly and then go to the higher level of the TWI protocol (start condition, address accesing, no ACK errors handling etc). This part must be written in any case. The only thing you must do additionally if you use the USI, is to configure it as TWI interface. There must be a bit or bits inside a register to configure that. I suppose that references could be found in the web for both cases.

Just to give you a starting point, here are some references I just googled for USI in TWI mode:

**broken link removed**
http://www.atmel.com/dyn/resources/prod_documents/doc2561.pdf
View topic - USI, TWI, i2c etc. :: AVR Freaks
View topic - I2C Slave on an ATtiny45 :: AVR Freaks

And some for the TWI module:

avr-libc: Example using the two-wire interface (TWI)
Welcome To AVRbeginners.net!


Hope this helps.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top