diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c
index 74e601f3b8c01409e38677cb4bc6c76211b27b6e..4031d8acd4fdc748fd3d6caee9ffd0c14918bb6b 100644
--- a/ports/stm32/uart.c
+++ b/ports/stm32/uart.c
@@ -517,7 +517,7 @@ mp_uint_t uart_rx_any(pyb_uart_obj_t *self) {
     } else if (buffer_bytes > 0) {
         return buffer_bytes;
     } else {
-        return UART_RXNE_IS_SET(self->uartx);
+        return UART_RXNE_IS_SET(self->uartx) != 0;
     }
 }