[En-Nut-Discussion] TWI at AT91SAM9260 and Nut/OS Driver

Harald Kipp harald.kipp at egnite.de
Tue Jun 24 18:22:12 CEST 2008


af_80 wrote:
> 
> Harald Kipp wrote:
>> May be I'm blind, but I can't see any call to TwInit().
>>
> 
> Why should I use TwInit()? I thought its specifies the Slave address. Can
> you explain it please?
...
 > Initialize TWI interface.
 >
 > The specified slave address is not used here as we don't support 
twi-slave
 > on AT91SAM7X

As documented, it initializes the hardware. The parameter is ignored, 
the function still must be called as stated in the TwMasterTransact() doc.


> To test is i included this function with sla address 0x00 (and an other) but
> the lines stays without some changes.

It would be a good idea to check the return result of TwInit.

What else can you do? Copy the at91_twi.c to your application directory 
and add it to your application's Makefile. This way the library module 
will be kept intact and replaced by a local copy. As you are using 
DEV_DEBUG, so you can freely use printf() in your local copy to further 
debug the code, even inside the interrupt routine.

Alternatively you can copy dev/twbbif.c to your application directory 
and add it to your Makefile instead. This is the bitbanged version, 
which I used so far. The at91_twi.c had been contributed by Ole, who is 
obviously too busy right now to respond.

Btw. the Olimex hardware provides pull-up resistors, right?

I further assume, your measurement was done using a well triggering 
storage oscilloscope.

Harald




More information about the En-Nut-Discussion mailing list