at91sam7s256 and TWI

OP #1173240
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

A question of your own? This thread is over 18 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.