Skip to content
This is the development version of the documentation. It may change before the next release. See 0.14.x for the latest release.

SetCpuConfig

SetCpuConfig is a command that changes the settings the CPU firmware uses internally (the failsafe, the watchdog, PTP synchronization parameters, and so on).

let config = CpuConfig {
sync_guard,
failsafe_timeout,
ptp_unlock_failsafe_timeout,
fpga_bus_wait,
cpu_watchdog_timeout,
ptp: PtpConfig {
sync_interval,
tx_timestamp_timeout,
delay_resp_timeout,
holdover,
lock_samples,
step_threshold,
lock_threshold,
kp_milli,
ki_milli,
max_freq_ppb,
delay_req_syncs,
path_delay_filter_shift,
pause_quanta,
pause_hold_syncs,
pause_retry,
},
};
SetCpuConfig::new(config);
Field Type Default Description
sync_guard Duration 250 μs Margin for choosing the synchronization start time
failsafe_timeout Option<Duration> None A device stops its output once nothing has arrived from the host for this long (failsafe). None disables the failsafe
ptp_unlock_failsafe_timeout Option<Duration> None A device stops its output once it has been without its PTP lock for this long. None disables it
fpga_bus_wait FpgaBusWait Cycles3 Wait cycles of the bus the CPU reads and writes the FPGA through. Cycles2 or Cycles3
cpu_watchdog_timeout Option<Duration> 1 s Once the CPU firmware has stopped for this long, the device stops the output. None disables it
ptp PtpConfig PTP synchronization parameters
Field Type Default Description
sync_interval Duration 8 ms Interval at which Sync messages are sent
tx_timestamp_timeout Duration 3 ms How long to wait for the transmit timestamp of Delay_Req
delay_resp_timeout Duration 6 ms How long to wait for Delay_Resp
holdover Duration 1 s How long the lock is kept while locked and no Sync arrives
lock_samples NonZeroU16 64 Number of consecutive samples required to lock
step_threshold Duration 10 μs The clock is stepped when the time offset exceeds this
lock_threshold Duration 100 ns Samples whose time offset is below this count toward the lock
kp_milli u32 50 Proportional gain of the servo × 1000
ki_milli u32 1 Integral gain of the servo × 1000
max_freq_ppb u32 500,000 Limit of the frequency correction [ppb]. 0 to 2,147,483,647 (the device rejects larger values)
delay_req_syncs NonZeroU16 32 Interval at which the path delay is measured again once locked (in Sync messages)
path_delay_filter_shift u8 5 Smoothing factor 1 / 2^n of the path delay. 0 to 16 (the device rejects larger values). 0 disables the smoothing
pause_quanta Option<NonZeroU16> 48 Length of the PAUSE sent to the host when the link is saturated [512 bit times]. None sends no PAUSE
pause_hold_syncs u16 64 Number of Sync messages for which a PAUSE keeps being sent on every send after the link was found saturated
pause_retry Duration 8 ms How long PAUSE keeps being sent while a Sync cannot be sent out

The settings return to their defaults on Clear and on power cycling. Reopening the client does not reset them.

use std::time::Duration;
use autd3_rs::commands::{Clear, CpuConfig, SetCpuConfig, Synchronize};
use autd3_rs::geometry::{Autd3, Geometry};
use autd3_rs::Client;
use autd3_rs::udp::TransportOption;
let geometry = Geometry::new(vec![Autd3::default()]);
let option = TransportOption::default();
let mut client = Client::open(&geometry, &option).await?;
client.send(Clear).await?;
client.send(Synchronize).await?;
client.send(SetCpuConfig::new(CpuConfig {
ptp_unlock_failsafe_timeout: Some(Duration::from_secs(2)),
..Default::default()
})).await?;