8002 Use external crystal oscillator configuration*
1. Find the board level that you want to modify*
- The 8002b_dev board is used as an example
- Find lvp_tws/boards/nationalchip/grus_gx8002b_dev_1v/clock_board c , only need to configure this file can use external crystals.
2. Modifying configuration Procedure*
- The following modifications are made in
lvp_tws/boards/nationalchip/grus_gx8002b_dev_1v/clock_board.c
Modification in file
2.1 Modifying the clock source*
- The external clock source is configured by setting the second parameter of the two highlighted lines to 1 and leaving the rest of the lines unchanged
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/******************* CLOCK SOURCE CONFIG *******************/ static GX_CLOCK_SOURCE_TABLE clk_src_xtal_table[] = { /* id source source0 source1 */ {CLOCK_SOURCE_32K_PLL , 0}, /* CLOCK_SOURCE_OSC_32K | CLOCK_SOURCE_XTAL_32K */ {CLOCK_SOURCE_1M_INPUT , 0}, /* CLOCK_SOURCE_PDM_IN | CLOCK_SOURCE_PWM_IN */ {CLOCK_SOURCE_1M , 0}, /* CLOCK_SOURCE_OSC_1M | CLOCK_SOURCE_1M_INPUT */ {CLOCK_SOURCE_OSC_PLL , 0}, /* CLOCK_SOURCE_32K_PLL | CLOCK_SOURCE_1M */ {CLOCK_SOURCE_PIN_IN , 1}, /* CLOCK_SOURCE_AUDIO_MCLK | CLOCK_SOURCE_PWM_IN */ {CLOCK_SOURCE_24M , 1}, /* CLOCK_SOURCE_OSC_24M | CLOCK_SOURCE_PIN_IN */ {CLOCK_SOURCE_PLL_DTO , 0}, /* CLOCK_SOURCE_OSC_PLL | CLOCK_SOURCE_PIN_IN */ {CLOCK_SOURCE_1M_12M , 1}, /* CLOCK_SOURCE_OSC_24M | CLOCK_SOURCE_1M */ {CLOCK_SOURCE_24M_PLL , 0}, /* CLOCK_SOURCE_24M | CLOCK_SOURCE_PLL_DTO */ {CLOCK_SOURCE_32K , 0}, /* CLOCK_SOURCE_OSC_32K | CLOCK_SOURCE_XTAL_32K */ }; /******************* CLOCK SOURCE CONFIG *******************/ static GX_CLOCK_SOURCE_TABLE clk_src_osc_table[] = { /* id source source0 source1 */ {CLOCK_SOURCE_32K_PLL , 1}, /* CLOCK_SOURCE_OSC_32K | CLOCK_SOURCE_XTAL_32K */ {CLOCK_SOURCE_1M_INPUT , 0}, /* CLOCK_SOURCE_PDM_IN | CLOCK_SOURCE_PWM_IN */ {CLOCK_SOURCE_1M , 0}, /* CLOCK_SOURCE_OSC_1M | CLOCK_SOURCE_1M_INPUT */ {CLOCK_SOURCE_OSC_PLL , 0}, /* CLOCK_SOURCE_32K_PLL | CLOCK_SOURCE_1M */ {CLOCK_SOURCE_PIN_IN , 0}, /* CLOCK_SOURCE_AUDIO_MCLK | CLOCK_SOURCE_PWM_IN */ {CLOCK_SOURCE_24M , 0}, /* CLOCK_SOURCE_OSC_24M | CLOCK_SOURCE_PIN_IN */ {CLOCK_SOURCE_PLL_DTO , 0}, /* CLOCK_SOURCE_OSC_PLL | CLOCK_SOURCE_PIN_IN */ {CLOCK_SOURCE_1M_12M , 1}, /* CLOCK_SOURCE_OSC_24M/2 | CLOCK_SOURCE_1M */ {CLOCK_SOURCE_24M_PLL , 1}, /* CLOCK_SOURCE_24M | CLOCK_SOURCE_PLL_DTO */ {CLOCK_SOURCE_32K , 1}, /* CLOCK_SOURCE_OSC_32K | CLOCK_SOURCE_XTAL_32K */ };
2.2 Enable clock*
- To enable the external crystal oscillator, locate the clk_init interface
- Add the code to enable external crystal at the beginning of the interface ( as in the first highlighted part ) and mask the code to turn off external crystal ( as in the second highlighted part ).
notice
The position of the enabled and disabled code does not change, such as the example modification, the enabled code must be first.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|