Seeking I2C app note code

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working my way through AVR315 (now AN2480) and it references TWI_Master.c and TWI_Master.h.  Atmel used to offer source code along side the associated app note, but I can't find these files on the Microchip web site.  I can find them through Google on other sites, but they date from 2004 and the app note dates from 2017 (though that may just be Microchip's updated copyright), so I don't know how up-to-date they are.  Can anyone point me to an authoritative source for them?  Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about the code files? From my bottom less pit of AVR stuff.

 

Attachment(s): 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Just to say that perhaps the most common C library for I2C on AVR is actually:

 

http://homepage.hispeed.ch/peter...

 

(search I2C on that page) But that will depend on the C compiler you use of course. That code is for avr-gcc. I suspect the code from the app note is probably for IAR.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lautman wrote:
Atmel used to offer source code along side the associated app note, but I can't find these files on the Microchip web site

You should report this direct to Microchip - it has been noted before.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it un-zipped :

https://web.archive.org/web/20170702034911/http://www.atmel.com/images/Atmel-2564-Using-the-TWI-Module-as-I2C-Master_ApplicationNote_AVR315.zip

from a very late 2017-Dec Atmel home page :

Support -> Document Library -> Application Notes

 


Microchip Technology Inc

Microchip Technology

Application Notes

AN2564 AVR315: Using the TWI Module as I2C Master

http://www.microchip.com/wwwappnotes/appnotes.aspx?appnote=en591794

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thanks, gchapman and js.  Just what I wanted.  As for the Fleury stuff, clawson, I'm aware of his drivers, and may resort to them (I know they're well-reviewed), but he's written them in ASM so they're harder to understand (actually, I don't even know if he provides the source anyway).  With C code, I don't feel as though I'm dealing with a black box.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

lautman wrote:
but he's written them in ASM so they're harder to understand
  ???  Only if you need to bit bang on two random port pins and not use the TWI h/w, otherwise its all C code!

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fleury's cide is C not Asm for "real" TWI. The Asm stuff is a bit bang solution to be used on AVR (mainly tiny) that don't have TWI.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Fleury's cide is C not Asm for "real" TWI. The Asm stuff is a bit bang solution to be used on AVR (mainly tiny) that don't have TWI.

 

Aah, I misread.