adf4153(4304).c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. /******************************************************************************
  2. * @file ADF4153.c
  3. * @brief Implementation of ADF4153 Driver for Microblaze processor.
  4. * @author Istvan Csomortani (istvan.csomortani@analog.com)
  5. *
  6. *******************************************************************************
  7. * Copyright 2013(c) Analog Devices, Inc.
  8. *
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * - Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. * - Neither the name of Analog Devices, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived
  21. * from this software without specific prior written permission.
  22. * - The use of this software may or may not infringe the patent rights
  23. * of one or more patent holders. This license does not release you
  24. * from the requirement that you obtain separate licenses from these
  25. * patent holders to use this software.
  26. * - Use of the software either in source or binary form, must be run
  27. * on or directly connected to an Analog Devices Inc. component.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED
  30. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY
  31. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  32. * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  34. * INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  35. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  36. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. ******************************************************************************/
  41. /*****************************************************************************/
  42. /****************************** Include Files ********************************/
  43. /*****************************************************************************/
  44. #include "adf4153.h"
  45. typedef struct _adf4153_st{
  46. unsigned long long PFD_Value;
  47. uint16_t MOD_Value;
  48. uint32_t FRAC_Value;
  49. uint16_t INT_Value;
  50. double N_Value;
  51. }adf4153_st;
  52. extern PLL_Setting_st Pll_3_5_H;
  53. extern PLL_Setting_st Pll_3_5_L;
  54. uint32_t pow2(uint32_t val,int32_t val2){
  55. for(uint8_t i = 0; i < val2 - 1; i++){
  56. val = val * val;
  57. }
  58. return val;
  59. }
  60. double round_up( double value, int pos )
  61. {
  62. double temp;
  63. temp = value * pow2( 10, pos ); // �썝�븯�뒗 �냼�닔�젏 �옄由ъ닔留뚰겮 10�쓽 �늻�듅�쓣 �븿
  64. temp = (int)(temp + 0.5); // 0.5瑜� �뜑�븳�썑 踰꾨┝�븯硫� 諛섏삱由쇱씠 �맖
  65. temp *= pow2( 10, -pos ); // �떎�떆 �썝�옒 �냼�닔�젏 �옄由ъ닔濡�
  66. return temp;
  67. }
  68. double N_Reg_Value_Calc(double val){
  69. return val / 1000;
  70. }
  71. uint32_t N_Divider_Reg_Create(uint16_t _FRAC,uint16_t _INT,uint8_t _FASTLOCK){
  72. uint32_t ret = 0;
  73. uint32_t shift_bit = 0x01;
  74. uint8_t control_bit = 0;
  75. uint8_t i = 0;
  76. #ifdef DEBUG_PRINT
  77. printf("FRAC : %d INT : %d \r\n",(int)_FRAC,_INT);
  78. #endif /* DEBUG_PRINT */
  79. for(i = 0; i < 2; i++){
  80. if(control_bit & 0x01)
  81. ret += shift_bit << i;
  82. control_bit = control_bit >> 1;
  83. }
  84. #ifdef DEBUG_PRINT
  85. printf("\r\nLINE : %d ret : %x\r\n",__LINE__,ret);
  86. #endif /* DEBUG_PRINT */
  87. for(i = 2; i < 14; i++){
  88. if(_FRAC & 0x01)
  89. ret += shift_bit << i;
  90. _FRAC = _FRAC >> 1;
  91. }
  92. #ifdef DEBUG_PRINT
  93. printf("\r\nLINE : %d ret : %x\r\n",__LINE__,ret);
  94. #endif /* DEBUG_PRINT */
  95. for(i = 14; i < 22; i++){
  96. if(_INT & 0x01)
  97. ret += shift_bit << i;
  98. _INT = _INT >> 1;
  99. }
  100. #ifdef DEBUG_PRINT
  101. printf("\r\nLINE : %d ret : %x\r\n",__LINE__,ret);
  102. #endif /* DEBUG_PRINT */
  103. if(_FASTLOCK & 0x01)
  104. ret += shift_bit << i;
  105. #ifdef DEBUG_PRINT
  106. printf("\r\nLINE : %d ret : %x\r\n",__LINE__,ret);
  107. #endif /* DEBUG_PRINT */
  108. return ret;
  109. }
  110. uint32_t R_Divider_Reg_Create(uint16_t _MOD,uint8_t _RCOUNTER,uint8_t _PRESCALER,uint8_t _RESERVED,uint8_t _MUXOUT,uint8_t LOAD_CONTROL){
  111. uint32_t ret = 0;
  112. uint32_t shift_bit = 0x01;
  113. uint8_t control_bit = 1;
  114. uint8_t i = 0;
  115. #ifdef DEBUG_PRINT
  116. printf("_MOD : %d INT : %d \r\n",_MOD,_RCOUNTER);
  117. #endif /* DEBUG_PRINT */
  118. #ifdef DEBUG_PRINT
  119. printf("\r\nLINE : %d ret : %x\r\n",__LINE__,ret);
  120. #endif /* DEBUG_PRINT */
  121. for(i = 0; i < 2; i++){
  122. if(control_bit & 0x01)
  123. ret += shift_bit << i;
  124. control_bit = control_bit >> 1;
  125. }
  126. #ifdef DEBUG_PRINT
  127. printf("\r\nLINE : %d ret : %x\r\n",__LINE__,ret);
  128. #endif /* DEBUG_PRINT */
  129. for(i = 2; i < 14; i++){
  130. if(_MOD & 0x01)
  131. ret += shift_bit << i;
  132. _MOD = _MOD >> 1;
  133. }
  134. for(i = 14; i < 18; i++){
  135. if(_RCOUNTER & 0x01)
  136. ret += shift_bit << i;
  137. _RCOUNTER = _RCOUNTER >> 1;
  138. }
  139. if(_PRESCALER & 0x01)
  140. ret += shift_bit << i++;
  141. if(_RESERVED & 0x01)
  142. ret += shift_bit << i++;
  143. for(i = 19; i < 22; i++){
  144. if(_MUXOUT & 0x01)
  145. ret += shift_bit << i;
  146. _MUXOUT = _MUXOUT >> 1;
  147. }
  148. if(LOAD_CONTROL & 0x01)
  149. ret += shift_bit << i++;
  150. return ret;
  151. }
  152. ADF4153_R_N_Reg_st ADF4153_Freq_Calc(unsigned long long Freq,unsigned long long REFin,uint8_t R_Counter,uint32_t chspacing){
  153. adf4153_st temp_adf4153;
  154. double temp = 0;
  155. ADF4153_R_N_Reg_st temp_reg;
  156. temp_adf4153.PFD_Value = REFin / (R_Counter * 1000);
  157. temp_adf4153.MOD_Value = (temp_adf4153.PFD_Value / chspacing) * 1000;
  158. temp_adf4153.N_Value = N_Reg_Value_Calc(((double)(Freq / 1000) / (double)(temp_adf4153.PFD_Value / 1000)));
  159. temp_adf4153.INT_Value = temp_adf4153.N_Value ;
  160. #ifdef DEBUG_PRINT
  161. printf("\r\ntemp_adf4153.N_Value : %f temp_adf4153.INT_Value : %f temp_adf4153.MOD_Value : %f \r\n",temp_adf4153.N_Value,(double)temp_adf4153.INT_Value,(double)temp_adf4153.MOD_Value);
  162. #endif /* DEBUG_PRINT */
  163. temp = temp_adf4153.N_Value - (double)temp_adf4153.INT_Value;
  164. #ifdef DEBUG_PRINT
  165. printf("\r\n temp_adf4153.N_Value - (double)temp_adf4153.INT_Value) : %f temp * (double)temp_adf4153.MOD_Value : %f \r\n",temp,temp * (double)temp_adf4153.MOD_Value);
  166. #endif /* DEBUG_PRINT */
  167. temp_adf4153.FRAC_Value = (float)temp * temp_adf4153.MOD_Value;
  168. #ifdef DEBUG_PRINT
  169. printf("\r\ntemp_adf4153.N_Value : %x : %f ",temp_adf4153.N_Value,((double)(Freq / 1000) / (double)(temp_adf4153.PFD_Value / 1000)) / 1000);
  170. printf("temp_adf4153.MOD_Value : %x : %d \r\n",temp_adf4153.MOD_Value,temp_adf4153.MOD_Value);
  171. #endif /* DEBUG_PRINT */
  172. uint16_t tempmod = temp_adf4153.FRAC_Value;
  173. for(uint8_t i = 0; i < 12; i++){
  174. #ifdef DEBUG_PRINT
  175. if(temp_adf4153.MOD_Value & 0x800){
  176. printf("1");
  177. }else{
  178. printf("0");
  179. }
  180. #endif /* DEBUG_PRINT */
  181. tempmod = tempmod << 1;
  182. }
  183. #ifdef DEBUG_PRINT
  184. printf("\r\n");
  185. printf("temp_adf4153.FRAC_Value : %x : %d\r\n",temp_adf4153.FRAC_Value,temp_adf4153.FRAC_Value);
  186. #endif /* DEBUG_PRINT */
  187. uint16_t tempfrac = temp_adf4153.FRAC_Value;
  188. for(uint8_t i = 0; i < 12; i++){
  189. #ifdef DEBUG_PRINT
  190. if(tempfrac & 0x800){
  191. printf("1");
  192. }else{
  193. printf("0");
  194. }
  195. #endif /* DEBUG_PRINT */
  196. tempfrac = tempfrac << 1;
  197. }
  198. #ifdef DEBUG_PRINT
  199. printf("\r\n");
  200. #endif /* DEBUG_PRINT */
  201. #ifdef DEBUG_PRINT
  202. printf("temp_adf4153.INT_Value : %x : %d\r\n",temp_adf4153.INT_Value,temp_adf4153.INT_Value);
  203. #endif /* DEBUG_PRINT */
  204. uint16_t tempint = temp_adf4153.INT_Value;
  205. for(uint8_t i = 0; i < 9; i++){
  206. #ifdef DEBUG_PRINT
  207. if(tempint & 0x100){
  208. printf("1");
  209. }else{
  210. printf("0");
  211. }
  212. #endif /* DEBUG_PRINT */
  213. tempint = tempint << 1;
  214. }
  215. #ifdef DEBUG_PRINT
  216. printf("\r\n");
  217. printf("R0: %x R1: %x \r\n",N_Divider_Reg_Create(temp_adf4153.FRAC_Value,temp_adf4153.INT_Value,0),R_Divider_Reg_Create(temp_adf4153.MOD_Value,R_Counter,1,0,2,0));
  218. #endif /* DEBUG_PRINT */
  219. temp_reg.N_reg = N_Divider_Reg_Create(temp_adf4153.FRAC_Value,temp_adf4153.INT_Value,0);
  220. temp_reg.R_reg = R_Divider_Reg_Create(temp_adf4153.MOD_Value,R_Counter,1,0,2,0);
  221. return temp_reg;
  222. // R_Divider_Reg_Create(temp_adf4153.MOD_Value,R_Counter,1,0,1,0); //prescaler 1 : 8/9 0: 4/5
  223. }
  224. void ADF4153_Initialize(void){
  225. #if 0 // PYJ.2019.08.09_BEGIN --
  226. PLL_Setting_st Pll_test = {
  227. PLL_CLK_3_5G_GPIO_Port,
  228. PLL_CLK_3_5G_Pin,
  229. PLL_DATA_3_5G_GPIO_Port,
  230. PLL_DATA_3_5G_Pin,
  231. PLL_EN_3_5G_L_GPIO_Port,
  232. PLL_EN_3_5G_L_Pin,
  233. };
  234. PLL_Setting_st Pll_test2 = {
  235. PLL_CLK_3_5G_GPIO_Port,
  236. PLL_CLK_3_5G_Pin,
  237. PLL_DATA_3_5G_GPIO_Port,
  238. PLL_DATA_3_5G_Pin,
  239. PLL_EN_3_5G_H_GPIO_Port,
  240. PLL_EN_3_5G_H_Pin,
  241. };
  242. // ADF4153_Module_Ctrl(Pll_test,0x2B44B0,0x14BE81,0x0013C2,0x000003);
  243. ADF4153_R_N_Reg_st temp_reg;
  244. temp_reg = ADF4153_Freq_Calc(3465500000,ADF4153_REFIN,ADF4153_RCOUNTER,ADF4153_CHANNEL_SPACING);
  245. ADF4153_Module_Ctrl(Pll_test,temp_reg.N_reg,temp_reg.R_reg,0x13c2,0x3);
  246. HAL_Delay(1);
  247. #ifdef DEBUG_PRINT
  248. printf("\r\nPLL_EN_3_5G_H_GPIO_Port\r\n");
  249. #endif /* DEBUG_PRINT */
  250. temp_reg = ADF4153_Freq_Calc(3934500000,ADF4153_REFIN,ADF4153_RCOUNTER,ADF4153_CHANNEL_SPACING);
  251. ADF4153_Module_Ctrl(Pll_test2,temp_reg.N_reg,temp_reg.R_reg,0x13c2,0x3);
  252. // ADF4153_Module_Ctrl(Pll_test2,0x313840,0x14BE81,0x13C2,0x3);
  253. HAL_Delay(1);
  254. #endif // PYJ.2019.08.09_END --
  255. if(Flash_Save_data[INDEX_PLL_3_5G_DL_H] == 0 && Flash_Save_data[INDEX_PLL_3_5G_DL_L] == 0){
  256. Flash_Save_data[INDEX_PLL_3_5G_DL_H] = ((34655 & 0xFF00) >> 8);
  257. Flash_Save_data[INDEX_PLL_3_5G_DL_L] = (34655 & 0x00FF);
  258. }
  259. if(Flash_Save_data[INDEX_PLL_3_5G_UL_H] == 0 && Flash_Save_data[INDEX_PLL_3_5G_UL_L] == 0){
  260. Flash_Save_data[INDEX_PLL_3_5G_UL_H] = ((39345 & 0xFF00) >> 8);
  261. Flash_Save_data[INDEX_PLL_3_5G_UL_L] = (39345 & 0x00FF);
  262. }
  263. }
  264. void ADF4153_Check(void){
  265. ADF4153_R_N_Reg_st temp_reg;
  266. if(HAL_GPIO_ReadPin(PLL_LD_3_5G_H_GPIO_Port, PLL_LD_3_5G_H_Pin) == GPIO_PIN_RESET
  267. && HAL_GPIO_ReadPin(PLL_ON_OFF_3_5G_H_GPIO_Port, PLL_ON_OFF_3_5G_H_Pin) == GPIO_PIN_SET){
  268. temp_reg = ADF4153_Freq_Calc(3934500000,ADF4153_REFIN,ADF4153_RCOUNTER,ADF4153_CHANNEL_SPACING);
  269. ADF4153_Module_Ctrl(Pll_3_5_H,temp_reg.N_reg,temp_reg.R_reg,0x13c2,0x3);
  270. HAL_Delay(1);
  271. }
  272. if(HAL_GPIO_ReadPin(PLL_LD_3_5G_L_GPIO_Port, PLL_LD_3_5G_L_Pin) == GPIO_PIN_RESET
  273. && HAL_GPIO_ReadPin(PLL_ON_OFF_3_5G_L_GPIO_Port, PLL_ON_OFF_3_5G_L_Pin) == GPIO_PIN_SET){
  274. temp_reg = ADF4153_Freq_Calc(3465500000,ADF4153_REFIN,ADF4153_RCOUNTER,ADF4153_CHANNEL_SPACING);
  275. ADF4153_Module_Ctrl(Pll_3_5_L,temp_reg.N_reg,temp_reg.R_reg,0x13c2,0x3);
  276. HAL_Delay(1);
  277. }
  278. }
  279. void ADF4153_Module_Ctrl(PLL_Setting_st pll,uint32_t R0,uint32_t R1,uint32_t R2,uint32_t R3){
  280. R3 = R3 & 0x0007FF;
  281. R2 = R2 & 0x00FFFF;
  282. R1 = R1 & 0xFFFFFF;
  283. R0 = R0 & 0xFFFFFF;
  284. // ADF4153_Freq_Calc(3461500000,40000000,2,5000);
  285. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_RESET);
  286. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_RESET);
  287. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_RESET);
  288. #ifdef DEBUG_PRINT
  289. printf("YJ :R0: %x R1: %x R2 : %x R3 : %x ",R0,R1,R2,R3);
  290. printf("\r\n");
  291. #endif /* DEBUG_PRINT */
  292. /* R3 Ctrl */
  293. for(int i =0; i < 11; i++){
  294. if(R3 & 0x000400){
  295. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_SET);
  296. #ifdef DEBUG_PRINT
  297. printf("1");
  298. #endif /* DEBUG_PRINT */
  299. }
  300. else{
  301. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_RESET);
  302. #ifdef DEBUG_PRINT
  303. printf("0");
  304. #endif /* DEBUG_PRINT */
  305. }
  306. Pol_Delay_us(50);
  307. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_SET);
  308. Pol_Delay_us(50);
  309. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_RESET);
  310. R3 = (R3 << 1);
  311. }
  312. #ifdef DEBUG_PRINT
  313. printf("\r\n");
  314. #endif /* DEBUG_PRINT */
  315. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_SET);
  316. Pol_Delay_us(50);
  317. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_RESET);
  318. /* R2 Ctrl */
  319. for(int i =0; i < 16; i++){
  320. if(R2 & 0x008000){
  321. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_SET);
  322. #ifdef DEBUG_PRINT
  323. printf("1");
  324. #endif /* DEBUG_PRINT */
  325. }
  326. else{
  327. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_RESET);
  328. #ifdef DEBUG_PRINT
  329. printf("0");
  330. #endif /* DEBUG_PRINT */
  331. }
  332. Pol_Delay_us(50);
  333. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_SET);
  334. Pol_Delay_us(50);
  335. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_RESET);
  336. R2 = ((R2 << 1) & 0x00FFFF);
  337. }
  338. #ifdef DEBUG_PRINT
  339. printf("\r\n");
  340. #endif /* DEBUG_PRINT */
  341. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_SET);
  342. Pol_Delay_us(50);
  343. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_RESET);
  344. /* R1 Ctrl */
  345. for(int i =0; i < 24; i++){
  346. if(R1 & 0x800000){
  347. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_SET);
  348. #ifdef DEBUG_PRINT
  349. printf("1");
  350. #endif /* DEBUG_PRINT */
  351. }
  352. else{
  353. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_RESET);
  354. #ifdef DEBUG_PRINT
  355. printf("0");
  356. #endif /* DEBUG_PRINT */
  357. }
  358. Pol_Delay_us(50);
  359. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_SET);
  360. Pol_Delay_us(50);
  361. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_RESET);
  362. R1 = ((R1 << 1) & 0xFFFFFF);
  363. }
  364. #ifdef DEBUG_PRINT
  365. printf("\r\n");
  366. #endif /* DEBUG_PRINT */
  367. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_SET);
  368. Pol_Delay_us(50);
  369. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_RESET);
  370. /* R0 Ctrl */
  371. for(int i =0; i < 24; i++){
  372. if(R0 & 0x800000){
  373. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_SET);
  374. #ifdef DEBUG_PRINT
  375. printf("1");
  376. #endif /* DEBUG_PRINT */
  377. }
  378. else{
  379. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_RESET);
  380. #ifdef DEBUG_PRINT
  381. printf("0");
  382. #endif /* DEBUG_PRINT */
  383. }
  384. Pol_Delay_us(50);
  385. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_SET);
  386. Pol_Delay_us(50);
  387. HAL_GPIO_WritePin(pll.PLL_CLK_PORT, pll.PLL_CLK_PIN, GPIO_PIN_RESET);
  388. R0 = ((R0 << 1) & 0xFFFFFF);
  389. }
  390. #ifdef DEBUG_PRINT
  391. printf("\r\n");
  392. #endif /* DEBUG_PRINT */
  393. HAL_GPIO_WritePin(pll.PLL_DATA_PORT, pll.PLL_DATA_PIN, GPIO_PIN_RESET);
  394. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_SET);
  395. Pol_Delay_us(50);
  396. HAL_GPIO_WritePin(pll.PLL_ENABLE_PORT, pll.PLL_ENABLE_PIN, GPIO_PIN_RESET);
  397. }