firmware: enable int mode if div is even integer
to improve jitter performance
This commit is contained in:
@ -49,6 +49,9 @@ bool set_fracrate(const float freq) {
|
|||||||
|
|
||||||
if(a != div){
|
if(a != div){
|
||||||
uint32_t j=0,k=1,l=1,m=1;
|
uint32_t j=0,k=1,l=1,m=1;
|
||||||
|
|
||||||
|
si5351c_set_int_mode(0, 0);
|
||||||
|
|
||||||
while (k <= 0xFFFF && m <= 0xFFFF){
|
while (k <= 0xFFFF && m <= 0xFFFF){
|
||||||
float n = (float)(j+l)/(k+m);
|
float n = (float)(j+l)/(k+m);
|
||||||
if( x == n){
|
if( x == n){
|
||||||
@ -77,6 +80,10 @@ bool set_fracrate(const float freq) {
|
|||||||
b=j; c=k;
|
b=j; c=k;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(a & 0x1) // odd integer, needs frac mode
|
||||||
|
si5351c_set_int_mode(0, 0);
|
||||||
|
else
|
||||||
|
si5351c_set_int_mode(0, 1);
|
||||||
b=0; c=1;
|
b=0; c=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,3 +249,21 @@ void si5351c_configure_clock_control()
|
|||||||
uint8_t data[] = { 3, 0xC8 };
|
uint8_t data[] = { 3, 0xC8 };
|
||||||
si5351c_write(data, sizeof(data));
|
si5351c_write(data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void si5351c_set_int_mode(const uint_fast8_t ms_number, const uint_fast8_t on){
|
||||||
|
uint8_t data[] = {16, 0};
|
||||||
|
|
||||||
|
if(ms_number < 8){
|
||||||
|
data[0] = 16 + ms_number;
|
||||||
|
data[1] = si5351c_read_single(data[0]);
|
||||||
|
|
||||||
|
if(on)
|
||||||
|
data[1] |= SI5351C_CLK_INT_MODE;
|
||||||
|
else
|
||||||
|
data[1] &= ~(SI5351C_CLK_INT_MODE);
|
||||||
|
|
||||||
|
si5351c_write(data, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -67,6 +67,7 @@ void si5351c_configure_multisynth(const uint_fast8_t ms_number,
|
|||||||
const uint_fast8_t r_div);
|
const uint_fast8_t r_div);
|
||||||
void si5351c_configure_clock_control();
|
void si5351c_configure_clock_control();
|
||||||
void si5351c_enable_clock_outputs();
|
void si5351c_enable_clock_outputs();
|
||||||
|
void si5351c_set_int_mode(const uint_fast8_t ms_number, const uint_fast8_t on);
|
||||||
|
|
||||||
void si5351c_write_single(uint8_t reg, uint8_t val);
|
void si5351c_write_single(uint8_t reg, uint8_t val);
|
||||||
uint8_t si5351c_read_single(uint8_t reg);
|
uint8_t si5351c_read_single(uint8_t reg);
|
||||||
|
Reference in New Issue
Block a user