Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.43 KB

README.md

File metadata and controls

64 lines (52 loc) · 1.43 KB

Inter-integrated circuit (I²C/I2C)

This directory contains assembly language examples related to I2C.

I2C Controller/Peripheral example

This example for consists of two discovery boards connected to each other, where i2c-c.s is the controller which sends a character (currently A) to i2c-p.s which is the peripheral. The peripheral then uses UART to send that character out which can be displayed using minicom.

Building

$ make i2c-c.elf i2c-p.elf

Flash and Run the peripheral

Connect the USB micro cable to the STM32 ST-LINK port on the board that is going to be used as the peripheral.

Start openocd:

$ make openocd

Start a telnet session:

$ telnet localhost 4444

Flash the program:

> reset halt 
> flash write_image erase i2c-p.elf.hex
> reset run

Flash and Run the controller

Connect the USB micro cable to the STM32 ST-LINK port on the board that is going to be used as the controller.

Start openocd:

$ make openocd

Start a telnet session:

$ telnet localhost 4444

Flash the program:

> reset halt
> flash write_image erase i2c-c.elf.hex
> reset run

Start minicom:

$ minicom --baudrate 115200 --device /dev/ttyUSB0

Next press the reset button on the controller board and 'A7' should be displayed in minicom:

I2C Example image