Microchip® Advanced Software Framework

SAM I2C Master Bootloader Bridge

Overview:

Features

  • Application as a bridge for I2C slave bootloader self programming
  • Uses USB Communication Device Class(CDC)
  • I2C master sends the data to be programmed over I2C bus

Introduction

This application implements a USB Device CDC and a I2C master for SAM devices, it works as a bridge between I2C slave and the USB CDC interface.

This application has been tested on following boards:

  • SAM D21 Xplained Pro

Prerequisites

A python script (bootloader.py in script folder) is used on the host PC to send data over USB CDC interface, example application bin file(to be programmed) starts at 0x2000. To run the python script, execute a command for example as below: python bootloader.py -p COM20 -i led_toggle_flash.bin Make sure that python environment is installed on your PC,

Hardware Setup

For SAM D21 Xplained Pro: I2C slave should be connected to PIN11 (PA08 - SDA) and PIN12 (PA09 - SCL) on External header 1 (EXT1).

Communication Protocol

  • I2C Master first receives 4 bytes of data which contains the length of the data to be programmed for I2C slave.
  • Read a block from CDC interface of size NVMCTRL_PAGE_SIZE
  • Receive an acknowledgement byte 's' from I2C slave to indicate it has received the data and finished programming
  • Repeat till entire length of data has transferred and programmed.

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.

Support and FAQ: visit Microchip Support