M4 Eece425 S2020 PDF
M4 Eece425 S2020 PDF
Mazen A. R. Saghir
AUB Logo
The AUB logo, as seen on the left, constitutes
the main element of the University’s visual
identity system.
+3.3V
0.1F
16 0.1F DB9 female
1
0.1F MAX 2 Vss
TM4C123 3 +5.5V
3232 5
4 6 -5.5V
0.1F 9
0.1F
5 4
Universal: Data format can be configured: 5-8 data bits; even, odd,
or no parity bit; 1 or 2 stop bits.
– Example: 8-N-1 = 8 data bits; No parity; 1 stop bit.
One frame
Data frame = 1 start bit + 8 data bits (LSB first) + 0 parity bit +
1 stop bit = 10 bits/frame.
At 115200 baud, the effective bit rate = 115200 × 8/10 = 92160 bps.
During data transfers some bits might become corrupted due to noise
or interference. Such errors can be easily detected using parity
checks.
Parity checks cannot detect multiple bit errors. More complex cyclic
redundancy checks can be used.
Stop 7 6 5 4 3 2 1 0 Start
Shift 1 Data 0 U0Tx
clock
Transmit shift register
16-element
FIFO TXEF Fifo empty flag
Bard, Erez, Janapa Reddi, Gerstlauer, Telang, Tiwari, Valvano, Yerraballi 12-10
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 7 / 60
UART Transmitter Operation
Stop 7 6 5 4 3 2 1 0 Start
Shift 1 Data 0 U0Rx
clock OE BE PE FE Receive shift register
RXFE Fifo empty flag
12-bit, 16-element
FIFO
RXFF Fifo full flag
Read data UART0_DR_R
Receive data register
Copyright
c Jonathan Valvano
Bard, Erez, Janapa Reddi, Gerstlauer, Telang, Tiwari, Valvano, Yerraballi 12-12
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 9 / 60
UART Receiver Operation
Data is read from the UART0 DR R register.
– Although this is the same register used for transmitting data, and has
the same address, the transmitter and receiver use two, separate,
physical registers.
– RXFE and RXFF flags can be examined by software to determine
when new data can be read from UART0 DR R.
– RXFE = 0 when data is available. RXFF = 1 when FIFO is full. This
simplifies busy-wait synchronization.
CDEFGHIJKLMNO
"A"=$41 "B"=$42 "P"=$50 "Q"=$51
s 0 1 2 3 4 5 6 7 s s 0 1 2 3 4 5 6 7 s s 0 1 2 3 4 5 6 7 s s 0 1 2 3 4 5 6 7 s
Bard,
M. Saghir (EECE 425Erez, Janapa
– Spring 2020) Reddi, Gerstlauer, Telang,
Serial Tiwari, Valvano, Yerraballi
Interfaces 12-14 11 / 60
UART0 Registers
TM4C UART0 – Registers
31–12 11 10 9 8 7–0 Name
$4000.C000 OE BE PE FE DATA UART0_DR_R
31–3 3 2 1 0
$4000.C004 OE BE PE FE UART0_RSR_R
31–8 7 6 5 4 3 2–0
$4000.C018 TXFE RXFF TXFF RXFE BUSY UART0_FR_R
31–16 15–0
$4000.C024 DIVINT UART0_IBRD_R
31–6 5–0
$4000.C028 DIVFRAC UART0_FBRD_R
31–8 7 6–5 4 3 2 1 0
$4000.C02C SPS WPEN FEN STP2 EPS PEN BRK UART0_LCRH_R
31–10 9 8 7 6–3 2 1 0
$4000.C030 RXE TXE LBE SIRLP SIREN UARTEN UART0_CTL_R
31-11 10 9 8 7 6 5 4
$4000.C038 OEIM BEIM PEIM FEIM RTIM TXIM RXIM UART0_IM_R
$4000.C03C OERIS BERIS PERIS FERIS RTRIS TXRIS RXRIS UART0_RIS_R
$4000.C040 OEMIS BEMIS PEMIS FEMIS RTMIS TXMIS RXMIS UART0_MIS_R
$4000.C044 OEIC BEIC PEIC FEIC RTIC TXIC RXIC UART0_IC_R
Copyright
c Jonathan Valvano
Bard,(EECE
M. Saghir Erez,
425Janapa Reddi,
– Spring 2020) Gerstlauer,Serial
Telang, Tiwari, Valvano, Yerraballi
Interfaces 12-13
12 / 60
Setting UART Baud Rate
The registers are used to store the value of a 22-bit clock divider that
consists of a 16-bit integer (in UART0 IBRD R) and a 6-bit fraction
(in UART0 FBRD R).
Example: If the system clock is 8 MHz and we need to set the baud
rate to 19200 bits/sec, the value of the divider must be:
8000000/(16 × 19200) = 26.04167.
// - - - - - - - - - - - - UART_Init - - - - - - - - - - - -
// Initialize the UART for 115 ,200 baud rate ( assuming 50 MHz UART clo
// 8 bit word length , no parity bits , one stop bit , FIFOs enabled
// Input : none
// Output : none
void UART_Init ( void ){
S Y S C T L _ R C G C U A R T _ R |= 0 x01 ; // activate UART0
S Y S C T L _ R C G C G P I O _ R |= 0 x01 ; // activate port A
while (( SY SC TL _ PR GP IO _ R &0 x01 ) == 0){};
UART0_CTL_R &= ~ U AR T_C TL _U AR T EN ; // disable UART
UART0_IBRD_R = 27; // IBRD = int (50 ,000 ,000 / (16
UART0_FBRD_R = 8; // FBRD = int (0.1267 * 64 + 0.
// 8 bit word length ( no parit
UART0_LCRH_R = ( U A R T _L C R H _ W L EN _ 8 | UART_LCRH_FEN );
UART0_CTL_R |= U AR T_ CT L _U AR TE N ; // enable UART
G P I O _ P O R T A _ A F S E L _ R |= 0 x03 ; // enable alt funct on PA1 -0
G P I O _ P O R T A _ D E N _ R |= 0 x03 ; // enable digital I / O on PA1 -0
// configure PA1 -0 as UART
G P I O _ P O R T A _ P C T L _ R = ( G P I O _ P O R T A _ P C T L _ R &0 xFFFFFF00 )+0 x00000011 ;
G P I O _ P O R T A _ A M S E L _ R &= ~0 x03 ; // disable analog functionalit
}
// - - - - - - - - - - - - UART_InChar - - - - - - - - - - - -
// Wait for new serial port input
// Input : none
// Output : ASCII code for key typed
char UART_InChar ( void ){
while (( UART0_FR_R & UART_FR_RXFE ) != 0);
return (( char )( UART0_DR_R &0 xFF ));
}
// - - - - - - - - - - - - UART_OutChar - - - - - - - - - - - -
// Output 8 - bit to serial port
// Input : letter is an 8 - bit ASCII character to be transferred
// Output : none
void UART_OutChar ( char data ){
while (( UART0_FR_R & UART_FR_TXFF ) != 0);
UART0_DR_R = data ;
}
UART Interrupt FIFO Level Select (UARTx IFLS R): This register
specifies the FIFO level (1/8 full, 2/8 full, 3/8 full, etc... ) at which
receive and transmit interrupts are triggered. The register uses two,
3-bit fields (RXIFLSEL and TXIFLSEL) to configure the receive and
transmit FIFO levels, respectively.
UART Interrupt Mask (UARTx IM R): Bits 10-4 of this register are
used to arm/disarm the corresponding seven UART interrupt
conditions.
UART Raw Interrupt Status (UARTx RIS R): Provides the current raw
status (i.e. pending or not) of the corresponding interrupt.
UART Masked Interrupt Status (UARTx MIS R): Bits 10-4 of this
register indicate whether a corresponding interrupt has occured or
not.
UART Interrupt Clear (UARTx ICR R): Writing 1’s to bits 10-4 of this
register clears and acknowledges the corresponding interrupts.
...
// clear TXIFLSEL and RXIFLSEL FIFO level fields
UART0_IFLS_R &= ~0 x3F ;
// configure interrupt for TX FIFO <= 1/8 full
// configure interrupt for RX FIFO >= 1/8 full
UART0_IFLS_R += ( UA RT _ IF LS _T X 1_ 8 | U AR T_ I FL S_ R X1 _8 );
// enable TX and RX FIFO interrupts and RX time - out interrupt
UART0_IM_R |= ( UART_IM_RXIM | UART_IM_TXIM | UART_IM_RTIM );
UART0_CTL_R |= U AR T_ CT L _U AR TE N ; // enable UART
SCLK SCLK
SPI MOSI MOSI SPI
Master MISO MISO Slave
SS SS
Copyright
c Wikipedia
SCLK SCLK
MOSI MOSI SPI
SPI MISO MISO Slave
Master SS1 SS
SS2
SS3
SCLK
MOSI SPI
MISO Slave
SS
SCLK
MOSI SPI
MISO Slave
SS
Copyright
c Wikipedia
Processor Peripheral
MOSI
SPI data SPI data
register register
MISO
transmission
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 28 / 60
SSI Data Transfers (2)
The SSI master initiates all data transfers. SSI slaves respond to data
transfer commands requesting access to their internal registers.
Many SSI devices also support burst data transfers where more
than one data byte can be transferred in a single transaction.
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 29 / 60
SSI Clock Polarity and Phase
5
EE 445L – Bard, Valvano
Four SSI modules connected to four GPIO ports. 2
EE 445L – Bard, Valvano
Each SSI module has 8-element Tx and Rx FIFO buffers,
control/status/data registers, and a configurable 4-16-bit shift register.
IO Ain 0 1 2 3 4 5 6 7 8 9 14
PA0 Port U0Rx CAN1Rx
PA1 Port U0Tx CAN1Tx
PA2 Port SSI0Clk
PA3 Port SSI0Fss
PA4 Port SSI0Rx
PA5 Port SSI0Tx
PA6 Port I2C1SCL M1PWM2
PA7 Port I2C1SDA M1PWM3
PB0 USB0ID Port U1Rx T2CCP0
PB1 USB0VBUS Port U1Tx T2CCP1
PB2 Port I2C0SCL T3CCP0
PB3 Port I2C0SDA T3CCP1
PB4 Ain10 Port SSI2Clk M0PWM2 T1CCP0 CAN0Rx
PB5 Ain11 Port SSI2Fss M0PWM3 T1CCP1 CAN0Tx
PB6 Port SSI2Rx M0PWM0 T0CCP0
PB7 Port SSI2Tx M0PWM1 T0CCP1
PC4 C1- Port U4Rx U1Rx M0PWM6 IDX1 WT0CCP0 U1RTS
PC5 C1+ Port U4Tx U1Tx M0PWM7 PhA1 WT0CCP1 U1CTS
PC6 C0+ Port U3Rx PhB1 WT1CCP0 USB0epen
PC7 C0- Port U3Tx WT1CCP1 USB0pflt
PD0 Ain7 Port SSI3Clk SSI1Clk I2C3SCL M0PWM6 M1PWM0 WT2CCP0
PD1 Ain6 Port SSI3Fss SSI1Fss I2C3SDA M0PWM7 M1PWM1 WT2CCP1
PD2 Ain5 Port SSI3Rx SSI1Rx M0Fault0 WT3CCP0 USB0epen
PD3 Ain4 Port SSI3Tx SSI1Tx IDX0 WT3CCP1 USB0pflt
PD4 USB0DM Port U6Rx WT4CCP0
PD5 USB0DP Port U6Tx WT4CCP1
PD6 Port U2Rx M0Fault0 PhA0 WT5CCP0
PD7 Port U2Tx PhB0 WT5CCP1 NMI
PE0 Ain3 Port U7Rx
PE1 Ain2 Port U7Tx
PE2 Ain1 Port
PE3 Ain0 Port
PE4 Ain9 Port U5Rx I2C2SCL M0PWM4 M1PWM2 CAN0Rx
PE5 Ain8 Port U5Tx I2C2SDA M0PWM5 M1PWM3 CAN0Tx
PF0 Port U1RTS SSI1Rx CAN0Rx M1PWM4 PhA0 T0CCP0 NMI C0o
PF1 Port U1CTS SSI1Tx M1PWM5 PhB0 T0CCP1 C1o TRD1
PF2 Port SSI1Clk M0Fault0 M1PWM6 T1CCP0 TRD0
PF3 Port SSI1Fss CAN0Tx M1PWM7 T1CCP1 TRCLK
PF4 Port M1Fault0 IDX0 T2CCP0 USB0epen
Table 2.7. PMCx bits in the GPIO_PORTx_PCTL_R
Copyrightregister
on the TM4C
c Jonathan specify alternate functions. PB1,
Valvano
PB0, PD4 and PD5 are hardwired to the USB device. PA0 and PA1 are hardwired to the serial port. PWM is
not available on LM4F120.
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 33 / 60
TM4C123 SSI Registers
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Type RW RW RW RW RW RW RW RW RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31:16 reserved RO 0x0000 Software should not rely on the value of a reserved bit. To provide
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces
compatibility with future products, the value of a reserved bit should be34 / 60
Register 3: SSI Data (SSIDR), offset 0x008
TM4C123 SSI Registers
Register
Important: 2: SSI
This Control
register 1(2)
(SSICR1),
is read-sensitive. Seeoffset 0x004
the register description for details.
The SSICR1 register contains bit fields that control various functions within the SSI module. Master
The
and SSIDR register
slave mode is 16-bits is
functionality wide. When the
controlled SSIDR
by this register is read, the entry in the receive FIFO
register.
Control 1thatRegister is pointed to by(SSIx CR1
the current R) pointer is accessed. When a data value is removed by
FIFO read
SSI Control 1the SSI receive logic from the incoming data frame, it is placed into the entry in the receive FIFO
(SSICR1)
– Synchronous
pointed
SSI0 base: 0x4000.8000 to by serial
the port
current FIFO enable
write (SSE). Enables the SSI module.
pointer.
SSI1 base: 0x4000.9000
– base:
SSI2 Master/slave
When the SSIDR
0x4000.A000 select (MS
register is ). Configures
written to, the entry inthe SSI module
the transmit as
FIFO that is a master
pointed to by the or
write
SSI3 base: 0x4000.B000
pointer is written to. Data values are removed from the transmit FIFO one value at a time by the
slave device. Can only be set while SSI module is disabled.
Offset 0x004
transmit logic. Each data value is loaded into the transmit serial shifter, then serially shifted out onto
Type RW, reset 0x0000.0000
31 the
30 SSInTx
29 pin
28 at the
27programmed
26 25 bit rate.
24 23 22 21 20 19 18 17 16
reserved
When a data size of less than 16 bits is selected, the user must right-justify data written to the
Type RO transmit
RO RO FIFO.ROThe transmit
RO logic ignores
RO RO ROthe unused
RO bits.
RO Received
RO ROdata less
RO than
RO 16 bits
RO is RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
automatically right-justified in the receive buffer.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
When the SSI is programmed for MICROWIRE frame format, the default size for transmit data is
reserved EOT reserved MS SSE LBM
eight bits (the most significant byte is ignored). The receive data size is controlled by the programmer.
Type RO RO RO RO RO RO RO RO RO RO RO RW RO RW RW RW
Reset 0 The
0 transmit
0 FIFO
0 and0 the receive
0 0FIFO are
0 not0cleared
0 even0 when 0the SSE 0 bit in0 the SSICR1
0 0
register is cleared, allowing the software to fill the transmit FIFO before enabling the SSI.
SSI Bit/Field
Data (SSIDR) Name Type Reset Description
Data Register
SSI0 base:
31:5
0x4000.8000 (SSIx DR
reserved RO
R) 0x0000.0 Software should not rely on the value of a reserved bit. To provide
SSI1 base: 0x4000.9000
– Holds data read from the Tx FIFO
SSI2 base: 0x4000.A000
SSI3 base: 0x4000.B000
buffer
compatibility withor written
future products, theto the
value Rx FIFO
of a reserved bit should be
preserved across a read-modify-write operation.
buffer.
Offset 0x008
Type RW, reset 0x0000.0000
4 EOT RW 0 End of Transmission
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
This bit is only valid for Master mode devices and operations (MS = 0x0).
reserved
Type RO RO RO RO RO RO RO ROValue RO
Description
RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 The TXRIS interrupt indicates that the transmit FIFO is half full
15 14 13 12 11 10 9 8 or less. 6
7 5 4 3 2 1 0
1DATA The End of Transmit interrupt mode for the TXRIS interrupt is
enabled.
Type RW RW RW RW RW RW RW RW RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Note: In Freescale SPI mode only, a condition can be created where
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces an EOT interrupt is generated for every byte transferred even35 / 60
TM4C123 SSI Registers (3)
Status Register
Register 4:(SSIx R)
SR(SSISR),
SSI Status offset 0x00C
– Provides The SSISR register contains
information on bits
thethatstatus
indicate of
the FIFO
the fill
Txstatus
FIFO and the SSI busy
buffer (TFEstatus.
= empty;
= not full), the Rx FIFO buffer (RNE = not empty; RFF = full), and
TNF(SSISR)
SSI Status
SSI0 base: 0x4000.8000
whether
SSI1 base: 0x4000.9000 the SSI module is idle or busy sending/receiving a data frame
SSI2 base: 0x4000.A000
Offset (BSY).
SSI3 base: 0x4000.B000
0x00C
Type RO, reset 0x0000.0003
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
31:5 reserved RO 0x0000.00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
Value Description
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 36 / 60
Synchronous Serial Interface (SSI)
TM4C123 SSI Registers (4)
Register 5: SSI Clock Prescale (SSICPSR), offset 0x010
The SSICPSR register specifies the division factor which is used to derive the SSInClk from the
system clock. The clock is further divided by a value from 1 to 256, which is 1 + SCR. SCR is
Clock Prescale Register (SSIx CPSR R)
programmed in the SSICR0 register. The frequency of the SSInClk is defined by:
SSInClk = SysClk / (CPSDVSR * (1 + SCR))
– The CPSDVSR field is used in conjunction with the SCR field of the
The value programmed into this register must be an even number between 2 and 254. The
CR0 R register
SSIx least-significant toprogrammed
bit of the derive the SSI
number clock from
is hard-coded the
to zero. TM4C123
If an odd number is bus
written
clock.to Thethis register,
SSI data readdetermines
clock back from this register
the hasTx the
andleast-significant bit as zero. rate.
Rx transmission
– CPSDVSR is an even number between 2 and 254, while SCR is a number
SSI Clock Prescale (SSICPSR)
SSI0 base: 0x4000.8000
between
SSI1 base: 0x4000.9000 0 and 255.
SSI2 base: 0x4000.A000
– f0x010SSI = fBUS /((CPSDVSR) × (1 + (SCR)))
SSI3 base: 0x4000.B000
Offset
Type RW, reset 0x0000.0000
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
reserved CPSDVSR
Type RO RO RO RO RO RO RO RO RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31:8 reserved RO 0x00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
M. Saghir (EECE7:0
425 – Spring CPSDVSR
2020) RW 0x00
Serial SSI Clock Prescale Divisor
Interfaces 37 / 60
Interface (SSI)
SSI Timing on the TM4C123
Synchronous serial timing showing the
data available interval overlaps the data
required interval
T R T R
SSI0Clk
S5max S5min
SSI0Tx must be high or low
S8 S9
SSI0Rx
don’t care
9
Copyright
EE 445L – Bard,
c Valvano
Jonathan Valvano
SSI0Fss
SPO=1, SPH=0
SSI0Clk
SSI0Fss
SSI0Fss
Copyright
c Jonathan Valvano
EE 445L – Bard, Valvano
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 39 / 60
MAX5353 SSI Interface
Digital to Analog Converter (DAC) that uses SSI to interface with
a microcontroller.
– Uses a 16-bit frame: 3 command bits; 12 data bits; 1 stop bit
SSI0Fss/CS
SSI0Clk
Output of
SSI0Tx C2 C1 C0 B11 B10 B1 B0 S0 LM3S
Input of
Max5353 Din C2 C1 C0 B11 B10 B1 B0 S0 Max5353
Copyright
c Jonathan Valvano
VCC VCC
SCL
SDA
ABoth
serial
SDAcommunication bus used
and SCL are bidirectional. toSPI,
Unlike connect different
which has separate ICs
data on
linesthe
for
same PCB. of communication, I2C shares the same signal line for master trans-
each direction
mission
– Uses andtwo
slaveopen-collector
response. Also unlike
wires SPI, I2C clock
(serial does not
SCL;haveserial
several modes
data of to
SDA)
operation. The timing relationship between the clock, SCL, and the data line, SDA,
transfer bidirectional, synchronous data between multiple 2devices.
is simple and straightforward.2 When idle, both SDA and SCL are high. An I C trans-
– Any
action device
begins with on
SDAthe I Clow,
going busfollowed
can serve by SCLas master or slave.
(Figure 8-2). This indicates to
– Transfer speeds vary from 100 Kbps (standard)
all receivers on the bus that a packet transmission is commencing. to While
400 Kbps
SCL is(fast).
low,
SDA– Each device
transitions (highhas a unique
or low) for the 7-bit address
first valid making
data bit. it possible
This is known to connect
as a “START
condition.”
128 devices to the same bus. I2 C also supports a 10-bit extended
addressing scheme.
SDA
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 42 / 60
All transactions begin with a START (S) and are terminated by a STOP (P) (see Figure 5).
Starting
A HIGH to LOWand Stopping
transition Data
on the SDA Transfers
line while Over
SCL is HIGH I2 C Bus
thea START
defines condition.
A LOW to HIGH transition on the SDA line while SCL is HIGH defines a STOP condition.
SDA
SCL
S P
SDA
S P
There are four I2C modules (I2C0 to I2C3) on the TM4C123. Each is
connected to a different GPIO port to drive the SCL and SDA buses.
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
reserved SA R/S
31:8 reserved RO 0x0000.00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
31:8 reserved RO 0x0000.00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
Value Description
0 No clock timeout error.
1 The clock timeout error has occurred.
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces 47 / 60
I2C Master Registers (3)
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Type RO RO RO RO RO RO RO RO RO RO RO WO WO WO WO WO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31:5 reserved RO 0 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
This register contains the data to be transmitted when in the Master Transmit state and the data
received when in the Master Receive state.
Data Register
I2C Master (I2Cx MDR R)
Data (I2CMDR)
I2C 0 base: 0x4002.0000
– Contains the data to be transmitted when in Master Transmit state, and
I2C 1 base: 0x4002.1000
I2C 2 base: 0x4002.2000
I2C 3 base: 0x4002.3000
the data received when in Master Receive state.
Offset 0x008
Type R/W, reset 0x0000.0000
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
reserved DATA
31:8 reserved RO 0x0000.00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
7:0 DATA R/W 0x00 This byte contains the data transferred during a transaction.
– Sets the timer period for the SCL clock and sets the SCL to either
I2C Master Timer Period (I2CMTPR)
I2C 0 base: 0x4002.0000
standard or high-speed mode.
I2C 1 base: 0x4002.1000
I2C 2 base: 0x4002.2000
– SCL PERIOD = 20 × (1 + T PR) × BUS CLK PERIOD
I2C 3 base: 0x4002.3000
Offset 0x00C
Type R/W, reset 0x0000.0001
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
reserved HS TPR
31:8 reserved RO 0x0000.00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
Value Description
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces
0 The SCL Clock Period set by TPR applies to Standard mode 50 / 60
I2C Master Registers (6) Tiva™ TM4C123GH6PM Microcontroller
Configuration
I2C Master ConfigurationRegister
(I2CMCR) (I2Cx MCR R)
I2C 0 base: 0x4002.0000
–
I2C Configures
1 base: 0x4002.1000
I2C 2 base: 0x4002.2000
the mode ( MFE = 1 ⇒ Master; MFE = 0 ⇒ Slave), enables
I2C 3 base: 0x4002.3000
the glitch filter, and sets the interface for test mode loopback.
Offset 0x020
Type RW, reset 0x0000.0000
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
reserved
Type RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO RO
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Type RO RO RO RO RO RO RO RO RO RW RW RW RO RO RO RW
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31:7 reserved RO 0x0000.00 Software should not rely on the value of a reserved bit. To provide
compatibility with future products, the value of a reserved bit should be
preserved across a read-modify-write operation.
Value Description
0 I2C glitch filter is disabled.
M. Saghir (EECE 425 – Spring 2020) Serial Interfaces
1 I2C glitch filter is enabled. 51 / 60
APPLICATIONS 1. Ease of use, no calibration or correction required by the user.
RTD and thermistor replacement 2. Low power consumption.
The ADT7420
Thermocouple Temperature Sensor
cold junction compensation
Medical equipment
3. Excellent long-term stability and reliability.
4. High accuracy for industrial, instrumentation, and medical
Industrial control and test applications.
Food transportation and storage
5. Packaged in a 16-lead, 4 mm × 4 mm LFCSP RoHS-
Environmental monitoring and HVAC
compliant package.
Laser diode temperature control
A0 3 1 SCL
I2C INTERFACE
A1 4 2 SDA
09013-001
11
GND
Figure 1.
SCL
SDA 1 0 0 1 0 A1 A0 R/W P7 P6 P5 P4 P3 P2 P1 P0
1 9 1 9
SCL
SDA 1 0 0 1 0 A1 A0 R/W D7 D6 D5 D4 D3 D2 D1 D0
09013-018
SERIAL BUS ADDRESS DATA BYTE FROM CONFIGURATION
BYTE REGISTER
1 9 1 9
SCL
SDA
1 0 0 1 0 A1 A0 R/W A7 A6 A1 A0
M. Saghir START
(EECE 425 – Spring 2020)
ADT7410 DEVICE ADDRESS Serial
ACK. BY Interfaces
REGISTER ADDRESS[A7:A0] ACK. BY 54 / 60
SDA 1 0 0 1 0 A1 A0 R/W D7 D6 D5 D4 D3 D2 D1 D0
09013-018
SERIAL BUS ADDRESS DATA BYTE FROM CONFIGURATION
BYTE REGISTER
1 9 1 9
SCL
SDA
1 0 0 1 0 A1 A0 R/W A7 A6 A1 A0
SR 1 9 1 9
SCL
SDA R/W D7 D6 D1 D0 D7 D6 D1 D0
1 0 A1 A0
09013-023
4. TEMPERATURE VALUE REGISTER MSB DATA AND TEMPERATURE VALIUE REGISTER LSB DATA ARE ALWAYS SEPARATED BY A LOW ACK BIT.
5. THE R/W BIT IS SET TO A1 TO INDICATE A READBACK OPERATION.
Figure 17. Reading Back Data from the Temperature Value Register
1 9 1 9
SCL
SDA 1 0 0 1 0 A1 A0 R/W P7 P6 P5 P4 P3 P2 P1 P0
START BY ACK. BY ACK. BY
MASTER ADT7420 ADT7420
FRAME 1 FRAME 2
SERIAL BUS ADDRESS BYTE ADDRESS POINTER REGISTER BYTE
1 9
SCL (CONTINUED)
SDA (CONTINUED) D7 D6 D5 D4 D3 D2 D1 D0
ACK. BY STOP BY
ADT7420 MASTER
09013-016
FRAME 3
DATA BYTE
1 9 1 9
SCL
SDA 1 0 0 1 0 A1 A0 R/W P7 P6 P5 P4 P3 P2 P1 P0
START BY ACK. BY ACK. BY
MASTER ADT7420 ADT7420
M. Saghir (EECE 425 – Spring 2020)
FRAME 1 Serial Interfaces FRAME 2 56 / 60
Example: Interfacing TM4C123 with ADT7420
3.3 V
2.2kΩ 2.2kΩ
SCL