Skip to content

Commit a361a50

Browse files
committed
Wait until DRE before writing to data register
1 parent 7e747aa commit a361a50

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cores/arduino/SERCOM.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ uint8_t SERCOM::readDataUART()
168168

169169
int SERCOM::writeDataUART(uint8_t data)
170170
{
171+
//Make sure DRE is set before writing to DATA reg
172+
while(!isDataRegisterEmptyUART());
173+
171174
//Put data into DATA register
172175
sercom->USART.DATA.reg = (uint16_t)data;
173176
return 1;

0 commit comments

Comments
 (0)