Forum: ARM programming with GCC/GNU tools at91sam7s256 and TWI

von Roman M. (romez777)

Rate this post
0 useful
not useful

I need to implement I2C interface between at91 and RF tuner IC
(Maxlinear MX7001). I've read appnote about using the TWI in master mode
on AT91SAM controllers and its functionality quite fits my needs.

Source code accompaning the document, was built with IAR compiler, and
I'm now porting it on arm-gcc. Just to verify I2C works, I'm sending 1
byte in infinite loop, so I can check it with scope. What I see on the
scope is just zeros instead of alternating 0 and 1 (as 0xAA implies).

What may be the reason, what am I missing here? I took the code
completely from Appnote example (LM75 temp. sensor), and just modifying

include "project.h"
#include "lib_twi.h"

#define TWI_BUS_CLOCK 100000 /* in Hz */


int main()
  char ConfigReg = 0xaa;
  /* TWI initialization @ TWI_BUS_CLOCK */

  while (1) {

Thanks for any advices.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.