Clock generator @ 145 MHz and 7 mhz
Fork of Check_Si5351A_Clock_generator by
Diff: si5351a_check.cpp
- Revision:
- 4:5981cf106502
- Parent:
- 3:92f31b23fb0b
- Child:
- 5:e32ef4b85317
--- a/si5351a_check.cpp Fri Jan 06 14:09:18 2017 +0000 +++ b/si5351a_check.cpp Sat Jan 07 05:57:55 2017 +0000 @@ -8,7 +8,7 @@ * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ * Created: December 28th, 2016 - * Revised: January 6th, 2017 + * Revised: January 7th, 2017 * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF @@ -35,6 +35,35 @@ // RAM ------------------------------------------------------------------------ bool one_char = false; +// ROM / Constant data -------------------------------------------------------- +#if defined(RANGE_EXTENDED) +static const uint32_t freq_tbl[] = +{ + 1628, 1800, 1900, 2000, 2500, 2604, 2605, 2700, 3000, // 1.627KHz-3KHz + // Above includes out of range freq. + 4000, 5000, 8000, // 4KHz-8KHz + 10000, 20000, 50000, 80000, // 10KHz-80KHz + 100000, 200000, 500000, 800000, // 100KHz-800KHz + 1000000, 2000000, 5000000, 8000000, // 1MHz-8MHz + 10000000, 20000000, 50000000, 80000000, // 10MHz-80MHz + 100000000, 150000000, 200000000, // 100MHz-200MHz + // Belows are out of Si5351A specification !!!! + 220000000, 250000000, 280000000, 300000000,// 200MHz-300MHz + 0 // Terminate data!! +}; +#else +static const uint32_t freq_tbl[] = +{ + 2605, 4000, 5000, 8000, // 2.6KHz-8KHz + 10000, 20000, 50000, 80000, // 10KHz-80KHz + 100000, 200000, 500000, 800000, // 100KHz-800KHz + 1000000, 2000000, 5000000, 8000000, // 1MHz-8MHz + 10000000, 20000000, 50000000, 80000000, // 10MHz-80MHz + 100000000, 150000000, 200000000, // 100MHz-200MHz + 0 // Terminate data!! +}; +#endif + //------------------------------------------------------------------------------ // Control Program //------------------------------------------------------------------------------ @@ -48,13 +77,27 @@ { PRINTF(opening_msg); put_rn(); - PRINTF("0 - Check CLK0 output between 50KHz to 90MHz"); +#if defined(RANGE_EXTENDED) + PRINTF("0 - Check CLK0 output between 1.627KHz to 300MHz"); + put_rn(); + PRINTF("-> You are using RANGE_EXTENDED (defined in si5351a.h)"); + put_rn(); + PRINTF("-> In RANGE_EXTENDED mode, PLL sets 250MHz to 1.3GHz"); + put_rn(); + PRINTF("-> This causes high possibility to make a PARMANENT DAMAGE"); + PRINTF(" for the chip!"); + put_rn(); + PRINTF("-> Don't use this mode!!!"); +#else + PRINTF("0 - Check CLK0 output between 2.605KHz to 200MHz"); +#endif put_rn(); PRINTF("1 - Check CLK1 (same as #1)"); put_rn(); PRINTF("2 - Check CLK2 (same as #1)"); put_rn(); PRINTF("3 - Example CLK0:120.00MHz, CLK1:12.00MHz, CLK2:13.56MHz"); + PRINTF("-> No wat to apply a frequency compensation"); put_rn(); PRINTF("4 - Set desired freq. into CLK0"); put_rn(); @@ -91,6 +134,15 @@ put_rn(); PRINTF("%s [Help:'?' key]", opening_msg); put_rn(); +#if defined(RANGE_EXTENDED) + PRINTF("-> You are using RANGE_EXTENDED (defined in si5351a.h)"); + put_rn(); + PRINTF("-> In RANGE_EXTENDED mode, PLL sets 375MHz to 1.3GHz"); + put_rn(); + PRINTF("-> This causes high possibility to make a PARMANENT DAMAGE"); + PRINTF(" for the chip!"); + put_rn(); +#endif clk.all_reset(); for (;;) { put_r(); @@ -240,6 +292,7 @@ PRINTF("CLK0:%u [Hz]", clk.set_frequency(0, f)); } else { PUTC('?'); + put_r(); } put_rn(); PRINTF("Please enter sift command [Help: ?]"); @@ -250,10 +303,18 @@ get_line(ptr, buf_size); put_r(); switch(*ptr) { + case 'P' : + PRINTF("Shift to %u [Hz]", clk.shift_freq(0, 100)); + put_rn(); + break; case 'p' : PRINTF("Shift to %u [Hz]", clk.shift_freq(0, 10)); put_rn(); break; + case 'M' : + PRINTF("Shift to %u [Hz]", clk.shift_freq(0, -100)); + put_rn(); + break; case 'm' : PRINTF("Shift to %u [Hz]", clk.shift_freq(0, -10)); put_rn(); @@ -266,12 +327,12 @@ put_rn(); break; case '?' : - PRINTF("p -> +10Hz"); + PRINTF("p -> +10Hz, P -> +100Hz"); put_rn(); - PRINTF("m -> -10Hz"); + PRINTF("m -> -10Hz, M -> -100Hz"); put_rn(); PRINTF("s -> Shift +/-x Hz (example -100)"); - put_rn(); + put_rn(); PRINTF("? -> You know this"); put_rn(); PRINTF("e -> Exit"); @@ -323,7 +384,7 @@ clk.debug_current_config(); } else { PUTC('?'); - } + } break; //-------------------------------------------------------------- // Show resisters @@ -331,7 +392,7 @@ case 'r' : clk.debug_reg_print(); //put_rn(); - break; + break; //-------------------------------------------------------------- // Go to special command //-------------------------------------------------------------- @@ -355,7 +416,6 @@ } } - #if defined(INCREMENT) void test(uint8_t channel) { @@ -445,7 +505,7 @@ } } #endif - + void special_command(void) { PRINTF("Not impliment yet"); @@ -546,11 +606,12 @@ PUTC(c); // Special control if (one_char == true){ - if ((c == 'p') || (c == 'm')){ break;} + if ((c == 'p') || (c == 'm') || (c == 'P') || (c == 'M')){ + break; + } } } } buff[idx] = 0; PUTC('\n'); } -