CH340G USB-to-Serial converter

Forum for the discussion of JP1 Interfaces, hardware hacks, etc.

Moderator: Moderators

blackride
Posts: 24
Joined: Wed Mar 21, 2018 11:17 am

Post by blackride »

The Robman wrote:
blackride wrote:Now I have found a solution and now this is not a problem. Now the bit is not skipped, but also received as the first signal.
What did you do, did you re-write the code to ignore the toggle bit?
I added one more line to the second code (toggle bit). And the first signal is received, and the second signal is also received (not skipped).
I have three pieces of M74HC266B1. I collected one of them according to Tommy's scheme. But I can not try, because I do not yet have ftdi usb->com adapter (I'll get it soon and then I'll check).

Also I chose this model Samsung DVD-VCR Combo V4600.rmdu (NEC2) of the remote control to coincide with delay my Logitech Harmony 350. Thus, I can control all two devices trough three remote control (OFA URC-6440, URC-7140 and Logitech Harmony 350).
The Robman wrote:Given that we've been able to buy the FTDI cable from chip_partner for under $10 for so long, we have long since stopped bothering with any other chip/cable/method, so I doubt there is much expertise here anymore to help with that. If I were you, I'd just shell out the $8.50 for the chip_partner cable, because surely your time is worth more than that?
Oh, Thanks. This seller the price has for me - 6,55$.

A low bow to everyone who helped me in this matter. Thank You :)
The Robman
Site Owner
Posts: 21884
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

blackride wrote:
The Robman wrote:Given that we've been able to buy the FTDI cable from chip_partner for under $10 for so long, we have long since stopped bothering with any other chip/cable/method, so I doubt there is much expertise here anymore to help with that. If I were you, I'd just shell out the $8.50 for the chip_partner cable, because surely your time is worth more than that?
Oh, Thanks. This seller the price has for me - $6.55.
Yeah, I was including the $2 shipping charge.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
binky123
Expert
Posts: 1292
Joined: Sat Feb 14, 2004 3:35 am

Post by binky123 »

The M74HC266B1 chip may have been for the JP1 interface that talks I2C to the EEPROMs on the remote control device.

The newer remotes(JP1.X) use UART to communicate and thus need the FTDI or other UART chips.

Update: I was reviewing some of Tommy Tyler's design and one did have an 74HC266 IC in it that connected to a Serial port DB9. So it is possible to use the M74HC266B1.
Last edited by binky123 on Wed May 09, 2018 1:59 pm, edited 1 time in total.
binky123
Expert
Posts: 1292
Joined: Sat Feb 14, 2004 3:35 am

Post by binky123 »

Hi blackride, I'm modifying an old JP1.X interface that used DTR as RESET so I'm looking into building the jp12serial code again in case you want to test with the CH340G USB serial adaptor board later. I modified the interface to use RTS as RESET but it is not working on a JP1.3 remote but works on a JP1.2 remote.
blackride
Posts: 24
Joined: Wed Mar 21, 2018 11:17 am

Post by blackride »

binky123 wrote:Hi blackride, I'm modifying an old JP1.X interface that used DTR as RESET so I'm looking into building the jp12serial code again in case you want to test with the CH340G USB serial adaptor board later. I modified the interface to use RTS as RESET but it is not working on a JP1.3 remote but works on a JP1.2 remote.
Tell me where I can download your modified library jp12serial?
And
Tell me what pinout ch340 to JP1.X?
In my adapter ch340 is pins - DTR, RXD, TXD, VC (jumper 5v or 3,3v), CST, GND
Last edited by blackride on Fri May 11, 2018 2:11 am, edited 1 time in total.
The Robman
Site Owner
Posts: 21884
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

mdavej wrote:
blackride wrote:
mdavej wrote:JP1.4/3/2 all use the same interface. But I haven't seen anyone report success with the CH340G, including myself.
Shenson
http://www.hifi-remote.com/forums/viewt ... &&start=15
Nice. So you need his modified serial dll for this to work. Have you replaced your dll with his?
I wrote to Steve Henson offline, here's his reply...
shenson wrote:The cable I used was due to a limitation on the CH340G board I had: it didn't bring out RTS to a pin but instead used DTR. If the board does bring out RTS then the standard cable and jp12serial should work with the appropriate CH340G drivers loaded.

If the board doesn't bring out RTS then the user can try doing what I did: connect it the usual way but use DTR instead of RTS.

I made some very minimal change to jp12serial.cpp: toggling DTR at the same time as RTS in the two functions jp12OriginalConnect and resetRemote.

Disclaimer: this worked for me, I've no idea if this has any additional side effects.
He doesn't have the binary for his version of jp12serial anymore, but he sent me a "diff" file, which I have loaded here:
http://www.hifi-remote.com/forums/dload ... e_id=25215
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
blackride
Posts: 24
Joined: Wed Mar 21, 2018 11:17 am

Post by blackride »

The Robman wrote: He doesn't have the binary for his version of jp12serial anymore, but he sent me a "diff" file, which I have loaded here:
http://www.hifi-remote.com/forums/dload ... e_id=25215
What to do with this file?
I do not know how to turn it into library jp12serial.dll :(
The Robman
Site Owner
Posts: 21884
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

blackride wrote:
The Robman wrote: He doesn't have the binary for his version of jp12serial anymore, but he sent me a "diff" file, which I have loaded here:
http://www.hifi-remote.com/forums/dload ... e_id=25215
What to do with this file?
I do not know how to turn it into library jp12serial.dll :(
That was really for Binky's benefit.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Barf
Expert
Posts: 1524
Joined: Fri Oct 24, 2008 1:54 pm
Location: Munich, Germany
Contact:

Post by Barf »

The Robman wrote: ... he sent me a "diff" file, which I have loaded here:
http://www.hifi-remote.com/forums/dload ... e_id=25215
Shouldn't we check it into the SVN sources, as a branch?
binky123
Expert
Posts: 1292
Joined: Sat Feb 14, 2004 3:35 am

Post by binky123 »

Thanks for the diff. I think we can just incorporate it into the standard build.

So JP12OriginalConnection() is used for any interface that has RTS to control the reset line. His patches just add code to manipulate the DTR line as well in JP12OriginalConnection() and in resetRemote() if connection was JP12Orig.

If an interface uses RTS or DTR to control the /RESET line, the code should work.
binky123
Expert
Posts: 1292
Joined: Sat Feb 14, 2004 3:35 am

Post by binky123 »

I tried building a modified jp12serial.dll using mingw-w64 g++ but couldn't get the dll to load correctly in RMIR.

If someone can build it with the code changes, blackride can test it for us. I can test it as well on my remotes and build out a DTR interface to the FT232RL tester box.
blackride
Posts: 24
Joined: Wed Mar 21, 2018 11:17 am

Post by blackride »

binky123 wrote:I tried building a modified jp12serial.dll using mingw-w64 g++ but couldn't get the dll to load correctly in RMIR.

If someone can build it with the code changes, blackride can test it for us. I can test it as well on my remotes and build out a DTR interface to the FT232RL tester box.
Yes. I would check. Can anyone compile a library jp12serial.dll?
Barf
Expert
Posts: 1524
Joined: Fri Oct 24, 2008 1:54 pm
Location: Munich, Germany
Contact:

Post by Barf »

Blackride, I assume you are using Windows. Exactly which one, what bittness?

I have previously compiled it (as well as DecodeIR) for Linux and MacOS. The Windows versions were compiled by Graham using Microsoft Visual Studio (Express Edition should be enough). To compile it with gcc, either as Cygwin or MinGW (probably preferable) has been at least on my TODO-List for some time. So let's see...

Binky, exactly what went wrong?
binky123
Expert
Posts: 1292
Joined: Sat Feb 14, 2004 3:35 am

Post by binky123 »

I will try VS Express edition.

I was using mingw-w64 g++
jp12serial.dll: jp12serial.cpp ftdi.cpp
#%.dll: %.cpp ; $(GPP) -I'C:\Program Files\Java\jdk1.8.0_121\include' -I'C:\Program Files\Java\jdk1.8.0_121\include\win32' -shared -o $@ -DWIN32 $^ -Wl,--kill-at -Wl,--output-def,$*.def

and it generated a jp12serial.dll but it wouldn't load in RMIR. rmaster.err says attempting to load jp12serial.dll and then says failed to load.
binky123
Expert
Posts: 1292
Joined: Sat Feb 14, 2004 3:35 am

Post by binky123 »

I downloaded VS Community 2017 edition and have it configured but it is missing Windows 8.1 SDK. I will get that later. I then reviewed the comments in the file and it suggested building it with jdk6 so I downloaded that one.

Windows + MinGW: g++ -I "c:\Program Files\Java\jdk1.6.0_12\include" -I "c:\Program Files\Java\jdk1.6.0_12\include\win32" -shared -o jp12serial.dll jp12serial.cpp ftdi.cpp -Wl,--kill-at

g++ --version
g++ (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 7.3.0

g++ -I "c:\Program Files\Java\jdk1.6.0_45\include" -I "c:\Program Files\Java\jdk1.6.0_45\include\win32" -shared -o jp12serial.dll jp12serial.cpp ftdi.cpp -Wl,--kill-at

LibraryLoader: Attempting to load 'jp12serial' from 'E:\RemoteMaster.v2.06build5\Windows-amd64\jp12serial.dll'...
LibraryLoader: Failed to load 'jp12serial' from 'E:\RemoteMaster.v2.06build5\Windows-amd64\jp12serial.dll'

I will now go back to trying with VS Community 2017 edition.
Post Reply