AT07334: SAM4 TWI Master Mode Driver [APPLICATION NOTE]
42274A-MCU-05/2014
20
7. TWIM Master Example
7.1 Purpose
This is an example of how to use the TWIM driver to access an EEPROM.
7.2 Requirements
The program needs a TWI-compatible EEPROM connected as shown below:
7.3 Connections for Board: SAM4L Xplained Pro
Board Pin EEPROM
TWIMS3 TWD(PB14,EXT2/PIN11 SDA
TWIMS3 TWCK(PB15,EXT2/PIN12) SCL
VCC VCC
GND GND
7.4 Connections for Board: SAM4L-EK
Board Pin EEPROM
TWIMS3 TWD(PB0) SDA
TWIMS3 TWCK(PB01) SCL
VCC VCC
GND GND
7.5 Description
1. Write a data pattern to the EEPROM device.
2. Read data back from the EEPROM.
3. Compare the two. If they match then it worked.
7.6 Usage
1. Build the program and download it into the evaluation board.
2. Connect a serial cable to the UART port for each evaluation kit.
3.
On the computer, open, and configure a terminal application (e.g. HyperTerminal on Microsoft
®
Windows
®
)
with these settings:
● 115200 bauds
● 8 data bits
● No parity
● 1 stop bit
● No flow control
4. Start the application. The following traces shall appear on the terminal: