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

Ole Reinhardt ole.reinhardt at embedded-it.de
Thu Jun 26 09:58:36 CEST 2008


> I have copied the source of at91_twi.c and the header file to the root of my
> project and included these in the makefile. After that i commented out
> following lines:
> //#if defined (MCU_AT91SAM7X256) 
> #define TWI_TWD  PA23_TWD_A     // modified for at91sam9260
> #define TWI_TWCK PA24_TWCK_A  // modified for at91sam9260
> //#endif
> Now by using of the TWInit() i get some compiler errors:

There are some more files to either include into your local directory or
to leave them at there normal directory. I would suggest to use the
second option. I did not realy understand why Harald suggested to copy
the twi driver sources to your local directory. This would be of benefit
only if you want to modify this sources but don't want to touch your
ethernut tree.

Ok, what's missing:

You'r in need of some interrupt handlers these should be correctly
included if you have configured NutOS to use the at91_twi driver and you
include the following files in your application:

#include <dev/board.h>
#include <dev/twif.h>

It might be possibly that you also need to copy these interrupt handler
files to your local copy too. But I never tried this by my own. So see
what the compiler is telling you if you included the above includes and
configured your NutOS to use the at91_twi driver.

> Is they are some known Tutorials, how to use bintbanging twi on an
> at91sam9260?

Not that I know. The bitbanging code is quite simple and has the same
api as the at91_twi driver. You have to configure it in Nutconf and
should be able to use the same functionality.

It seems as there are already configured the I/O lines for the

See nut/dev/twibbif.c


Ole Reinardt

|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |

More information about the En-Nut-Discussion mailing list