diff --git a/rp2040-hal/src/uart.rs b/rp2040-hal/src/uart.rs
index 2f59c00..4ede6d8 100644
--- a/rp2040-hal/src/uart.rs
+++ b/rp2040-hal/src/uart.rs
@@ -209,12 +209,12 @@ impl<D: UARTDevice> UARTPeripheral<Enabled, D> {
                 }
             }
 
-            bytes_written += 1;
-
             self.device.uartdr.write(|w| unsafe {
                 w.data().bits(*c);
                 w
-            })
+            });
+            
+            bytes_written += 1;
         }
         Ok(bytes_written)
     }