Skip to content

Commit 742f59a

Browse files
committed
Disable PDC controller during TWI init.
1 parent 668345c commit 742f59a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hardware/sam/libraries/Wire/Wire.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,21 @@ TwoWire::TwoWire(Twi *_twi, void(*_beginCb)(void)) :
8989
void TwoWire::begin(void) {
9090
if (onBeginCallback)
9191
onBeginCallback();
92+
93+
// Disable PDC channel
94+
twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
95+
9296
TWI_ConfigureMaster(twi, TWI_CLOCK, VARIANT_MCK);
9397
status = MASTER_IDLE;
9498
}
9599

96100
void TwoWire::begin(uint8_t address) {
97101
if (onBeginCallback)
98102
onBeginCallback();
103+
104+
// Disable PDC channel
105+
twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
106+
99107
TWI_ConfigureSlave(twi, address);
100108
status = SLAVE_IDLE;
101109
TWI_EnableIt(twi, TWI_IER_SVACC);

0 commit comments

Comments
 (0)