Author Topic: Datasheets for ch341 serial<->usb converter  (Read 2521 times)

0 Members and 1 Guest are viewing this topic.

Offline KrakonosTopic starter

  • Contributor
  • Posts: 13
Datasheets for ch341 serial<->usb converter
« on: February 13, 2015, 02:54:04 pm »
Hi!

I've been experimenting with some stuff here, and needed a serial port in 1200 baud, 7E2 configuration, and noticed, I don't have one. Most of the converters I have are ch341 based, even the supposedly "good ones" from local store, and the Linux kernel does not have support for parity and two stop bits, since there are no datasheets. I am willing to write a patch (it's not that difficult), but need to know which registers control these features, and can not find a datasheet (and people claim it works in Windows).

Maybe someone here can get me one, or at least read out the register setup for parity and stop bits? Let me know if you do!

Thanks!
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8334
Re: Datasheets for ch341 serial<->usb converter
« Reply #1 on: February 13, 2015, 04:49:46 pm »
From https://github.com/karlp/ch341-linux/blob/master/drivers/CH341SER_LINUX/ch34x.c ; it looks like this is the official driver so you can RE the configuration from it if you really want to write your own; it seems that a byte is written to set the mode in the following format:

Bits 0 and 1 of config byte select number of bits: 5 (00), 6, 7, and 8 (11)
Bit 2 enables 2 stop bits
Bit 3 enables parity generation
Bits 4 and 5 select parity type:
 00 - odd
 01 - even
 10 - mark
 11 - space
Bits 6 and 7 enable RX/TX (mention of SFR here - this is probably based on an 8051)

Basically the same format (excluding bits 6 and 7) as the ones in the LCR of a 8250 UART...
 

Offline KrakonosTopic starter

  • Contributor
  • Posts: 13
Re: Datasheets for ch341 serial<->usb converter
« Reply #2 on: February 13, 2015, 08:47:38 pm »
Thanks! I've seen this come up in google, but I always thought it is the same as in the main tree.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf