9 TWI Pin Configuration

ATmega328PB has two TWI modules and each module has two pins; SDA and SCL. When the TWEN bit in the TWCRn is set (one) to enable the 2-wire Serial Interface, the pins are disconnected from the I/O port and become the Serial Clock (SCL) or Data (SDA). In this mode, there is a spike filter on the pin to suppress spikes shorter than 50ns on the input signal, and the pin is driven by an open drain driver with slew-rate limitation. Note that the internal pull-ups in the AVR® pads can be enabled by setting the PORT bits corresponding to the SCL and SDA pins, eliminating the need for external pull-up in some systems.

Figure 9-1. TWI Control Register n

Bit 2 – TWEN: TWI Enable