TWIM — I2C compatible two-wire interface master with EasyDMA

TWI master with EasyDMA (TWIM) is a two-wire half-duplex master which can communicate with multiple slave devices connected to the same bus.

Listed here are the main features for TWIM:
  • I2C compatible
  • Supported baud rates: 100, 250, 400 and 1000 kbps
  • Support for clock stretching (non I2C compliant)
  • EasyDMA

The two-wire interface can communicate with a bi-directional wired-AND bus with two lines (SCL, SDA). The protocol makes it possible to interconnect up to 127 individually addressable devices. TWIM is not compatible with CBUS.

The GPIOs used for each two-wire interface line can be chosen from any GPIO on the device and are independently configurable. This enables great flexibility in device pinout and efficient use of board space and signal routing.

Figure 1. TWI master with EasyDMA
TWI master with EasyDMA (TWIM)

A typical TWI setup consists of one master and one or more slaves, as illustrated in the following figure. TWIM is only able to operate as a single master on the TWI bus. Multi-master bus configuration is not supported.

Figure 2. A typical TWI setup comprising one master and three slaves
A typical TWI setup comprising one master and three slaves

TWIM supports clock stretching performed by the slaves. The SCK pulse following a stretched clock cycle may be shorter than specified by the I2C specification.

TWIM is started by triggering the STARTTX or STARTRX tasks, and stopped by triggering the STOP task. After a STOP task, TWIM generates a STOPPED event when it has stopped.

After TWIM has been started, the STARTTX or STARTRX tasks should not be triggered again until TWIM has issued a LASTRX, LASTTX, or STOPPED event.

TWIM can be suspended using the SUSPEND task, such as when using the TWI master in a low priority interrupt context. When TWIM enters suspend state, it will automatically issue a SUSPENDED event while performing a continuous clock stretching until it is instructed to resume operation via a RESUME task. TWIM cannot be stopped while it is suspended, thus the STOP task has to be issued after the TWI master has been resumed.

Note: Any ongoing byte transfer will be allowed to complete before the suspend is enforced. A SUSPEND task has no effect unless TWIM is actively involved in a transfer.

If a NACK is clocked in from the slave, TWIM generates an ERROR event.

Shared resources

TWIM shares registers and other resources with other peripherals that have the same ID as the TWI master. Therefore, you must disable all peripherals that have the same ID as TWIM before it can be configured and used.

Disabling a peripheral that has the same ID as TWIM will not reset any of the registers that are shared with TWIM. It is therefore important to configure all relevant registers explicitly to secure that TWIM operates correctly.

The Instantiation table in Peripherals shows which peripherals have the same ID as the TWI.

EasyDMA

TWIM implements EasyDMA for accessing RAM without CPU involvement.

TWIM implements the EasyDMA channels found in the following table.
Table 1. TWIM EasyDMA Channels
ChannelTypeRegister Cluster
TXDREADERTXD
RXDWRITERRXD

For detailed information regarding the use of EasyDMA, see EasyDMA.

The RXD.PTR, TXD.PTR, RXD.MAXCNT, and TXD.MAXCNT registers are double-buffered. They can be updated and prepared for the next RX or TX transmission immediately after having received the RXSTARTED or TXSTARTED event.

The STOPPED event indicates that EasyDMA has finished accessing the buffer in RAM.

Master write sequence

A TWIM write sequence is started by triggering the STARTTX task. After the STARTTX task has been triggered, TWIM generates a start condition on the TWI bus, followed by clocking out the address and the READ/WRITE bit set to 0 (WRITE=0, READ=1).

The address must match the address of the slave device that the master wants to write to. The READ/WRITE bit is followed by an ACK/NACK bit (ACK=0 or NACK=1) generated by the slave.

After receiving the ACK bit, TWIM clocks out the data bytes found in the transmit buffer located in RAM at the address specified in the TXD.PTR register. Each byte clocked out from TWIM will be followed by an ACK/NACK bit clocked in from the slave.

A typical TWIM write sequence is shown in the following figure, including clock stretching performed by TWIM following a SUSPEND task.

A SUSPENDED event indicates that the SUSPEND task has taken effect. This event can be used to synchronize the software.

TWIM will generate a LASTTX event when it starts to transmit the last byte.

Figure 3. TWIM writing data to a slave
TWIM writing data to a slave

TWIM is stopped by triggering the STOP task. This task should be triggered during the transmission of the last byte to secure that TWIM will stop as fast as possible after sending the last byte. The shortcut between LASTTX and STOP can alternatively be used to accomplish this.

Note: TWIM does not stop by itself when the entire RAM buffer has been sent, or when an error occurs. The STOP task must be issued, through the use of a local or PPI shortcut, or in software as part of the error handler.

Master read sequence

A TWIM read sequence is started by triggering the STARTRX task. After the STARTRX task has been triggered, TWIM generates a start condition on the TWI bus, followed by clocking out the address and the READ/WRITE bit set to 1 (WRITE = 0, READ = 1). The address must match the address of the slave device that the master wants to read from. The READ/WRITE bit is followed by an ACK/NACK bit (ACK=0 or NACK = 1) generated by the slave.

After sending the ACK bit, the TWI slave sends data to the master using the clock generated by TWIM.

Data received will be stored in RAM at the address specified in the RXD.PTR register. The TWI master will generate an ACK after all but the last byte have been received from the slave. TWIM generates a NACK after the last byte received to indicate that the read sequence shall stop.

A typical TWIM read sequence is illustrated in the following figure, including clock stretching performed by TWIM following a SUSPEND task.

A SUSPENDED event indicates that the SUSPEND task has taken effect. This event can be used to synchronize the software.

TWIM generates a LASTRX event when it is ready to receive the last byte. If RXD.MAXCNT > 1, the LASTRX event is generated after sending the ACK of the previously received byte. If RXD.MAXCNT = 1, the LASTRX event is generated after receiving the ACK following the address and READ bit.

TWIM is stopped by triggering the STOP task. This task must be triggered before the NACK bit is supposed to be transmitted. The STOP task can be triggered at any time during the reception of the last byte. It is recommended to use the shortcut between LASTRX and STOP to accomplish this.

TWIM does not stop by itself when the RAM buffer is full, or when an error occurs. The STOP task must be issued, through the use of a local or PPI shortcut, or in software as part of the error handler.

TWIM cannot be stopped while suspended, so the STOP task must be issued after TWIM has been resumed.

Figure 4. TWIM reading data from a slave
TWIM reading data from a slave

Master repeated start sequence

A typical repeated start sequence is when TWIM writes two bytes to the slave followed by reading four bytes from the slave. This example uses shortcuts to perform the simplest type of repeated start sequence, i.e. one write followed by one read. The same approach can be used to perform a repeated start sequence where the sequence is read followed by write.

The following figure shows an example of a repeated start sequence where TWIM writes two bytes followed by reading four bytes from the slave.

Figure 5. Master repeated start sequence
Master repeated start sequence

If a more complex repeated start sequence is needed, and the TWI firmware drive is serviced in a low priority interrupt, it may be necessary to use the SUSPEND task and SUSPENDED event to guarantee that the correct tasks are generated at the correct time. A double repeated start sequence using the SUSPEND task to secure safe operation in low priority interrupts is shown in the following figure.

Figure 6. Double repeated start sequence
Double repeated start sequence

Low power

To ensure lowest possible power consumption when the peripheral is not needed stop and disable TWIM.

When the STOP task is sent, the software shall wait until the STOPPED event is received as a response before disabling the peripheral through the ENABLE register. If the peripheral is already stopped, the STOP task is not required.

Master mode pin configuration

The SCL and SDA signals are mapped to physical pins using the PSEL.SCL and PSEL.SDA registers.

The PSEL.SCL and PSEL.SDA registers and their configurations are only used as long as the TWI master is enabled, and retained only as long as the device is in System ON mode. When the peripheral is disabled, the pins will behave as regular GPIOs, and use the configuration in their respective OUT bit field and PIN_CNF[n] register. PSEL.SCL and PSEL.SDA must only be configured when the TWI master is disabled.

To secure correct signal levels on the pins used by TWIM while in System OFF mode, and when TWIM is disabled, these pins must be configured in the GPIO peripheral as described in the following table.

Only one peripheral can be assigned to drive a particular GPIO pin at a time. Failing to do so may result in unpredictable behavior.

Table 2. GPIO configuration before enabling peripheral
TWI master signalTWI master pinDirectionOutput valueDrive strength
SCLAs specified in PSEL.SCL1InputNot applicableS0D11
SDAAs specified in PSEL.SDA1InputNot applicableS0D11

Registers

Instances

InstanceDomainBase addressTrustZoneSplit accessDescription
MapAttDMA
TWIM0 : S
TWIM0 : NS
APPLICATION0x50008000
0x40008000
USSSANoTwo-wire interface master 0
TWIM1 : S
TWIM1 : NS
APPLICATION0x50009000
0x40009000
USSSANoTwo-wire interface master 1
TWIM2 : S
TWIM2 : NS
APPLICATION0x5000B000
0x4000B000
USSSANoTwo-wire interface master 2
TWIM3 : S
TWIM3 : NS
APPLICATION0x5000C000
0x4000C000
USSSANoTwo-wire interface master 3
TWIM0NETWORK0x41013000HFNSNANoTwo-wire interface master 0

Register overview

RegisterOffsetTZDescription
TASKS_STARTRX0x000Start TWI receive sequence
TASKS_STARTTX0x008Start TWI transmit sequence
TASKS_STOP0x014Stop TWI transaction. Must be issued while the TWI master is not suspended.
TASKS_SUSPEND0x01CSuspend TWI transaction
TASKS_RESUME0x020Resume TWI transaction
SUBSCRIBE_STARTRX0x080Subscribe configuration for task STARTRX
SUBSCRIBE_STARTTX0x088Subscribe configuration for task STARTTX
SUBSCRIBE_STOP0x094Subscribe configuration for task STOP
SUBSCRIBE_SUSPEND0x09CSubscribe configuration for task SUSPEND
SUBSCRIBE_RESUME0x0A0Subscribe configuration for task RESUME
EVENTS_STOPPED0x104TWI stopped
EVENTS_ERROR0x124TWI error
EVENTS_SUSPENDED0x148SUSPEND task has been issued, TWI traffic is now suspended.
EVENTS_RXSTARTED0x14CReceive sequence started
EVENTS_TXSTARTED0x150Transmit sequence started
EVENTS_LASTRX0x15CByte boundary, starting to receive the last byte
EVENTS_LASTTX0x160Byte boundary, starting to transmit the last byte
PUBLISH_STOPPED0x184Publish configuration for event STOPPED
PUBLISH_ERROR0x1A4Publish configuration for event ERROR
PUBLISH_SUSPENDED0x1C8Publish configuration for event SUSPENDED
PUBLISH_RXSTARTED0x1CCPublish configuration for event RXSTARTED
PUBLISH_TXSTARTED0x1D0Publish configuration for event TXSTARTED
PUBLISH_LASTRX0x1DCPublish configuration for event LASTRX
PUBLISH_LASTTX0x1E0Publish configuration for event LASTTX
SHORTS0x200Shortcuts between local events and tasks
INTEN0x300Enable or disable interrupt
INTENSET0x304Enable interrupt
INTENCLR0x308Disable interrupt
ERRORSRC0x4C4Error source
ENABLE0x500Enable TWIM
PSEL.SCL0x508Pin select for SCL signal
PSEL.SDA0x50CPin select for SDA signal
FREQUENCY0x524TWI frequency. Accuracy depends on the HFCLK source selected.
RXD.PTR0x534Data pointer
RXD.MAXCNT0x538Maximum number of bytes in receive buffer
RXD.AMOUNT0x53CNumber of bytes transferred in the last transaction
RXD.LIST0x540EasyDMA list type
TXD.PTR0x544Data pointer
TXD.MAXCNT0x548Maximum number of bytes in transmit buffer
TXD.AMOUNT0x54CNumber of bytes transferred in the last transaction
TXD.LIST0x550EasyDMA list type
ADDRESS0x588Address used in the TWI transfer

TASKS_STARTRX

Address offset: 0x000

Start TWI receive sequence

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_STARTRXStart TWI receive sequence
Trigger1Trigger task

TASKS_STARTTX

Address offset: 0x008

Start TWI transmit sequence

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_STARTTXStart TWI transmit sequence
Trigger1Trigger task

TASKS_STOP

Address offset: 0x014

Stop TWI transaction. Must be issued while the TWI master is not suspended.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_STOPStop TWI transaction. Must be issued while the TWI master is not suspended.
Trigger1Trigger task

TASKS_SUSPEND

Address offset: 0x01C

Suspend TWI transaction

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_SUSPENDSuspend TWI transaction
Trigger1Trigger task

TASKS_RESUME

Address offset: 0x020

Resume TWI transaction

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_RESUMEResume TWI transaction
Trigger1Trigger task

SUBSCRIBE_STARTRX

Address offset: 0x080

Subscribe configuration for task STARTRX

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that task STARTRX will subscribe to
BRWEN
Disabled0Disable subscription
Enabled1Enable subscription

SUBSCRIBE_STARTTX

Address offset: 0x088

Subscribe configuration for task STARTTX

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that task STARTTX will subscribe to
BRWEN
Disabled0Disable subscription
Enabled1Enable subscription

SUBSCRIBE_STOP

Address offset: 0x094

Subscribe configuration for task STOP

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that task STOP will subscribe to
BRWEN
Disabled0Disable subscription
Enabled1Enable subscription

SUBSCRIBE_SUSPEND

Address offset: 0x09C

Subscribe configuration for task SUSPEND

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that task SUSPEND will subscribe to
BRWEN
Disabled0Disable subscription
Enabled1Enable subscription

SUBSCRIBE_RESUME

Address offset: 0x0A0

Subscribe configuration for task RESUME

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that task RESUME will subscribe to
BRWEN
Disabled0Disable subscription
Enabled1Enable subscription

EVENTS_STOPPED

Address offset: 0x104

TWI stopped

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_STOPPEDTWI stopped
NotGenerated0Event not generated
Generated1Event generated

EVENTS_ERROR

Address offset: 0x124

TWI error

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_ERRORTWI error
NotGenerated0Event not generated
Generated1Event generated

EVENTS_SUSPENDED

Address offset: 0x148

SUSPEND task has been issued, TWI traffic is now suspended.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_SUSPENDEDSUSPEND task has been issued, TWI traffic is now suspended.
NotGenerated0Event not generated
Generated1Event generated

EVENTS_RXSTARTED

Address offset: 0x14C

Receive sequence started

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_RXSTARTEDReceive sequence started
NotGenerated0Event not generated
Generated1Event generated

EVENTS_TXSTARTED

Address offset: 0x150

Transmit sequence started

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_TXSTARTEDTransmit sequence started
NotGenerated0Event not generated
Generated1Event generated

EVENTS_LASTRX

Address offset: 0x15C

Byte boundary, starting to receive the last byte

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_LASTRXByte boundary, starting to receive the last byte
NotGenerated0Event not generated
Generated1Event generated

EVENTS_LASTTX

Address offset: 0x160

Byte boundary, starting to transmit the last byte

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWEVENTS_LASTTXByte boundary, starting to transmit the last byte
NotGenerated0Event not generated
Generated1Event generated

PUBLISH_STOPPED

Address offset: 0x184

Publish configuration for event STOPPED

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event STOPPED will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

PUBLISH_ERROR

Address offset: 0x1A4

Publish configuration for event ERROR

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event ERROR will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

PUBLISH_SUSPENDED

Address offset: 0x1C8

Publish configuration for event SUSPENDED

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event SUSPENDED will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

PUBLISH_RXSTARTED

Address offset: 0x1CC

Publish configuration for event RXSTARTED

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event RXSTARTED will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

PUBLISH_TXSTARTED

Address offset: 0x1D0

Publish configuration for event TXSTARTED

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event TXSTARTED will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

PUBLISH_LASTRX

Address offset: 0x1DC

Publish configuration for event LASTRX

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event LASTRX will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

PUBLISH_LASTTX

Address offset: 0x1E0

Publish configuration for event LASTTX

Bit number313029282726252423222120191817161514131211109876543210
IDBAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWCHIDX[0..255]DPPI channel that event LASTTX will publish to
BRWEN
Disabled0Disable publishing
Enabled1Enable publishing

SHORTS

Address offset: 0x200

Shortcuts between local events and tasks

Bit number313029282726252423222120191817161514131211109876543210
IDFDCBA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWLASTTX_STARTRXShortcut between event LASTTX and task STARTRX
Disabled0Disable shortcut
Enabled1Enable shortcut
BRWLASTTX_SUSPENDShortcut between event LASTTX and task SUSPEND
Disabled0Disable shortcut
Enabled1Enable shortcut
CRWLASTTX_STOPShortcut between event LASTTX and task STOP
Disabled0Disable shortcut
Enabled1Enable shortcut
DRWLASTRX_STARTTXShortcut between event LASTRX and task STARTTX
Disabled0Disable shortcut
Enabled1Enable shortcut
FRWLASTRX_STOPShortcut between event LASTRX and task STOP
Disabled0Disable shortcut
Enabled1Enable shortcut

INTEN

Address offset: 0x300

Enable or disable interrupt

Bit number313029282726252423222120191817161514131211109876543210
IDJIHGFDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWSTOPPEDEnable or disable interrupt for event STOPPED
Disabled0Disable
Enabled1Enable
DRWERROREnable or disable interrupt for event ERROR
Disabled0Disable
Enabled1Enable
FRWSUSPENDEDEnable or disable interrupt for event SUSPENDED
Disabled0Disable
Enabled1Enable
GRWRXSTARTEDEnable or disable interrupt for event RXSTARTED
Disabled0Disable
Enabled1Enable
HRWTXSTARTEDEnable or disable interrupt for event TXSTARTED
Disabled0Disable
Enabled1Enable
IRWLASTRXEnable or disable interrupt for event LASTRX
Disabled0Disable
Enabled1Enable
JRWLASTTXEnable or disable interrupt for event LASTTX
Disabled0Disable
Enabled1Enable

INTENSET

Address offset: 0x304

Enable interrupt

Bit number313029282726252423222120191817161514131211109876543210
IDJIHGFDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWSTOPPEDWrite '1' to enable interrupt for event STOPPED
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
DRWERRORWrite '1' to enable interrupt for event ERROR
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
FRWSUSPENDEDWrite '1' to enable interrupt for event SUSPENDED
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
GRWRXSTARTEDWrite '1' to enable interrupt for event RXSTARTED
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
HRWTXSTARTEDWrite '1' to enable interrupt for event TXSTARTED
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
IRWLASTRXWrite '1' to enable interrupt for event LASTRX
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled
JRWLASTTXWrite '1' to enable interrupt for event LASTTX
Set1Enable
Disabled0Read: Disabled
Enabled1Read: Enabled

INTENCLR

Address offset: 0x308

Disable interrupt

Bit number313029282726252423222120191817161514131211109876543210
IDJIHGFDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWSTOPPEDWrite '1' to disable interrupt for event STOPPED
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
DRWERRORWrite '1' to disable interrupt for event ERROR
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
FRWSUSPENDEDWrite '1' to disable interrupt for event SUSPENDED
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
GRWRXSTARTEDWrite '1' to disable interrupt for event RXSTARTED
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
HRWTXSTARTEDWrite '1' to disable interrupt for event TXSTARTED
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
IRWLASTRXWrite '1' to disable interrupt for event LASTRX
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled
JRWLASTTXWrite '1' to disable interrupt for event LASTTX
Clear1Disable
Disabled0Read: Disabled
Enabled1Read: Enabled

ERRORSRC

Address offset: 0x4C4

Error source

Bit number313029282726252423222120191817161514131211109876543210
IDCBA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARW
W1C
OVERRUN

Overrun error

A new byte was received before previous byte got transferred into RXD buffer. (Previous data is lost)

NotReceived0Error did not occur
Received1Error occurred
BRW
W1C
ANACKNACK received after sending the address (write '1' to clear)
NotReceived0Error did not occur
Received1Error occurred
CRW
W1C
DNACKNACK received after sending a data byte (write '1' to clear)
NotReceived0Error did not occur
Received1Error occurred

ENABLE

Address offset: 0x500

Enable TWIM

Bit number313029282726252423222120191817161514131211109876543210
IDAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWENABLEEnable or disable TWIM
Disabled0Disable TWIM
Enabled6Enable TWIM

PSEL.SCL

Address offset: 0x508

Pin select for SCL signal

Bit number313029282726252423222120191817161514131211109876543210
IDCBAAAAA
Reset 0xFFFFFFFF11111111111111111111111111111111
IDR/WFieldValue IDValueDescription
ARWPIN[0..31]Pin number
BRWPORT[0..1]Port number
CRWCONNECTConnection
Disconnected1Disconnect
Connected0Connect

PSEL.SDA

Address offset: 0x50C

Pin select for SDA signal

Bit number313029282726252423222120191817161514131211109876543210
IDCBAAAAA
Reset 0xFFFFFFFF11111111111111111111111111111111
IDR/WFieldValue IDValueDescription
ARWPIN[0..31]Pin number
BRWPORT[0..1]Port number
CRWCONNECTConnection
Disconnected1Disconnect
Connected0Connect

FREQUENCY

Address offset: 0x524

TWI frequency. Accuracy depends on the HFCLK source selected.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0400000000000100000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWFREQUENCYTWI master clock frequency
K1000x01980000100 kbps
K2500x04000000250 kbps
K4000x06400000400 kbps
K10000x0FF000001000 kbps

RXD

RXD EasyDMA channel

RXD.PTR

Address offset: 0x534

Data pointer

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWPTR

Data pointer

See the memory chapter for details about which memories are available for EasyDMA.

RXD.MAXCNT

Address offset: 0x538

Maximum number of bytes in receive buffer

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWMAXCNT[1..0xFFFF]Maximum number of bytes in receive buffer

RXD.AMOUNT

Address offset: 0x53C

Number of bytes transferred in the last transaction

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARAMOUNT[1..0xFFFF]Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte.

RXD.LIST

Address offset: 0x540

EasyDMA list type

Bit number313029282726252423222120191817161514131211109876543210
IDAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWLISTList type
Disabled0Disable EasyDMA list
ArrayList1Use array list

TXD

TXD EasyDMA channel

TXD.PTR

Address offset: 0x544

Data pointer

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWPTR

Data pointer

See the memory chapter for details about which memories are available for EasyDMA.

TXD.MAXCNT

Address offset: 0x548

Maximum number of bytes in transmit buffer

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWMAXCNT[1..0xFFFF]Maximum number of bytes in transmit buffer

TXD.AMOUNT

Address offset: 0x54C

Number of bytes transferred in the last transaction

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARAMOUNT[1..0xFFFF]Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte.

TXD.LIST

Address offset: 0x550

EasyDMA list type

Bit number313029282726252423222120191817161514131211109876543210
IDAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWLISTList type
Disabled0Disable EasyDMA list
ArrayList1Use array list

ADDRESS

Address offset: 0x588

Address used in the TWI transfer

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWADDRESSAddress used in the TWI transfer

Electrical specification

TWIM interface electrical specifications

SymbolDescriptionMin.Typ.Max.Units
fTWIM,SCLBit rates for TWIM21001000kbps
tTWIM,STARTTime from STARTRX/STARTTX task to transmission started1.5µs

Two Wire Interface Master (TWIM) timing specifications

SymbolDescriptionMin.Typ.Max.Units
tTWIM,SU_DATIInput data setup time before positive edge on SCL – all modes20ns
tTWIM,HD_DATIInput data hold time after negative edge on SCL – 100, 250 and 400 kbps0ns
tTWIM,HD_DATOOutput data hold time after negative edge on SCL – 100, 250 and 400 kbps500625ns
tTWIM,HD_DATO,1000kbpsOutput data hold time after negative edge on SCL – 1000 kbps250315ns
tTWIM,HD_STA,100kbpsTWIM master hold time for START and repeated START condition, 100 kbps9900ns
tTWIM,HD_STA,250kbpsTWIM master hold time for START and repeated START condition, 250 kbps3900ns
tTWIM,HD_STA,400kbpsTWIM master hold time for START and repeated START condition, 400 kbps2400ns
tTWIM,HD_STA,1000kbpsTWIM master hold time for START and repeated START condition, 1000 kbps900ns
tTWIM,SU_STO,100kbpsTWIM master setup time from SCL high to STOP condition, 100 kbps5000ns
tTWIM,SU_STO,250kbpsTWIM master setup time from SCL high to STOP condition, 250 kbps2000ns
tTWIM,SU_STO,400kbpsTWIM master setup time from SCL high to STOP condition, 400 kbps1250ns
tTWIM,SU_STO,1000kbpsTWIM master setup time from SCL high to STOP condition, 1000 kbps500ns
tTWIM,BUF,100kbpsTWIM master bus free time between STOP and START conditions, 100 kbps5250ns
tTWIM,BUF,250kbpsTWIM master bus free time between STOP and START conditions, 250 kbps2250ns
tTWIM,BUF,400kbpsTWIM master bus free time between STOP and START conditions, 400 kbps1500ns
tTWIM,BUF,1000kbpsTWIM master bus free time between STOP and START conditions, 1000 kbps750ns
Figure 7. TWIM timing diagram, 1 byte transaction
TWIM timing diagram, 1 byte transaction

Pullup resistor

Figure 8. Recommended TWIM pullup value vs. line capacitance
Recommended TWIM pullup value vs. line capacitance
1 Special pin and drive strength considerations applies when using the 1000 kbps baud rate. For pin recommendations, see Pin assignments.
2 High bit rates or stronger pull-ups may require GPIOs to be set as High Drive, see GPIO — General purpose input/output for more details.