Not all values of unsigned speed_in_khz can be achieved using the xcore divider. E.g. using 20000 will result in a 12.5MHz clock due to:
unsigned d = (XS1_TIMER_KHZ + 4_speed_in_khz - 1)/(4_speed_in_khz);
configure_clock_ref(cb0, d);
The speed is essentially a "maximum". This needs to be documented as causing confusion with users/support tickets where the data-rate is not as expected.
Suggest even a build warning should be emitted at build time,