Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Common API for Controlling a TWI Module / Master Mode Example for SAM4L Xplained Pro Documentation

Introduction

This is the documentation for the data structures, functions, variables, defines, enums, and typedefs for the TWI master mode basic services example.

Main Files

  • twi_master_example.c: example application.
  • conf_board.h: board configuration
  • conf_twim.h: TWI master configuration used in this example
  • twi_master.h: Part Specific TWI Master Mode Implementation

services/basic/twi API

The TWI API can be found here.

Device Info

All AVR or SAM devices can be used. When use the example in Xplained Pro Kits, we need connect an IO1 Xplained Pro board to the proper EXT port. For information of the IO1Xplained Pro board, visit IO1 web link. This example has been tested with the following setup:

  • access to the TWI signals.

Description of the example

The given example uses one kit as a TWI master:

  • the TWI master performs a write access to the TWI slave,
  • the TWI master performs a read access of what it just wrote to the TWI slave,
  • the read data are compared with the originally written data.

LED0 gives the result of the test: If FAILED: LED0 is off. If PASS: LED0 is on at the end of the test.

Compilation Info

This software was written for the GNU GCC and IAR for AVR or SAM. Other compilers may or may not work.

Contact Information

For further information, visit Microchip.