Project

General

Profile

HardwareCP210xTutorial » History » Version 7

laforge, 02/19/2016 10:48 PM

1 1 steve-m
== CP210x High Baudrates Tutorial ==
2 6 steve-m
[[Image(cp2102.jpg, right, 33%)]]
3 1 steve-m
This page will describe the procedure of programming high, non-standard baudrate mappings to a !SiLabs CP210x serial converter using Linux, needed by the burst_ind branch.
4 7 laforge
5
Small adapter PCBs to which you have to solder your own cable + plug can be bought quite cheaply on eBay and !AliExpress. Ready-made adapter cables with the CP2102 can be bought from [http://shop.sysmocom.de/products/cp2102-25 shop.sysmocom.de]
6
7
8
So far this tutorial has only been tested with the CP2102, but this seems to be the most common chip anyway.
9 1 steve-m
10
=== How it works ===
11
12
Contrary to the FTDI converters, non-standard baudrates can't be directly requested when opening the port, but need to be stored in the EEPROM of the device, overwriting the default entries.
13
So it works like this: You open the port with a standard baudrate, the converter performs a look-up in the baudrate-table of its EEPROM and uses the non-standard mapping you programmed.
14
15
If you have a [wiki:PirelliDPL10 Pirelli DP-L10] you don't need to continue, the CP2102 in the phone has those mappings already preprogrammed.
16
17
=== Programming non-standard mappings ===
18
19
First of all you need to download and unpack the lastest version of [http://cp210x-program.sourceforge.net/ cp210x-program], an open-source tool replacing the proprietary windows-only tool from !SiLabs (see application note AN205 if you want to mess with that).
20
21
To make sure cp210x-program will be the only one talking to the converter, unload the kernel module:
22
23
{{{
24
sudo rmmod cp210x
25
}}}
26
27
After that, perform a dry-run to see everything is okay:
28
29
{{{
30
sudo ./cp210x-program
31
}}}
32
33
The tool should output the device-string of the converter, some other information, and a baudrate table with the following default entries:
34
{{{
35
[baudrate table]
36
[...]
37
 921600 = FFE6, FFF6, 1 #  923077 Baud, 20 us
38
[...]
39
 460800 = FFCC, FFEC, 1 #  461538 Baud, 40 us
40
[...]
41
 230400 = FF98, FFD9, 1 #  230769 Baud, 78 us
42
[...]
43
 115200 = FF30, FFB2, 1 #  115385 Baud, 156 us
44
[...]
45
}}}
46
47
Okay, now to the real thing: create a backup of the EEPROM:
48
49
{{{
50
sudo ./cp210x-program -f eeprom.hex
51
}}}
52
53
The next step is to program the modified, non-standard baudrates:
54
55
{{{
56
sudo ./cp210x-program -p -F eeprom.hex -w --set-baudrate 812500:FFE2,FFF4,1 --set-baudrate 406250:FFC5,FFE9,1 --set-baudrate 203125:FF8A,FFD3,1
57
}}}
58
59 3 steve-m
Check if the entries have been written successfully:
60 1 steve-m
61
{{{
62
sudo ./cp210x-program
63
}}}
64
65
You should see the following entries:
66
67
{{{
68
[baudrate table]
69
[...]
70
 812500 = FFE2, FFF4, 1 #  800000 Baud, 24 us
71
[...]
72
 406250 = FFC5, FFE9, 1 #  406780 Baud, 46 us
73
[...]
74
 203125 = FF8A, FFD3, 1 #  203390 Baud, 90 us
75
[...]
76
 115200 = FF30, FFB2, 1 #  115385 Baud, 156 us
77
[...]
78
}}}
79
80
Replug the converter and you're done.
81
82
=== Using burst_ind ===
83
84 4 steve-m
If you want to use the burst_ind branch with a CP210x converter, you need to add the following define in osmocon.c:
85
{{{
86
#define I_HAVE_A_CP210x
87
}}}
Add picture from clipboard (Maximum size: 48.8 MB)