Microchip® Advanced Software Framework

SAM0 I2C Unit Test

Overview:

Introduction

This unit test carries out tests for the I2C driver.

It consists of test cases for the following functionalities:

  • Test for I2C initialization.
  • Test for I2C master transfer.
  • Test for I2C master full speed transfer.

The following kit is required for carrying out the test:

  • SAM D21 Xplained Pro board
  • SAM L21 Xplained Pro board
  • SAM L22 Xplained Pro board
  • SAM R21 Xplained Pro board
  • SAM DA1 Xplained Pro board
  • SAM C21 Xplained Pro board
  • SAM D20 Xplained Pro board
  • SAM R30 Xplained Pro board
  • SAM R34 Xplained Pro board
  • WLR 089 Xplained Pro board

Setup

The following connections has to be made using wires:

  • SAM D21/DA1/D20 Xplained Pro board
    • PB02 (EXT1 PIN7) <--—> PA08 (EXT2 PIN11)
    • PB03 (EXT1 PIN8) <--—> PA09 (EXT2 PIN12)
  • SAM L21 Xplained Pro board
    • PA12 (EXT1 PIN7) <--—> PA08 (EXT2 PIN11)
    • PA13 (EXT1 PIN8) <--—> PA09 (EXT2 PIN12)
  • SAM L22 Xplained Pro board
    • PB30 (EXT1 PIN11) <--—> PA12 (EXT2 PIN14)
    • PB31 (EXT1 PIN12) <--—> PA13 (EXT2 PIN13)
  • SAM R21 Xplained Pro board
    • PA16 (EXT1 PIN11) <--—> PB02 (EXT1 PIN17)
    • PA17 (EXT1 PIN12) <--—> PB03 (EXT1 PIN15)
  • SAM C21 Xplained Pro board
    • PA12 (EXT2 PIN11) <--—> PB30 (EXT2 PIN7)
    • PA13 (EXT2 PIN12) <--—> PB31 (EXT2 PIN8)
  • SAM R30 Xplained Pro board
    • PA22 (EXT1 PIN9) <--—> PA16 (EXT1 PIN11)
    • PA23 (EXT1 PIN10) <--—> PA17 (EXT1 PIN12)
  • SAM R34 Xplained Pro board
    • PB02 (EXT1 PIN17) <--—> PA16 (EXT1 PIN11)
    • PA23 (EXT1 PIN15) <--—> PA17 (EXT1 PIN12)
  • WLR 089 Xplained Pro board
    • PB02 (EXT1 PIN17) <--—> PA16 (EXT1 PIN11)
    • PA23 (EXT1 PIN15) <--—> PA17 (EXT1 PIN12)

To run the test:

  • Connect the supported Xplained Pro board to the computer using a micro USB cable.
  • Open the virtual COM port in a terminal application.
    Note
    The USB composite firmware running on the Embedded Debugger (EDBG) will enumerate as debugger, virtual COM port and EDBG data gateway.
  • Build the project, program the target and run the application. The terminal shows the results of the unit test.

Usage

  • The unit test configures a I2C master and a I2C slave,
  • master write to slave and then read from slave,
  • compare the write and read results

Compilation Info

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

Contact Information

For further information, visit http://www.microchip.com.