1
- /*
1
+ /*
2
2
phy.c - ESP8266 PHY initialization data
3
3
4
4
Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
5
5
This file is part of the esp8266 core for Arduino environment.
6
-
6
+
7
7
This library is free software; you can redistribute it and/or
8
8
modify it under the terms of the GNU Lesser General Public
9
9
License as published by the Free Software Foundation; either
24
24
#include <stddef.h>
25
25
#include <stdbool.h>
26
26
27
- static uint8_t phy_init_data [128 ] =
27
+ static uint8_t phy_init_data [128 ] =
28
28
{
29
29
[0 ] = 5 , // Reserved, do not change
30
30
[1 ] = 0 , // Reserved, do not change
@@ -157,28 +157,28 @@ static uint8_t phy_init_data[128] =
157
157
158
158
// lp_rf_stg10
159
159
// the attenuation of RF gain stage 0 and 1,
160
- // 0xf: 0db,
161
- // 0xe: -2.5db,
162
- // 0xd: -6db,
163
- // 0x9: -8.5db,
164
- // 0xc: -11.5db,
165
- // 0x8: -14db,
166
- // 0x4: -17.5,
160
+ // 0xf: 0db,
161
+ // 0xe: -2.5db,
162
+ // 0xd: -6db,
163
+ // 0x9: -8.5db,
164
+ // 0xc: -11.5db,
165
+ // 0x8: -14db,
166
+ // 0x4: -17.5,
167
167
// 0x0: -23
168
168
[94 ] = 0x00 ,
169
169
170
170
171
171
// lp_bb_att_ext
172
172
// the attenuation of BB gain,
173
- // 0: 0db,
174
- // 1: -0.25db,
175
- // 2: -0.5db,
176
- // 3: -0.75db,
177
- // 4: -1db,
178
- // 5: -1.25db,
179
- // 6: -1.5db,
180
- // 7: -1.75db,
181
- // 8: -2db
173
+ // 0: 0db,
174
+ // 1: -0.25db,
175
+ // 2: -0.5db,
176
+ // 3: -0.75db,
177
+ // 4: -1db,
178
+ // 5: -1.25db,
179
+ // 6: -1.5db,
180
+ // 7: -1.75db,
181
+ // 8: -2db
182
182
// max valve is 24(-6db)
183
183
[95 ] = 0 ,
184
184
@@ -198,17 +198,17 @@ static uint8_t phy_init_data[128] =
198
198
// vdd33_const
199
199
// the voltage of PA_VDD
200
200
// x=0xff: it can measure VDD33,
201
- // 18<=x<=36: use input voltage,
201
+ // 18<=x<=36: use input voltage,
202
202
// the value is voltage*10, 33 is 3.3V, 30 is 3.0V,
203
203
// x<18 or x>36: default voltage is 3.3V
204
204
//
205
205
// the value of this byte depend from the TOUT pin usage (1 or 2):
206
- // 1)
206
+ // 1)
207
207
// analogRead function (system_adc_read()):
208
208
// is only available when wire TOUT pin17 to external circuitry, Input Voltage Range restricted to 0 ~ 1.0V.
209
209
// For this function the vdd33_const must be set as real power voltage of VDD3P3 pin 3 and 4
210
210
// The range of operating voltage of ESP8266 is 1.8V~3.6V,the unit of vdd33_const is 0.1V,so effective value range of vdd33_const is [18,36]
211
- // 2)
211
+ // 2)
212
212
// getVcc function (system_get_vdd33):
213
213
// is only available when TOUT pin17 is suspended (floating), this function measure the power voltage of VDD3P3 pin 3 and 4
214
214
// For this function the vdd33_const must be set to 255 (0xFF).
@@ -220,7 +220,7 @@ static uint8_t phy_init_data[128] =
220
220
// freq_correct_en
221
221
// bit[0]:0->do not correct frequency offset, 1->correct frequency offset.
222
222
// bit[1]:0->bbpll is 168M, it can correct + and - frequency offset, 1->bbpll is 160M, it only can correct + frequency offset
223
- // bit[2]:0->auto measure frequency offset and correct it, 1->use 113 byte force_freq_offset to correct frequency offset.
223
+ // bit[2]:0->auto measure frequency offset and correct it, 1->use 113 byte force_freq_offset to correct frequency offset.
224
224
// 0: do not correct frequency offset.
225
225
// 1: auto measure frequency offset and correct it, bbpll is 168M, it can correct + and - frequency offset.
226
226
// 3: auto measure frequency offset and correct it, bbpll is 160M, it only can correct + frequency offset.
@@ -239,17 +239,6 @@ extern int __wrap_register_chipv6_phy(uint8_t* unused) {
239
239
return __real_register_chipv6_phy (phy_init_data );
240
240
}
241
241
242
-
243
- void user_rf_pre_init () {
244
- // *((volatile uint32_t*) 0x60000710) = 0;
245
-
246
- volatile uint32_t * rtc_reg = (volatile uint32_t * ) 0x60001000 ;
247
- rtc_reg [30 ] = 0 ;
248
-
249
- system_set_os_print (0 );
250
- __run_user_rf_pre_init ();
251
- }
252
-
253
242
extern int __get_rf_mode (void ) __attribute__((weak ));
254
243
extern int __get_rf_mode (void )
255
244
{
@@ -268,5 +257,12 @@ extern void __run_user_rf_pre_init(void)
268
257
return ; // default do noting
269
258
}
270
259
260
+ void user_rf_pre_init () {
261
+ // *((volatile uint32_t*) 0x60000710) = 0;
271
262
263
+ volatile uint32_t * rtc_reg = (volatile uint32_t * ) 0x60001000 ;
264
+ rtc_reg [30 ] = 0 ;
272
265
266
+ system_set_os_print (0 );
267
+ __run_user_rf_pre_init ();
268
+ }
0 commit comments