Problem

In a recent project we need an usb-serial conver to manage a serial output from an ATtiny202 https://www.microchip.com/wwwproducts/en/ATTINY202.

The general idea was to use one of the pins for programming (using UPDI) and comunication. We needed to catch the serial number in the flashing phase and save it the the customer’s ERP. Nice and simple. So we choose a great open project to manage the flashing process (pyupdi available at https://github.com/mraardvark/pyupdi/).

The problems starts with the first tests: no way we could connect to the device using a PL2303 device we bought in internet. Using the same device at 9600 baud, the serial comunication was working well. Back to pyupdi, it was stucked with a “UPDI not OK Reinitialization required” error.

We where using a Rapberry pi 3, starting in netboot,  as a gateway between our programming environment and the device, and from time to time the network port of our Rapsperry went stuck.

This kind of devices are very common and not always very cheap. We bought tens of this just for common technical use.

So here, in XtendSenses, we decided to go deeply in the problem.

Analysis

The USB-Serial converter was bought in internet and sold as a PL2303 converter. As said we bought those from different sources and in different time. When attached to Linux, the driver loaded is the pl2303. These are very common converters, sold everywhere as original.

When looking the TX pin in the scope we saw this:

We checked convertes coming from different lots, and the result was always the same.

As you can see the signal was really noisy with a low level of 1.18Volts! We understtod that the deeply noise was iniected into the Raspberry, causing the problems. At the same time the digital low level, for the Attiny202, is define as Vcc*0.3. Having in our board a Vcc of 3.3 volts, the max Low Level accepted was 1.1…

The noise was a triangle signal with a frequency of 200Khz, and was present in the RX, TX and 3v3 pin. The 5vcc pin was instead quite good. Clearly this noise come from the internal DC/DC converter not catched by any capacitor.

Solution

We supposed the 3.3 in the output was  directly connected to the internal 3v3 line of power, so we tried adding a 10uF ceramic capacitor between the two lines.

Magically the noise disappeared.

Here the power line after we add the capacitor:

Pretty clean, isn’t?

To solve the 1.18 volt problem we have to add a PNP transistor (we used a bc327) with this configuration:

Here the final result:

Now pyupdi and our dear Raspberry work well and without problems