diff --git a/artiq/firmware/ksupport/rtio.rs b/artiq/firmware/ksupport/rtio.rs index 682a118c6..0c95842ad 100644 --- a/artiq/firmware/ksupport/rtio.rs +++ b/artiq/firmware/ksupport/rtio.rs @@ -140,16 +140,17 @@ pub fn log(timestamp: i64, data: &[u8]) { for i in 0..data.len() { word <<= 8; word |= data[i] as u32; - if i != 0 && i % 4 == 0 { + if i % 4 == 3 { rtio_o_data_write(0, word); csr::rtio::o_we_write(1); word = 0; } } - word <<= 8; - rtio_o_data_write(0, word); - csr::rtio::o_we_write(1); + if word != 0 { + rtio_o_data_write(0, word); + csr::rtio::o_we_write(1); + } } }