The application demonstrates how to use the SAM TWIHS driver to access an external serial EEPROM chip.
This package can be used with the following setup:
Upon startup, the program configures PIOs for console UART, LEDs and TWIHS connected to EEPROM on board. Then it configures the TWIHS driver and data package. The clock of I2C bus is set as 400kHz. After initializing the master mode, the example sends test pattern to the EEPROM. When sending is complete, TWIHS driver reads the memory and saves the content in the reception buffer. Then the program compares the content received with the test pattern sent before and prints the comparison result. The corresponding LED is turned on.
On SAM Xplained Pro, the EEPROM is simulated though the TWIHS_slave_example, which means 2 SAM Xplained Pro boards are required to run this example. One board executes this example as the twi master and another runs TWIHS_salve_example as the simulated EEPROM. The TWI PINs and GND PIN should be connected between these 2 boards. More information of the simulated EEPROM implementation can be referred in the description of TWIHS_slave_example.
This software was written for the GNU GCC and IAR EWARM. Other compilers may or may not work.
For further information, visit Microchip.
Support and FAQ: https://www.microchip.com/support/