beautypg.com

6 interacting with i2c devices, 7 other interfaces and operations, 6 interacting with i – Aero-Flex GAISLER GR-LEON4-ITX User Manual

Page 19: C devices

background image

19

GR-LEON4-ITX Development Board

Quick Start Guide

4.6 Interacting with I

2

C devices

The LEON4 ASIC device provides three I2C interfaces, two master interfaces (I2CM0 &
I2CM1) and one slave interface (I2CS).
As a demonstration I

2

C circuit, an on-board DS1672 Real-Time Clock circuit is connected on

the board to the I2CM0 interface of the ASIC.
The I2CM1 and I2CS interfaces of the ASIC are connected to 4 pin 0.1” headers on the
board, to allow an external circuit to be hooked-up. If required, 10kOhm pull-up resistors on

the SCL and SDA signals can be installed if the appropriate jumpers JP9 and JP10 are
installed.
One way to interact with multiple I

2

C devices on the board is to connect one of the I2C

masters to the I2C slave. This can be done by attaching J18:1 to J17:1 and J18:3 to J17:3.

Pull-ups also need to be enabled (JP9:1-2,3-4 or JP10:1-2,3-4).
The following GRMON command will initialize the slave:

grlib> wmem 0xc0000600 0x50
grlib> wmem 0xc0000604 0x07
grlib> wmem 0xc0000614 0x99

The meaning of these write operations can be found by reading the I2C slave manual. The
connections made above connected I2CM1 to the slave. GRMON enumerates I2CM1 as I2C

core 2. To read data from the slave, issue:

grlib> i2c 2 read 0x50

Another way to interact with devices over I

2

C is to communicate with the DS1672 real time

clock (RTC). The RTC is connected to the bus if I2C M0, this master is enumerated as I

2

C

core 1 by GRMON. To detect any (7-bit addressable) devices on a bus the following

command can be used:

grlib> i2c 1 scan

Scanning 7-bit address space on I2C bus:
Detected I2C device at address 0x68
Scan of I2C bus completed. 1 device found

grlib>

The registers of the device can be read with:

grlib> i2c 1 read 0x68 0 5

00:

ad

a9

29

b1

04:

80

grlib>

The device can be written with:

grlib> i2c 1 write 0x68 0 0xab
grlib> i2c 1 read 0x68 0 5

00:

ab

a9

29

b1

04:

80

grlib>

Please see the GRMON User's Manual and the DS1672 data sheet for further details.

4.7 Other interfaces and operations

Please see the GRMON User's Manual for a description of the other debug drivers and
capabilities provided by GRMON.

© Aeroflex Gaisler AB

June 2010, Rev. 0.2