2062 Radio initialisation
(checked against 5.10.56.46)
- Init registers from register initialisation table (below)
- Write 0 to radio registers 0x48, 0x49, 0x4A and 0x4B.
- Write 0x40 to radio register 0x10
- Write 0 to to radio register 0x10
- Write 0x10 to radio register 0x5d
- Write 0 to radio register 0x5d
If the PHY revision > 0
- Read Radio Register 0x02, right shift by 1, OR with 0x0080 and write the result to Radio Register 0x4015
- If the current band type is 2 (2.4 GHz)
- Bitwise OR radio register 0x57 with 1
- Otherwise
- Mask radio register 0x57 with mask 0xFE
If xtalfreq <= 30,000,000
Set pdiv to 1
- Mask radio register 0x4035 with mask 0xFFFB
- Otherwise
Set pdiv to 2
- Bitwise OR radio register 0x4035 with 4
Calculate ((800,000,000 * pdiv + xtalfreq) / (2 * xtalfreq)) - 8 and write the result to Radio Register 0x403B
Calculate ((100 * xtalfreq + 16,000,000 * pdiv) / (32,000,000 * pdiv)) - 1 and write to Radio Register 0x4046
Calculate ((2 * xtalfreq + 1,000,000 * pdiv) / (2,000,000 * pdiv)) - 1 and write to Radio Register 0x4047
Calculate a reference frequency as (1000 * pdiv + 2 * xtalfreq) / (2000 * pdiv)
- Mask the result with 0xFFFF
- Use the frequency data table to find the entry where the reference frequency is just less than the frequency entry in the table. Use that table row in the following steps.
- Left shift the data2 value by 4 and bitwise OR with the data1 value (Note: The original code masks data2 with 0xFF and data1 with 0x0F in the process, but I don't think that is necessary.)
- Write the result to radio register 0x403C
- Left shift the data4 value by 4 and bitwise OR with the data3 value (Note: Same here with data3 and data4.)
- Write the result to radio register 0x403D
- Write the data5 entry to Radio Register 0x403E
frequency data table
frequency |
data1 |
data2 |
data3 |
data4 |
data5 |
data6 |
12000 |
6 |
6 |
6 |
6 |
10 |
6 |
13000 |
4 |
4 |
4 |
4 |
11 |
7 |
14400 |
3 |
3 |
3 |
3 |
12 |
7 |
16200 |
3 |
3 |
3 |
3 |
13 |
8 |
18000 |
2 |
2 |
2 |
2 |
14 |
8 |
19200 |
1 |
1 |
1 |
1 |
14 |
9 |
register initialisation table
address |
init A |
init G |
do init A |
do init G |
0x00 |
0 |
0 |
0 |
0 |
0x01 |
0 |
0 |
0 |
0 |
0x02 |
0 |
0 |
0 |
0 |
0x03 |
0 |
0 |
0 |
0 |
0x04 |
0x1 |
0 |
1 |
1 |
0x05 |
0 |
0 |
0 |
0 |
0x06 |
0 |
0 |
0 |
0 |
0x07 |
0 |
0 |
0 |
0 |
0x08 |
0 |
0 |
0 |
0 |
0x09 |
0 |
0 |
0 |
0 |
0x0A |
0 |
0 |
0 |
0 |
0x0B |
0 |
0 |
0 |
0 |
0x0C |
0 |
0 |
0 |
0 |
0x0D |
0 |
0 |
0 |
0 |
0x0E |
0 |
0 |
0 |
0 |
0x0F |
0 |
0 |
0 |
0 |
0x10 |
0 |
0 |
0 |
0 |
0x11 |
0 |
0xca |
0 |
1 |
0x12 |
0x18 |
0x18 |
0 |
0 |
0x13 |
0 |
0 |
1 |
1 |
0x14 |
0x15 |
0x2a |
1 |
1 |
0x15 |
0 |
0 |
0 |
0 |
0x16 |
0x1 |
0x1 |
0 |
0 |
0x17 |
0xdb |
0xff |
1 |
0 |
0x18 |
0x1 |
0x1 |
0 |
0 |
0x19 |
0x41 |
0x41 |
0 |
0 |
0x1A |
0x2 |
0x2 |
0 |
0 |
0x1B |
0x32 |
0x32 |
0 |
0 |
0x1C |
0 |
0 |
0 |
0 |
0x1D |
0 |
0 |
0 |
0 |
0x1E |
0xdd |
0 |
1 |
1 |
0x1F |
0 |
0 |
0 |
0 |
0x20 |
0xdd |
0 |
1 |
1 |
0x21 |
0x77 |
0xb5 |
1 |
1 |
0x22 |
0 |
0xff |
1 |
1 |
0x23 |
0x1f |
0x1f |
0 |
0 |
0x24 |
0x32 |
0x32 |
0 |
0 |
0x25 |
0x32 |
0x32 |
0 |
0 |
0x26 |
0x33 |
0x33 |
1 |
1 |
0x27 |
0x9 |
0x9 |
0 |
0 |
0x28 |
0 |
0 |
0 |
1 |
0x29 |
0x18 |
0x18 |
0 |
0 |
0x2A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x6 |
0 |
0 |
0x4015 |
0 |
0 |
0 |
0 |
0x4016 |
0x11 |
0x11 |
0 |
0 |
0x4017 |
0xf8 |
0xd8 |
1 |
1 |
0x4018 |
0x3c |
0x24 |
1 |
1 |
0x4019 |
0 |
0 |
0 |
0 |
0x401A |
0x41 |
0x41 |
0 |
0 |
0x401B |
0x2 |
0x2 |
0 |
0 |
0x401C |
0x33 |
0x33 |
0 |
0 |
0x401D |
0x22 |
0x22 |
0 |
0 |
0x401E |
0 |
0 |
0 |
0 |
0x401F |
0x88 |
0x80 |
1 |
1 |
0x4020 |
0x88 |
0x88 |
0 |
0 |
0x4021 |
0x88 |
0x80 |
1 |
1 |
0x4022 |
0 |
0 |
0 |
0 |
0x4023 |
0 |
0 |
0 |
0 |
0x4024 |
0x7 |
0x7 |
0 |
0 |
0x4025 |
0xaf |
0xaf |
0 |
0 |
0x4026 |
0x12 |
0x12 |
0 |
0 |
0x4027 |
0xb |
0xb |
0 |
0 |
0x4028 |
0x5f |
0x5f |
0 |
0 |
0x4029 |
0 |
0 |
0 |
0 |
0x402A |
0x40 |
0x40 |
0 |
0 |
0x402B |
0x52 |
0x52 |
0 |
0 |
0x402C |
0x26 |
0x26 |
0 |
0 |
0x402D |
0x3 |
0x3 |
0 |
0 |
0x402E |
0x36 |
0x36 |
0 |
0 |
0x402F |
0x57 |
0x57 |
0 |
0 |
0x4030 |
0x11 |
0x11 |
0 |
0 |
0x4031 |
0x75 |
0x75 |
0 |
0 |
0x4032 |
0xb4 |
0xb4 |
0 |
0 |
0x4033 |
0 |
0 |
0 |
0 |
0x4034 |
0x98 |
0x98 |
1 |
1 |
0x4035 |
0x10 |
0x10 |
1 |
1 |
0x4036 |
0 |
0 |
0 |
0 |
0x4037 |
0 |
0 |
0 |
0 |
0x4038 |
0 |
0 |
0 |
0 |
0x4039 |
0x43 |
0x43 |
1 |
1 |
0x403A |
0x47 |
0x47 |
1 |
1 |
0x403B |
0xc |
0xc |
1 |
1 |
0x403C |
0x11 |
0x11 |
1 |
1 |
0x403D |
0x11 |
0x11 |
1 |
1 |
0x403E |
0xe |
0xe |
1 |
1 |
0x403F |
0x8 |
0x8 |
1 |
1 |
0x4040 |
0x33 |
0x33 |
1 |
1 |
0x4041 |
0xa |
0xa |
1 |
1 |
0x4042 |
0x6 |
0x6 |
1 |
1 |
0x4043 |
0 |
0 |
0 |
0 |
0x4044 |
0 |
0 |
0 |
0 |
0x4045 |
0 |
0 |
0 |
0 |
0x4046 |
0x3e |
0x3e |
1 |
1 |
0x4047 |
0x13 |
0x13 |
1 |
1 |
0x4048 |
0 |
0 |
0 |
0 |
0x4049 |
0x62 |
0x62 |
1 |
1 |
0x404A |
0x7 |
0x7 |
1 |
1 |
0x404B |
0x16 |
0x16 |
1 |
1 |
0x404C |
0x5c |
0x5c |
1 |
1 |
0x404D |
0x95 |
0x95 |
1 |
1 |
0x404E |
0 |
0 |
0 |
0 |
0x404F |
0 |
0 |
0 |
0 |
0x4050 |
0 |
0 |
0 |
0 |
0x4051 |
0 |
0 |
0 |
0 |
0x4052 |
0xa0 |
0xa0 |
1 |
1 |
0x4053 |
0x4 |
0x4 |
1 |
1 |
0x4054 |
0 |
0 |
0 |
0 |
0x4055 |
0xcc |
0xcc |
1 |
1 |
0x4056 |
0x7 |
0x7 |
1 |
1 |
0x4057 |
0x10 |
0x10 |
0 |
0 |
0x4058 |
0 |
0 |
0 |
0 |
0x4059 |
0 |
0 |
0 |
0 |
0x405A |
0 |
0 |
0 |
0 |
0x405B |
0 |
0 |
0 |
0 |
0x405C |
0x55 |
0x55 |
0 |
0 |
0x405D |
0x55 |
0x55 |
0 |
0 |
0x405E |
0x5 |
0x5 |
0 |
0 |
0x405F |
0xf |
0xf |
1 |
0 |
0x4060 |
0 |
0 |
0 |
0 |
0x4061 |
0x55 |
0x55 |
0 |
0 |
0x4062 |
0x66 |
0x66 |
0 |
0 |
0x4063 |
0x55 |
0x55 |
0 |
0 |
0x4064 |
0x44 |
0x44 |
0 |
0 |
0x4065 |
0xa0 |
0xa0 |
0 |
0 |
0x4066 |
0x4 |
0x4 |
0 |
0 |
0x4067 |
0 |
0 |
0 |
0 |
0x4068 |
0x55 |
0x55 |
0 |
0 |