comparison doc/High-speed-serial @ 962:f4da3071dd61

doc/High-speed-serial write-up and Linux kernel patch added
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Fri, 06 Nov 2015 21:46:05 +0000
parents
children
comparison
equal deleted inserted replaced
961:813287f7169c 962:f4da3071dd61
1 The highest baud rate supported by "standard" PC serial ports is 115200 bps,
2 but Calypso UARTs can go quite a bit faster. Being clocked with 13 MHz (a
3 standard frequency in the GSM world), these UARTs can produce non-standard
4 (outside of the GSM world) baud rates of 203125, 406250 and 812500 bps. When
5 working with Motorola C1xx and Openmoko GTA01/02 phones which present a debug
6 and programming serial interface on a 2.5 mm headset jack, one can make use of
7 these high serial baud rates by using a USB to headset jack programming cable
8 based on one of the better USB-serial chips that can support these GSM special
9 baud rates well above 115200. The two USB-serial chips that are known to work
10 in this manner are CP2102 and FTDI, although each of the two requires its own
11 special quirks described below. Other USB to serial cables use chips which
12 don't support the high baud rates in question, and therefore are limited to
13 115200 baud max like a "standard" PC serial port.
14
15 FreeCalypso tools can use these high serial baud rates in the following ways:
16
17 * When you use fc-loadtool to dump and program GSM device flash memory
18 (flashing firmware images), the transfers get annoyingly slow at 115200 baud
19 if you have to do it a lot. Switching to 406250 or even better 812500 baud
20 makes them go considerably faster.
21
22 * Some of our target devices have large enough RAM to execute a GSM firmware
23 image entirely from RAM without flashing - very handy for development and
24 experimentation. The tool used to run these RAM-based images is fc-xram,
25 and it also supports the option of using high serial baud rates for the image
26 transfer for the same reason: repeatedly transferring 1.5 MiB images over
27 115200 baud gets tiresome.
28
29 * If you are building your own GSM firmware (either FC GSM fw or one of our
30 TCS211-based hacks), you can make it run its RVTMUX interface at 406250 or
31 812500 baud. We used this trick when we tried to make TCS211 with D-Sample-
32 targeting UI (176x220 pix LCD, 16 bits per pixel) send its virtual LCD raster
33 blits out the serial port. Our rvtdump and rvinterf utilities support this
34 mode of operation by providing options to select different baud rates.
35
36 Using CP2102 adapters
37 =====================
38
39 CP2102 chips have a built-in EEPROM that contains (among other things) a
40 32-entry table in which the supported serial baud rates are programmed. In
41 order to support the special GSM baud rates, these rates need to be added to
42 that table, displacing some other entries. The convention established by the
43 Pirelli DP-L10 phone (has a CP2102 built in and programmed at the factory for
44 GSM baud rates) is that 203120 baud takes the place of 230400, 406250 takes the
45 place of 460800, and 812500 takes the place of 921600.
46
47 Because you need a special cable anyway to make the necessary physical
48 connection to the debug/programming serial port presented on a 2.5 mm headset
49 jack, you will probably be buying the requisite cable from a specialized
50 professional vendor. In that case it is that vendor's responsibility to sell
51 you the cable with the CP2102 chip already programmed with GSM baud rates:
52 because the physical construction of the cable (2.5 mm headset jack on the
53 serial end) makes it specific to GSM devices, and all known GSM devices use a
54 13 MHz clock or some integer multiple thereof, it is pointless for a
55 physically-GSM-specific cable to be set up for 230400/460800/921600 baud when
56 all known GSM devices will need 203125/406250/812500 baud instead.
57
58 If you making a CP2102-based serial cable yourself (either for your own personal
59 use or professionally/commercially), please follow these instructions for baud
60 rate programming:
61
62 http://bb.osmocom.org/trac/wiki/Hardware/CP210xTutorial
63
64 If you follow the procedure given on that page, your CP2102 will be programmed
65 the same way as the one in the Pirelli DP-L10 (Foxconn's original factory
66 programming).
67
68 The serial port handling code in FreeCalypso host tools is written to request
69 B230400 from termios when 203125 baud is desired, likewise B460800 for 406250
70 baud and B921600 for 812500 baud. Therefore, if you have a CP2102-based cable
71 with properly programmed EEPROM, everything will Just Work.
72
73 Using FTDI adapters
74 ===================
75
76 Unlike CP2102, FTDI adapters don't require any non-volatile EEPROM programming
77 for GSM baud rates, but they have a different pain point - arguably a worse one
78 - that is entirely a software issue. The API which the Linux kernel provides
79 to userspace applications for opening and configuring serial ports provides no
80 clean, sensible way for an application to request a particular baud rate that
81 is not in the predefined-once-and-for-all list, and to make it unambiguous to
82 the in-kernel driver exactly what it wants.
83
84 The method provided by the ftdi_sio driver in the standard Linux kernel is
85 gross, and I (Space Falcon) refuse to use it. The serial port handling code in
86 FreeCalypso host tools is written for the clean CP2102 way, and is *not* muddied
87 with the muck that would be necessary to get the high GSM baud rates with an
88 unpatched ftdi_sio driver. Therefore, if you would like to use one of the high
89 GSM baud rates with FreeCalypso with an FTDI adapter, you will need to dirty
90 your Linux host system with a hacky kernel patch. The patch provided in
91 linux-2.6.37.6-ftdi_sio.c.patch (made against Linux 2.6.37.6, which is what I
92 use - came with Slackware 13.37 - adapt as necessary for your kernel version)
93 makes the ftdi_sio driver behave like a GSM-programmed CP2102: termios B230400
94 turns into 203125 baud, B460800 turns into 406250 and B921600 turns into 812500.
95
96 This patch won't break other software (*cough* osmocom-bb *cough*) that does
97 use the "standard" ftdi_sio way of requesting high GSM baud rates, i.e., both
98 ways of selecting these baud rates should still work, but if you have other
99 (non-GSM) serial devices on the same system which need 230400, 460800 or 921600
100 baud, those will break.
101
102 Using adapters built into phones
103 ================================
104
105 The Calypso chip has no native USB capabilities, thus if a Calypso phone
106 presents a USB charging+data port to the user, it must have a USB to serial
107 converter built in. The only phone we currently know of that does this is
108 Pirelli DP-L10, and its built-in USB-serial adapter chip is CP2102. It has
109 already been programmed with the correct GSM baud rates on Foxconn's original
110 production line, thus one can always use 812500 baud with FreeCalypso tools on
111 this phone and it will Just Work.