cp2102 connection. Installing the CP210x USB to UART Bridge VCP driver. Alternative options for USB-UART adapters

cp2102 connection.  Installing the CP210x USB to UART Bridge VCP driver.  Alternative options for USB-UART adapters
cp2102 connection. Installing the CP210x USB to UART Bridge VCP driver. Alternative options for USB-UART adapters

The UART interface is supported by almost all microcontrollers and is very convenient when developing and debugging all kinds of MK devices: upload the firmware through the bootloader and view the debug logs of the device on the computer. But, alas, in modern computers, the COM port is gradually disappearing from the number of available interfaces, having been supplanted by the USB bus, and even more so in laptops. This made me puzzled by the issue of manufacturing a USB -> COM adapter. Usually, such adapters are made on the basis of the popular FT232 series microcircuit, but it has a couple of drawbacks: 1) the cost of the microcircuit is ~ 150 rubles 2) microscopic dimensions with all the ensuing difficulties of soldering and manufacturing a printed circuit board.

As an alternative to the FT232, a lesser-known CP2102 was discovered, which costs two times cheaper, and has two times smaller dimensions, and even the QFN-28 case (5mm x 5mm). This microcircuit is a completely finished USB-UART converter that does not require any external wiring (a pair of filter capacitors on the power bus does not count) and has the following features:

  • USB 2.0 specification compliant, full-speed (12 Mbps)
  • integrated 1024 byte EEPROM for storing manufacturer ID, product ID, serial number, device description, etc.
  • virtual RS232 speed from 300 bps to 1 Mbits
  • support for data transfer formats of 5, 6, 7 and 8 bytes of data; 1, 1.5 and 2 stop bits, various parity
  • receiver buffer - 576 bytes, transmitter buffer - 640 bytes
  • built-in reference frequency sources, built-in 3.3V regulator
  • Drivers for Windows Vista/XP/Server 2003/2000, Linux, Mac OS-X / OS-9

Scheme

The adapter diagram is taken from the datasheet, the optional peripherals were thrown away and an LED was added to indicate the presence of power.

The DB9 plug is wired similarly to the output of the computer's COM port, here is its wiring (the direction of the signals is indicated relative to the computer).

The main problem of designing the adapter - the problem of the printed circuit board and mounting the QFN-28 was solved by gluing the microcircuit upside down to the printed circuit board and soldering its leads with a 0.1mm PEV wire. Somewhat dreary, but miniature. Here is the result:


And in the case from DB-9, everything looks like this:

Drivers

Now, having carefully checked the installation, you can test it. The device was detected by the system but windows drivers could not be found. I downloaded them. After that, a new port appeared in my system - COM5 on Windows and /dev/ttyUSB0 on ​​Linux. Now, by connecting RXD to TXD (pins 2 and 3 of the adapter plug) and running any COM terminal, you can make sure that bytes are sent .. and received .. moreover, the latter coincide with the first ..

One important point: the signal levels at the output of the adapter are TTL and differ from the signal levels of the standard RS232 interface, therefore, ordinary devices for the COM port cannot be directly connected to the adapter, moreover, this can damage the adapter. To connect standard COM devices, you need to add a level converter on the MAX232 family chip.

Below you can download a project in Eagle, as well as a finished drawing of a printed circuit board for a laser iron (for ironing a double-sided printed circuit board, I recommend printing a drawing on tracing paper).

This material is published for the first time, kindly provided for publication on our website by the company IC Book Labs and is the exclusive property of this company. Reproduction without the written permission of the copyright holder is prohibited.


As you know, for diagnostics and reprogramming of automotive systems, in particular the ECM, the diagnostic line K-Line 12 V (ISO 9141) is used, which is electrically compatible with the RS232 serial interfaceused in personal computers. But, when pairing a car and a computer, a problem arises due to the fact that the exchange with car systems is performed at 200 and 10400 baud rates, which are not typical for computers. This article discusses a simple solution to this problem for USB-to-COM adapters using software supplied by the developers.


Baud rate control

The baud rate for the serial interface depends on the set divider. The divisor value is determined by the contents of the Baud Rate Divisor register. An analysis of the controller architecture and simple calculations show that there are no obstacles to using the speeds of interest to us at 200 and 10400 baud. So what's the problem?


When writing operating systems, drivers and various application programs for servicing the serial interface, in order to simplify, a standard range of speeds, which has become traditional for personal computers, was used: 300, 600, 1200, ..., 115200 baud. The 200 and 10400 baud rates used by the vehicle's diagnostic line are not included in this range.

Our task is to provide support for baud rates that FT232 and CP2102 controllers support, but do not support “classic” software. The idea is to override the speeds from the standard range with new values, for example, replace 14400 baud with 10400 baud. After such an override, a request to enable 14400 baud mode will result in 10400 baud mode being enabled. The point is that we are adding new speed while keeping the interface compatible with existing software. In principle, any speed from a given range can be used for substitution.

Redefining speeds for the CP2102 controller

Consider real described above ideas for controller compatibility USB-to-COM CP2102 with the controller of the electronic engine management system (ECM) of the car. As mentioned above, for the K-Line 12 V diagnostic line, speeds of 200 and 10400 baud are typical.

Fortunately, the manufacturer of the CP2102 controller provided for the possibility of flexible control of operating modes and provided its device with a utility for reassigning exchange rates, so today we do not need a disassembler and a debugger, our actions will be very simple and will come down to using a standard utility supplied by Silicon Labs.

Also note that the result of our actions will be to change the contents of the table that stores the values ​​of the frequency dividers for the supported speeds. This table is located in the internal non-volatile memory of the CP2102 chip, so the changes will be saved when the power is turned off or the reprogrammed device is transferred to another computer. For most applications, this option is more convenient than, for example, making changes to the driver. To ensure compatibility with the vehicle diagnostic line and the software used to monitor the status of the ECM, we need to make the following overrides: 14400 to 10400 and 300 to 200 baud.

So let's run the utility. CP210 xBaudRateAliasConfig.exe. The CP210 x Baud Rate Configuration window appears. If several CP2102 devices are connected, in the top line Connected Devices you need to select the device that we will reprogram. If devices were connected after the utility was launched, use the Refresh button to update the list of enabled adapters.

We press the Get Configuration button and get a list of supported exchange rates for the selected device.

If one USB-to-COM adapter is used, the list is generated automatically, if there are several, then after selecting the device, be sure to click the Get Configuration button, otherwise the table will be displayed corresponding not to the current, but to the previously selected adapter!

The left column under the symbol # means the conditional number of the speed limit. The High and Low columns in the Application Requested Baud Rate Range column contain the upper and lower limits of the rate range associated with this mode. If the parameter requested by the software falls within this range, it is used in the current mode. To support the speed requested by the software, the mode within which the speed falls is used. The Desired and Actual columns in the UART Baud Rate column show the baud rate programmed for this mode. Desired - ideal value (usually from the standard range of speeds). Actual - the actual value, which, due to the peculiarities of the controller's clocking schemes, is not always equal to the ideal one.

Double-click on the line corresponding to the mode being edited. Enter the required exchange rate value - Desired Baud Rate. This automatically updates the Actual Baud Rate. From the point of view of the serial interface standard, a deviation of ±3% is acceptable. The speed setting accuracy for the CP2102 controller satisfies this requirement. Edit line 19 . The initial value of the exchange rate is 14400 baud.


We enter a new value - 10400 baud, click OK and the override is set!


Edit line 28 . The initial value of the exchange rate is 300 baud.


We enter a new value - 200 baud, click OK and the override is set.

After all the changes have been made, do not forget to click the Set Configuration button in the CP210 x Baud Rate Configuration window and check that the Desired and Actual values ​​in the edited lines have changed.

Using the serial port diagnostic utilities, you can check the results of the actions performed by setting the baud rates corresponding to the overridden ones and comparing the set and measured speeds.

In addition, we note that the Advanced button allows you to fine-tune the parameters. To override, you must select the Override Recommended checkbox.

The Prescaler (division factor for the prescaler) and Reload (value to load into the main scaler counter) determine the Baud Rate in baud according to the following formula:

Baud Rate = ( 24.000.000 /Prescaler) / (65536 -Reload)

Note that the CP2102 controller supports speeds up to 1.000.000 baud in 7 and 8 bit data mode and 921.600 baud in 5 and 6 bit data mode for full duplex communication. If you set a speed that exceeds the specified limits, the controller may malfunction.

The timeout for data exchange via USB is controlled by editing the USB Receive Timeout parameter. The timeout value in seconds is determined by the formula:

timeout=( 65536 – Reload) / 500.000

The specified timeout is used when transferring data via USB to a computer received via a serial interface. It defines the amount of time the controller waits for input. If no data is received within the set period, the controller ends the USB transfer. The typical timeout value is 1 ms. Timeout management allows you to set a compromise when two mutually contradictory criteria are reached:

one . Minimizing the delay in servicing a USB device by a computer, which in this case increases the speed of the diagnostic program's response to events in the object being diagnosed.

2. Minimization of computer load by the operations of transferring empty data packets over USB, which take place when there is no data coming through the serial interface. This affects the overall performance.
The longer the timeout, the longer the device “does not fall asleep” in the absence of data, that is, to improve the first criterion, the timeout should be increased, and for the second - reduced.

Speed ​​redefinition for FT232 controller

Consider the solution of a similar problem for one of the competing products - controller FT232 FTDI company. Unlike the above example, here we will have to edit the configuration file of the serial port driver FTDIPORT.INF. The structure of this file is described in , the procedure for editing the fields that set the baud rate for the serial port is described in . Therefore, for the sake of compactness of presentation, in our description, attention is focused only on those parameters that need to be changed. Also note that this example corresponds to one of several options for representing parameters, all possible options are listed in , .

We find the following entry in the FTDIPORT.INF file:


HKR „“ConfigData”, 1 .01 .00 .3 F,3 F,10 .27 .88 .13 ,C4 .09 ,E2 .04 .71 .02 .38 .41 .9 c,80 .4 E,C0 .34 .00 , 1 A.00 .0 D.00 .06 .40 .03 .80 .00 .00 .d0 .80

The sequence, starting from the sixth parameter, contains pairs of bytes, each of which sets the frequency division factor for the divider that determines the exchange rate over the serial interface. Each pair corresponds to a certain speed. Consider the first pair of parameters 10 h, 27 h.

one . Since two adjacent bytes of a 16-bit word are written starting from the low byte, to get a 16-bit number, they need to be swapped: 10 , 27 corresponds 2710 h, h - means that the number is written in hexadecimal number system.

2. We translate the 16-ary number 2710 h into the binary system.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0
2 7 1 0

3 . We interpret the received binary value. The two most significant bits of a 16-bit number, namely bits 15, 14, define the fractional part of the frequency division factor according to the following table:

Bit 15 Bit 14 Fractional part of divisor
0 0 0
0 1 0 .5
1 0 0 .25
1 1 0 .125

In our case, the fractional part of the divisor is zero. The bit field 13 –0 of a 16-bit number is numerically equal to the integer part of the divisor, let's convert from hexadecimal to decimal 2710 h = 10 .000 .

4 . The clock frequency at the input of the divider is 3 MHz = 3.000.000 Hz. The Baud Rate will be equal to the divider input frequency divided by the division factor.

Baud Rate = 3.000.000 / 10.000 = 300 baud.

Thus, the first pair of values ​​specifies a baud rate of 300. Suppose we need to redefine this speed to 10400 baud. Calculate the required division factor (Divisor):

divisor= 3 .000 .000 / 10 .400 = 288 ,46

The closest available value is 288.5 . We need to set the integer part of the divisor to be 288 , fractional equal 0 ,5 . According to table 2, bits 15,14 will be equal to 01 b, b - means that the number is written in the binary number system. Let's translate 288 into hexadecimal system: 288 =120 h. This value must be placed in bit field 13 -0 . We combine bits 15 -14 and 13 -0 , we get 4120 h.

To redefine the 300 baud rate to 10400 baud, the entry should look like:


HKR „“ConfigData”, 1 .01 .00 .3 F,3 F,20 .41 .88 .13 ,C4 .09 ,E2 .04 .71 .02 .38 .41 .9 c,80 .4 E,C0 .34 .00 , 1 A.00 .0 D.00 .06 .40 .03 .80 .00 .00 .d0 .80

Recall that if the FT232 device driver is already installed, for the changes to take effect, the device software must be completely uninstalled and reinstalled from the directory where the edited INF file is located. Due to the nature of the operating system, the function to update the driver or uninstall the device in Device Manager may not work.

Information sources.

The USB to UART Bridge RS232 Port Adapter is a high-speed USB device designed to connect peripherals that comply with the TIA/EIA232 standard.

The adapter is based on the Silicon Labs CP2102 controller and is intended for use in systems equipped with a USB bus. Peripheral devices are connected using a standard DB9 connector.

  • support for USB 2.0 specification;
  • full set of RS232 interface signals;
  • RS232 signal amplitude not worse than ±5.5V;
  • USB bus powered.

Installing and connecting the adapter

  1. Before installing and connecting the CP2102 adapter, make sure that external devices are de-energized and connected to the ground loop.
  2. Then, connect the external device to the DB9 connector.
  3. Install the adapter into a free USB connector, visually checking the fit of the contact pads until it stops in the connector.
  4. supply voltage to the input-output device, the system is ready for operation.

Before installing the CP2102 adapter, be aware that the USB specification is hot-pluggable, but does not apply to serial I/O peripherals. When working with the adapter, only de-energized peripheral equipment must be connected! Failure to comply with these rules may lead to the exit of the components of the computer system!

Installing the driver based on Windows operating systems

After connecting the CP2102 adapter to the USB connector in the environment of Windows 2K/XP operating systems, it is detected as follows:

Now you need to download the CP210x USB to UART driver. Let's start installing it:

During the pre-installer, the user can specify the directory in which the device drivers will be stored CP210x:


If the operating system requests information about the location of device drivers, the user will be required to specify the path to them. The software model of the CP2102 adapter consists of a composite device and a USB to UART bridge, each of which is described by its own inf-file.

Therefore, during the automatic discovery process, the operating system requests both files in sequence.

Adapter drivers must be offered to the system for installation from the directory specified during the pre-installation process, unless otherwise specified by the user himself. Initially, the operating system installs drivers for the composite device (USB Composite Device):

If the current version of the USB Composite Device drivers is not verified by a digital certificate from Microsoft, the user is warned about this by the following message:

The path to the files necessary for the composite device is selected based on the pre-installation conditions:

The next installation step is the USB to UART bridge drivers. As in the previous step, automatic installation is recommended.

If the current version of the USB to UART Bridge Controller drivers is not confirmed by a digital certificate from Microsoft, the user is warned about this by a message. The path to the necessary files is selected based on the pre-installation conditions:

After installation, the CP210x USB Composite Device universal serial bus controller and the COM3 serial port implemented using the CP210x USB to UART Bridge Controller appear in the system properties, and the list of devices takes on the following form:

Everything, the driver is installed!

LPT and COM ports are already a rarity on modern desktop computers, and there is nothing to say about laptops. USB slowly but surely replaced them, making life harder for developers and easier for users. Oh, how nice it was once to connect the microcontroller to the computer's COM port, using just max232 and not worrying about drivers. A little more and it will be possible only on industrial computers.

Following the general trend, chip manufacturers began to produce affordable chips for working with USB. Such as USB-UART converters or microcontrollers with support for this bus. Unfortunately, the latter, despite the presence of libraries, are still difficult to learn, so it is easier for an inexperienced engineer to use the first option. And in this article we will consider two similar microcircuits - FT232 and CP2103 and converter circuits based on them.

USB-UART converter on FT232RL

The FT232RL chip from FTDI is well-deservedly popular in engineering circles. It provides the user with the ability to create a full-fledged COM port, has the function of controlling individual outputs, drivers, a simple switching circuit with a minimum number of additional elements, and an enclosure acceptable for soldering. Also, an additional advantage of this chip is the ability to program its EEPROM memory, in which you can change some parameters of USB devices. Among the shortcomings, one can note its high price ~ 120-150 rubles, which is quite comparable with the price of an atmega microcontroller.
I made my version of the USB-UART converter on the FT232RL. All user conclusions are spread on PLS`ku along the edges of the board. The distance between the PLS was chosen so that the adapter could be plugged into the breadboard. The RXD and TXD pins, intended for connecting the UART of the microcontroller, are separated into a separate PLS for ease of connection. I also put 2 LEDs on the board to indicate the process of transmitting / receiving information by the FT232RL microcircuit, and jumpers for selecting the supply voltage of the outputs. It can be five or three volts. I took the USB connector in a mini version, USB-B is too bulky. The board was spread in one layer, with three jumpers.

Scheme of USB-UART adapter on FT232RL


The appearance of the received device

If you assemble this USB-UART adapter, then do not rush to immediately plug it into the USB port. Before work, you need to make sure that there are no short circuits between the power plus, ground and terminals D +, D-. Get a tester and call them. If there are no short circuits, visually check other outputs and only after that you can connect the adapter.

The first time you turn it on, it will ask you to install drivers. They can be downloaded from the official website of the manufacturer - driver for FT232. Installing drivers is not difficult, so we will not talk about it.
When the driver is installed, an additional COM port will appear in the system. This is the so-called virtual COM port, but it can be used in the same way as a normal one. To see its serial number, you need to get into the device manager if you have Windows. Go to the control panel, select system > device manager. In the "Ports (COM and LPT)" section, our adapter should be located - "USB Serial Port (COM10)". You may have some other port number.
To make sure that the adapter works, you need to open any terminal program, select the appropriate COM port, close the RXD and TXD pins with a jumper and send any sequence of characters through the terminal. If the adapter is functioning, the terminal will receive an echo response, and the LEDs on the board will briefly flash.
To connect the adapter to the microcontroller, you need to connect the RXD pin of the microcontroller to the TXD pin of the adapter, and the TXD pin of the microcontroller to the RXD pin of the adapter. You also need to connect their lands.

USB UART adapter to CP2103

The CP2103 chip from Silicon Labs is essentially an analogue of the FT232. It has a simple switching circuit with a minimum number of external components, allows you to organize a full-fledged COM port with all its signals, has additional user outputs and a program for their configuration, drivers, small dimensions and a more affordable price. Of the shortcomings, it is worth noting the small and inconvenient case for sealing at home. Perhaps this is the main reason for the unpopularity of this microcircuit among DIYers.
For the sake of interest, I made a USB UART converter based on it. All user conclusions are spread on PLS`ki along the edges of the board. RXD and TXD brought to a separate connector. The jumper for selecting the supply voltage of the outputs was not needed here, since this voltage cannot be greater than 3.6 V. I chose the USB connector in a mini version, I spread the board in one layer with four jumpers on the reverse side. I did not make LEDs for indicating the transmission / reception of data, because the CP2103 chip does not have pins dedicated for this purpose. You can use any custom outputs, but they need to be configured using special software. When I found out, the adapter was already ready and it was too lazy to redo it, especially after the torment with the seal. The only thing I added from the indication is the power LED.


USB-UART Converter Diagram on CP2103


The appearance of the received device

I struggled a little with the manufacture of this adapter. Firstly, there is a very small gap between the legs of the CP2103, you need to carefully make the board. Secondly, it is difficult to solder. If I didn't have a hair dryer, I wouldn't do it at all.
I soldered it in the following way. I tinned the board with Rosé alloy. It melts at 100 degrees, which avoids overheating of the board and microcircuit. Abundantly moistened the seat of the microcircuit with flux and put it there. Using a magnifying glass and tweezers, I somehow oriented it to the seat. Then he began to heat the microcircuit with a hair dryer with a temperature of ~ 150-200 degrees. When the solder melted, the microcircuit began to move and, due to the forces of surface tension, took the exact position on the seat. It turned out very smoothly, but the adapter did not work. I reheated the microcircuit and slightly pressed down and wiggled the tweezers. After that, the microcircuit made contact with the tracks of the board.
After assembling the adapter, you need to make sure that there are no short circuits between the power plus, ground and the D +, D- terminals, and then between the remaining terminals. Since the microcircuit is very small, snot can easily sit between the pins. After checking the pins, the USB UART adapter can be connected to the computer.
As with the previous adapter, the first time you turn it on, the system will prompt you to install drivers. Download them from the manufacturer's official website - driver for CP2103.
The installed adapter is defined in the device manager in the "Ports" section as "Silicon Labs CP210X USB to UART Bridge (COM6)". You may have a different port number.
Performance is checked in the same way, I will not repeat.

Alternative options for USB-UART adapters

Alternative adapters can be made on FT230XS and CP2102 chips. These are stripped down and, accordingly, cheaper analogues of the FT232 and CP2103. Both microcircuits have a smaller number of user outputs and do not match the pinout.

Files

Links

Software for setting up FT232RL - FT Prog
Software for customization CP2103 - Customization Utility It weighs a lot!

$6.3 (now 1.43)

I bought an Arduino Pro Mini complete with a USB-UART adapter on a CP2102 chip 1.5 years ago (their prices have dropped significantly since then) and they have been lying on my shelf all this time. All hands did not reach to do anything on this controller. Not the last role in this was played by the fact that flashing a sketch in the Arduino Pro Mini, although not difficult, is a little more difficult than in the Arduino UNO, Mega or Nano.

And so I decided to use this controller in one of my projects, it still lies idle.

Arduino Pro Mini DETAILS

ATmega168 or 328

operating voltage

3.35 -12V (3.3V model) or 5 - 12V (5V model)

Digital I/O Pins

14 (of which 6 provide PWM output)

Analog Input Pins

DC Current per I/O Pin

16 KB (of which 2 KB used by bootloader)

8 MHz (3.3V model) or 16 MHz (5V model)

I ended up with a 16MHz 5V model based on an ATmega 328 chip. As it turned out when analyzing data from the Internet, there are controller boards that do not have a DTR signal. In my case, everything is wired correctly. Included was a USB-UART converter.

The platform contains 14 digital inputs and outputs (6 of which can be used as PWM outputs), 6 analog inputs, a resonator, a reset button, and holes for mounting pins. A block of six pins can be connected to a USB-UART converter board.

The Arduino Pro Mini is very close to the Arduino Nano in terms of its technical characteristics and parameters. They are the same size in width, but the length of the Arduino Pro Mini is about 1 cm shorter.

10 mm is a lot. But only if you solder pins for connecting USB-UART to the board, all the advantages of this board over Nano disappear. The Arduino Pro Mini is currently $0.25 cheaper than the Arduino Nano. This is immaterial. There are no more advantages and advantages, only disadvantages.

And the main disadvantage is the more difficult loading of sketches.

There are several ways to flash a sketch.

One way is to use an Arduino UNO as a USB-UART. There are many instructions on the Internet on how to do this, so I will not dwell on it.

The second way is to use the USB-UART adapter itself. I have it, and the “correct” one, so I decided to use it. How does the adapter work? Arduino communicates with the converter chip via a regular UART, while it connects to the computer via USB. The computer recognizes the connected adapter as a COM port.

Uploading a sketch to the Arduino Pro Mini is, as it turned out, not at all difficult. You just need to connect the wires from the set of 5 pins on the adapter and Arduino:

(Converter)<->(Arduino)

DTR<->GRN
TXD<->RXI
RXD<->TXO
GND<->GND
5V<->VCC

On my Arduino Pro Mini, the DRT signal is labeled as GRN. Guessing what is what was not easy, especially since on one of the sites a “kind” adviser wrote that GRN needs to be connected to GND. Well, the Internet is a big garbage dump, and this is not the first time I am convinced that the most willing to give advice on the forums is not at all those who really understand the subject under discussion. So, GRN is DTR.

For those who don't know what DTR is:
Data Terminal Ready (DTR) - control signal in serial data transfer protocol transmitted from the terminal equipment (DTE) to the receiving equipmentto indicate that the terminal is ready to communicate.

In the Arduino, the DTR signal triggers the Reset signal the moment the sketch begins to be transmitted.

It is possible instead of connecting DTR<->GRN connect the DTR adapter through a 0.1uF capacitor to the Reset Arduino Pro Mini. This also works, tested. It's through the capacitor. Despite the fact that on the forums and many sites it is written that you need to connect DTR and RESET directly, with a direct connection, the sketch transfer does not occur. At least nothing worked for me with a direct connection.

Theoretically, as they say on the Internet, you can record a sketch without DTR by pressing exactly at the moment you start recording the reset on the controller board. I tried several times to catch this moment - I did not succeed. I didn’t train my skills in trying to hit the reset at the right time, it’s easier to entrust the Reset signal to the CP2102 converter chip.

But not all CP2102s are equally useful. There are a lot of cheap fakes sold on eBay and AliExpress that people suffer from and often have to modify so that they can write a sketch in the Arduino Pro Mini. In these adapters, the DTR signal from pin 28 of the CP2102 chip is not wired. In some, the Rx and Tx markings are confused. Therefore, there are so many instructions on the forums on the net that contradict each other and sometimes simply mislead readers. I spent about two hours reading these nonsense (I didn’t want to reinvent the wheel, I thought I would save time) and trying to write the sketch into the controller according to these instructions. As a result, all the instructions turned out to be inoperative for my CP2102 adapter. It turned out to be “correct” for me, in which the correct marking is applied and all signals are correctly separated.

It was enough just to connect all the wires and everything worked.

So if you ever need to write a sketch to the Arduino Pro Mini via USB-UART, the first thing to do is to check if the DTR signal is routed on the Arduino Pro Mini board. I read that there are boards on which it is not divorced. In this case, you can use the option of connecting the DTR signal from the USB-UART adapter board to the RESET pin of the Arduino Pro Mini through a 0.1-0.15uF capacitor.

Secondly, check if the USB-UART adapter board has a DTR signal connected to any pin. The pin can be, and even be signed as DTR, but not be connected to pin 28 of the CP2102 chip. If the 28th output of this microcircuit is not connected anywhere, you need to ensure its connection to the DTR pin. If the 28th output is connected somewhere in the circuit, this track must be cut and brought directly to the DTR pin.

The correctness of Rx and Tx marking on a fake CP2102 board can be determined empirically, there are only 2 options.

I also read instructions on the Internet that you need to write a sketch through the USB-UART adapter CP2102 in the “Download via programmer” mode, supposedly this is the only way everything works. I don’t know if the author of this opus is intentionally misleading readers, or if he didn’t have a CP2102 USB-UART adapter, but something else, but this advice is WRONG!

Through the CP2102 USB-UART adapter, the computer sees the Arduino Pro Mini as if it is connected to a COM port, that is, just like other Arduinos that have a USB-UART adapter on board.

Therefore, sketches in the Arduino Pro Mini are uploaded in the same way as in other Arduino models. You only need to select the Pro Mini model in the Arduino programming environment, then in the additional item that appears, select one of the 4 possible types of processor (ATmega168 or 328, 3.3 or 5V) and the virtual COM port that appeared after installing the USB-UART adapter drivers. Then you can use the download button or Ctrl-U. If everything is connected correctly, the type and model of the adapter does not matter, the sketches are uploaded via UART. Just select the COM port that the adapter is defined for.

After 2 hours of reading forums and sites with "manuals" and "tips", which turned out to be 99% wrong, at least they did not fit my specific Arduino Pro Mini models and USB-UART adapter CP2102, I managed to connect and upload everything correctly into the controller a slightly modified sketch of the flashing LED. I made him blink SOS in Morse code.

Here's the sketch, in case anyone's interested:

// the setup function runs once when you press reset or power the board
void setup()(
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() (
delay(100); // wait
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300);
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(300); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(300); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(300); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(300); // wait
delay(1500); // wait 1.5 sec.
}

Findings:

If I didn’t try to save time on “inventing the wheel” and didn’t spend time reading useless (even rather harmful) tips and manuals on forums and websites, connecting and flashing the Arduino Pro Mini would take not 2 hours, but a maximum of 5-10 minutes .

My set of Arduino Pro Mini and USB-UART adapter CP2102, by today's standards, I bought a little expensive. True, I am consoled by the fact that the adapter is correct and all signals are wired on it.

The Arduino Nano, which is identical in parameters and capabilities to the Arduino Pro Mini, costs a little more (25-50 cents maximum), loses 1 cm in size (and with soldered pins, the Arduino Pro Mini does not lose at all), but is much more convenient in use due to the built-in USB-UART and the common MicroUSB connector.

Arduino Pro Mini is not the most popular board, type “Arduino Nano” in eBay search and sort by price in ascending order and you will see how cunning Chinese sell a lot of Arduino Pro Minis that are passed off as Nano in this section very cheaply? in the hope that the buyer will not figure it out and, encroaching on the low price, will buy these controllers. They have all hope only for buyers-suckers.

Would I recommend buying an Arduino Pro Mini? Newbie - no. Yes - to a person who knows exactly what it is, what disadvantages it has and whether they are worth that meager savings.

Once again, flashing an Arduino Pro Mini is not difficult, but is this fuss with wiring or an Arduino UNO worth the $0.2-$0.25 price difference. Especially if you have to connect the controller to the computer for debugging many times, but if in a case? If you think that connecting and disconnecting 5 wires ten to fifteen times is more profitable than paying 20 cents, this controller is for you.

That's actually all. I shared my experience and expressed my opinion, it's up to you to decide.

P.S. A little time passed and I changed my mind about the Arduino Pro Mini a little. Even savings of 25-50 cents is a lot, especially if a small batch of products using this controller is assembled. It is clear that in a good way for a small batch it is desirable to integrate the controller directly onto the board, and not use a ready-made Arduino (it's still more of a debug board). But the options are different, sometimes there are already ready-made boards and you can upgrade them and expand the functionality by integrating the Arduino. It will be cheaper than building new boards.

And the presence of a USB-UART adapter on board the product transferred to the user is completely unnecessary and even harmful. So the Arduino Pro Mini has the right to life.