HardwareCP210xTutorial » History » Version 10
laforge, 10/26/2020 06:02 PM
link to a more maintained version of cp210x-program than the old sourceforge.net
1 | 8 | laforge | |
---|---|---|---|
2 | h2. CP210x High Baudrates Tutorial |
||
3 | |||
4 | 9 | laforge | !{width:33%}cp2102.jpg! |
5 | 8 | laforge | 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. |
6 | 7 | laforge | |
7 | 8 | laforge | 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 "shop.sysmocom.de":http://shop.sysmocom.de/products/cp2102-25 |
8 | 7 | laforge | |
9 | 1 | steve-m | |
10 | So far this tutorial has only been tested with the CP2102, but this seems to be the most common chip anyway. |
||
11 | |||
12 | |||
13 | 8 | laforge | h3. How it works |
14 | |||
15 | |||
16 | 1 | steve-m | 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. |
17 | 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. |
||
18 | |||
19 | 8 | laforge | If you have a [[PirelliDPL10|Pirelli DP-L10]] you don't need to continue, the CP2102 in the phone has those mappings already preprogrammed. |
20 | 1 | steve-m | |
21 | |||
22 | 8 | laforge | h3. Programming non-standard mappings |
23 | 1 | steve-m | |
24 | 8 | laforge | |
25 | 10 | laforge | First of all you need to download and unpack the lastest version of "cp210x-program":https://github.com/VCTLabs/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). |
26 | 8 | laforge | |
27 | 1 | steve-m | To make sure cp210x-program will be the only one talking to the converter, unload the kernel module: |
28 | |||
29 | 8 | laforge | <pre> |
30 | 1 | steve-m | sudo rmmod cp210x |
31 | 8 | laforge | </pre> |
32 | 1 | steve-m | |
33 | After that, perform a dry-run to see everything is okay: |
||
34 | |||
35 | 8 | laforge | <pre> |
36 | 1 | steve-m | sudo ./cp210x-program |
37 | 8 | laforge | </pre> |
38 | 1 | steve-m | |
39 | The tool should output the device-string of the converter, some other information, and a baudrate table with the following default entries: |
||
40 | 8 | laforge | <pre> |
41 | 1 | steve-m | [baudrate table] |
42 | [...] |
||
43 | 921600 = FFE6, FFF6, 1 # 923077 Baud, 20 us |
||
44 | [...] |
||
45 | 460800 = FFCC, FFEC, 1 # 461538 Baud, 40 us |
||
46 | [...] |
||
47 | 230400 = FF98, FFD9, 1 # 230769 Baud, 78 us |
||
48 | [...] |
||
49 | 115200 = FF30, FFB2, 1 # 115385 Baud, 156 us |
||
50 | [...] |
||
51 | 8 | laforge | </pre> |
52 | 1 | steve-m | |
53 | Okay, now to the real thing: create a backup of the EEPROM: |
||
54 | |||
55 | 8 | laforge | <pre> |
56 | 1 | steve-m | sudo ./cp210x-program -f eeprom.hex |
57 | 8 | laforge | </pre> |
58 | 1 | steve-m | |
59 | The next step is to program the modified, non-standard baudrates: |
||
60 | |||
61 | 8 | laforge | <pre> |
62 | 1 | steve-m | 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 |
63 | 8 | laforge | </pre> |
64 | 1 | steve-m | |
65 | Check if the entries have been written successfully: |
||
66 | |||
67 | 8 | laforge | <pre> |
68 | 1 | steve-m | sudo ./cp210x-program |
69 | 8 | laforge | </pre> |
70 | 1 | steve-m | |
71 | You should see the following entries: |
||
72 | |||
73 | 8 | laforge | <pre> |
74 | 1 | steve-m | [baudrate table] |
75 | [...] |
||
76 | 812500 = FFE2, FFF4, 1 # 800000 Baud, 24 us |
||
77 | [...] |
||
78 | 406250 = FFC5, FFE9, 1 # 406780 Baud, 46 us |
||
79 | [...] |
||
80 | 203125 = FF8A, FFD3, 1 # 203390 Baud, 90 us |
||
81 | [...] |
||
82 | 115200 = FF30, FFB2, 1 # 115385 Baud, 156 us |
||
83 | [...] |
||
84 | 8 | laforge | </pre> |
85 | 1 | steve-m | |
86 | Replug the converter and you're done. |
||
87 | |||
88 | |||
89 | 8 | laforge | h3. Using burst_ind |
90 | |||
91 | |||
92 | 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: |
93 | 8 | laforge | <pre> |
94 | 4 | steve-m | #define I_HAVE_A_CP210x |
95 | 8 | laforge | </pre> |