Fake chip makes me nervous

I was trying to configure the Microchip/Atmel SAMD21 USART to work at 110BPS to use with an old ABNT CODI protocol.

I noticed that the Silabs CP2102 on Linux doesn’t support such low baudate:

$ sudo stty 110 cs8 -parenb -F /dev/ttyUSB0 
stty: /dev/ttyUSB0: unable to perform all requested operations

“Fortunately” I had a FTDI USB/Serial module that accepts this low baudrate. Then after spending many days trying to figure out why the communication at 110 BPS wasn’t working I decided to use the Logic Analyzer and discovered that the FTDI chip wasn’t generating the 110BPS.

Then I realized there are some FTDI fake chips that don’t work correctly at high speed. Now I can confirm they will not work correct at low speed either. Probably these fake chips use a microcontroller instead of a real IP for USB/Serial and they have loss of precision at low and high baudrates.

Then I decided to use two SAMD21 boards to test the communication, the first board will transmit at 110BPS and the second one will received the data at same baudrate. It worked fine.

Then I found a Prolific PL2303 USB/Serial dongle here and decided to test it. And to my surprise the PL2303 worked fine at 110 BPS and I could test it from computer to the board.

In the computer:

$ sudo stty 110 cs8 -parenb -F /dev/ttyUSB0
$ echo "Hello" > /dev/ttyUSB0

In the SAMD21 board:

nsh> dd if=/dev/ttyS0 of=/dev/console bs=1 count=10                             
Hello

This is a good 110BPS waveform:

Note that it wasted 90.752ms to transmit 10 bits, then each bit wasted 9.0752ms to be transmitted. Therefore to transmit 110 Bits it wastes 9.0752 * 110 = 998,272 ms. Nearly 1 second to transmit 110 bits, the error is only 0,17%.

So, never trust on your serial communication if you are using a USB/Serial from China.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s