Atmel SAM4L-EK Atmel ATSAM4L-EK ATSAM4L-EK Data Sheet

Product codes
ATSAM4L-EK
Page of 1204
716
42023E–SAM–07/2013
ATSAM4L8/L4/L2
Figure 27-11. Arbitration Cases
27.8.7
Combined Transfers
CMDR and NCMDR may be used to generate longer sequences of connected transfers, since
generation of START and/or STOP conditions is programmable on a per-command basis. 
Writing NCMDR with START=1 when the previous transfer was written with STOP=0 will cause
a REPEATED START on the bus. The ability to generate such connected transfers allows arbi-
trary transfer lengths, since it is legal to write CMDR with both START=0 and STOP=0. If this is
done in master receiver mode, the CMDR.ACKLAST bit must also be controlled.
As for single data transfers, the TXRDY and RXRDY bits in the Status Register indicates when
data to transmit can be written to THR, or when received data can be read from RHR. Transfer
of data to THR and from RHR can also be done automatically by DMA, see 
27.8.7.1
Write Followed by Write
Consider the following transfer:
START, DADR+W, DATA+A, DATA+A, REPSTART, DADR+W, DATA+A, DATA+A, STOP.
To generate this transfer:
1.
Write CMDR with START=1, STOP=0, DADR, NBYTES=2 and READ=0.
2.
Write NCMDR with START=1, STOP=1, DADR, NBYTES=2 and READ=0.
3.
Wait until SR.TXRDY==1, then write first data byte to transfer to THR.
4.
Wait until SR.TXRDY==1, then write second data byte to transfer to THR.
5.
Wait until SR.TXRDY==1, then write third data byte to transfer to THR.
TWCK
Bus is busy
Bus is free
A transfer is programmed
(DADR + W + START + Write THR)
Transfer is initiated
TWI DATA transfer
Transfer is kept
Bus is considered as free
Data from a Master
Data from TWI
S
0
S
0
0
1
1
1
ARBLST
S
0
S
0
0
1
1
1
TWD
S
0
0
1
1 1
1 1
Arbitration is lost
TWI stops sending data
P
S
0
1
P
0
1
1
1
1
Data from the master
Data from the TWI
Arbitration is lost
The master stops sending data
Transfer is stopped
Transfer is programmed again
(DADR + W + START + Write THR)
TWCK
TWD