diff --git a/artiq/firmware/libboard/lib.rs b/artiq/firmware/libboard/lib.rs index 686b911f5..233453b5b 100644 --- a/artiq/firmware/libboard/lib.rs +++ b/artiq/firmware/libboard/lib.rs @@ -11,6 +11,7 @@ include!(concat!(env!("BUILDINC_DIRECTORY"), "/generated/csr.rs")); pub mod spr; pub mod irq; pub mod clock; +pub mod uart; #[cfg(has_i2c)] pub mod i2c; diff --git a/artiq/firmware/libboard/uart.rs b/artiq/firmware/libboard/uart.rs new file mode 100644 index 000000000..d464c1840 --- /dev/null +++ b/artiq/firmware/libboard/uart.rs @@ -0,0 +1,8 @@ +use csr; + +pub fn set_speed(rate: u32) { + unsafe { + let tuning_word = (rate as u64) * (1 << 32) / (csr::CONFIG_CLOCK_FREQUENCY as u64); + csr::uart_phy::tuning_word_write(tuning_word as u32); + } +} diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 07973b032..717ecd601 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -103,6 +103,7 @@ pub unsafe extern fn rust_main() { static mut LOG_BUFFER: [u8; 65536] = [0; 65536]; BufferLogger::new(&mut LOG_BUFFER[..]) .register(move || { + board::uart::set_speed(921600); board::clock::init(); info!("ARTIQ runtime starting..."); info!("software version {}", GIT_COMMIT); diff --git a/artiq/frontend/artiq_devtool.py b/artiq/frontend/artiq_devtool.py index 28d08ff0a..e6ad49129 100644 --- a/artiq/frontend/artiq_devtool.py +++ b/artiq/frontend/artiq_devtool.py @@ -66,11 +66,11 @@ def main(): tmp = "artiq" + "".join([rng.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZ") for _ in range(6)]) env = "bash -c 'export PATH=$HOME/miniconda/bin:$PATH; exec $0 $*' " - def run_command(cmd): + def run_command(cmd, **kws): logger.info("Executing {}".format(cmd)) chan = get_ssh().get_transport().open_session() chan.set_combine_stderr(True) - chan.exec_command(cmd.format(tmp=tmp, env=env, serial=args.serial, ip=args.ip)) + chan.exec_command(cmd.format(tmp=tmp, env=env, serial=args.serial, ip=args.ip, **kws)) return chan.makefile() def drain(chan): @@ -151,7 +151,7 @@ def main(): logger.info("Connecting to device") flterm = run_command( - "{env} python3 flterm.py {serial} --output-only") + "{env} python3 flterm.py {serial} --speed 921600 --output-only") drain(flterm) else: