at91sam7s256 and TWI

OP #1173240
Rate this post
useful
not useful
Hello,

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
some:

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

#define TWI_BUS_CLOCK 100000 /* in Hz */

...

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

  while (1) {
    AT91F_TWI_WriteSingleIadr(AT91C_BASE_TWI,
                              AT91C_MXL7001_I2C_ADDRESS,
                              (char)0x0a,
                              AT91C_TWI_IADRSZ_1_BYTE,
                              &ConfigReg);
  }
}

Thanks for any advices.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now