0
  1. Is there a way (or trick) to set a CH340 to 25000 baud on Linux?

If not:

  1. Is there a better chip which is able to do that 25000 baud (no FTDI please)?
  2. Is there a completely different and better way to achieve my goal (see below)?

Background:

I would like to interface a China Diesel heater to a Raspberry Pi (OpenPlotter on a ship).

This was done in Open Source with a uC (STM or EsP32) with http://www.mrjones.id.au/afterburner/

There is this blue wire with half duplex RS232@TTL and baud rate of 25.000 baud (8N1). This is the binary, proprietary communication interface to the heating.

I tried to use one of this china USB to RS485 adapters which use a CH340C internally. USB to RS485

The interface of Afterburner: Half duplex RS232@TTL The USB to RS485 interface is similar Afterburner: MAX485 with transistor

I think I should be able to use this interface without major modifications if I would use "channel B" of RS485 with a pull up resistor (worth a try).

My main problem is the baud rate at the moment. I think I will run in the same problem if I would use a CP210x. I guess a FTDI232 might be able to handle this baud rate but I will not use this chip at all.

My other idea was to use a NodeMCU (CH340 with ESP32/ESP8266) and speak 25000 baud to the heating and 28800 over the serial to USB of the NodeMCU. I think this is a little bit overkill to do it this way.

muebau
  • 152
  • 7
  • The baud rate of all the mentioned chips is controlled by the USB host. Whatever software you use on Windows, macOS, Linux etc. can and should select 25,000 baud. Did you try that? – Codo Oct 08 '21 at 11:48
  • Yes but according to the datasheet of the CH340 I found no way to set the custom baud rate of 25000. The next standard baud rate would be 28800 and this way far off. – muebau Oct 08 '21 at 11:49
  • Most USB-to-UART converters support arbitrary baud rates. The CH340 might be the exception. But have you actually verified that it does not support it? – Codo Oct 08 '21 at 11:57
  • yes with gtkterm: `tty_tiocsserial: 'gtkterm' is using deprecated serial flags (with no effect): 00000200` `tty_tiocsserial: 'gtkterm' is using deprecated serial flags (with no effect): 00008400` – muebau Oct 08 '21 at 12:01
  • `stty -F /dev/ttyUSB0 25000` gives `stty: invalid argument '25000'` – muebau Oct 08 '21 at 12:04
  • I tried it with python3 and there it looks like I get no errors. (stty does not support non standard baud rates) I would have to check with my oscilloscope to make sure that everything works correctly. – muebau Oct 08 '21 at 12:19
  • 1
    I've verified it with an oscilloscope: A CH340G does support 25,000 baud. It shows the correct pulse length of 40µs. – Codo Oct 08 '21 at 19:21
  • Wow this was fast. Thank you a lot. I thought to setup a ESP8266 to test it but had no spare time to do so. So thanks again. – muebau Oct 09 '21 at 16:48

0 Answers0