Electronics > Projects, Designs, and Technical Stuff

CH9102x USB-Serial Data Corruption --- 7-n-1 vs 8-n-1

(1/2) > >>

sleemanj:
Scratching my head here.

USB-UART modules out of China which have replaced the old classic CP2102 with the pin-compatible WCH CH9102x

An Arduino Pro-Mini with the ASCII table example sketch on it at 9600 Baud

Connect an original CP2102 module to it ( /dev/ttyUSB0 ), works fine, correct output.


--- Code: ---ASCII Table ~ Character Map
!, dec: 33, hex: 21, oct: 41, bin: 100001
", dec: 34, hex: 22, oct: 42, bin: 100010
#, dec: 35, hex: 23, oct: 43, bin: 100011
$, dec: 36, hex: 24, oct: 44, bin: 100100

--- End code ---

Connect the new CH9102x module to it ( /dev/ttyACM0 - CDC driver ), garbage.


--- Code: ---  �"��: LLb hY� 6� z��i �M �n����1�L�Hp "�c�����.��i �b"��:�1�B��

--- End code ---

If I change the serial terminal (separate serial terminal, not the one in the Arduino IDE which can't change that) to 7-n-1 instead of 8-n-1 then I get maybe 95-98% correct output from the CH9102x


--- Code: ---ASCII Table ~ Chara#ter Map
!, dec: 33, h%x: 21, oct: 41, "in: 100001
", dec: 34, he8: 22, oct: 42, b)n: 100010
#, dec: 35, he8: 23, o#t: 43, bin: 100011
$, $ec: 36, he8: 24, oct: 44, bin: 100100

--- End code ---

This is even though the Arduino sketch is unchanged and should be sending 8-n-1 (as evidence by the fact that the CP2102 module is correct output at 8-n-1).

My best guess is that there is some bit timing issue with the CH9102x and it's most of a bit-length out?  Any better ideas?

NiHaoMike:
Connect a scope and see if some weird stuff is happening with the signals.

voltsandjolts:
Adafruit seem to be using CH9102F successfully as CP2102 replacement. Yeh, check the bit width.

sleemanj:
A scope sounds sensible, except that the problem seems more likely on the unscopable USB side not the serial side which is only receiving from the arduino, that a cp2102 is fine with.  Hmm, could be marginal timing on the arduino I guess, seems unlikely though.

I'll dig the scope or logic analyzer out and capture what the arduino sends.

sleemanj:
Transmission timing looks OK to me it is well within 1% of a bit length according to the logic analyzer.

Here is with the CP2102 attached, the arduino sending a constant string of "U" (binary 10101010 for convenience), this is received in the serial terminal fine.






Here it is with the CH9102x attached, same code, no changes just swapped the serial device, looks perfect to me in the logic analyzer, but the serial terminal is periodically corrupt characters.










Weird.  I wonder if it's a voltage supply problem maybe.  My USB is down at 4.78v,  Might have to see if I can find a powered hub around here somewhere.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod