(SOLVED) Problem with RS232 Communication on OTGW

This Forum is about the Opentherm gateway (OTGW) from Schelte

Moderator: hvxl

Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

(SOLVED) Problem with RS232 Communication on OTGW

Post by Punkt »

Hi all,

first: sorry for my bad english.

I assembeld an otgw board from http://otgw.tclcode.com
I tried to connect via an usb->RS232 Connector but i only get garbage output.
So i checked everything in the troubleshooting sector (http://otgw.tclcode.com/debugging.html) an i realized that i only got the following voltages on the MAX232 IC:

Pin 2: 7,35V
Pin 6: -8,39V

Is it possible that this voltages are too low?
I tried several MAX232 ICs - but every time with the same problem.

Do you have any hints for me?

Thanks in advance!

Michael
Last edited by Punkt on Mon Feb 08, 2021 12:17 am, edited 1 time in total.
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

Those voltages should normally work, unless you use a long cable for your serial connection, like 10m. Garbage is normally an indication of a wrong baud rate. What application do you use to connect to the serial interface? If something other than OTmonitor, check the baud rate is set to 9600 baud, 8 bits, no parity, 1 stop bit.
Schelte
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

Hi,

thanks for your reply.

My cable is quiet short - around 20cm...
I tested this with several Tools (on Linux) - HTerm, screen, minicom...
I also tested several baud rates - ever with some more or less garbage output.

So i tried to test one part after another - also several RS232 ICs (actually i only have 3 UT232AG; Original MAX232 are already ordered).

- If i short RXD <-> TXD on my USB-RS232-Adapter i receive the same data i send.

- Then - if i setup the UT232AG like in the datasheet (no matter if i use 1 µF or 100nF condensators) an short PIN 11 (T1IN) and 12 (R1OUT) then i get these garbage outputs.

Furthermore i tested if i can read the TTL signals directly from the PIC.
Therefore i connected the TTL Pins directly to an USB-TTL-Adapter.
But there i got also some garbage output....

...now in the meantime i am totally confused if i did wreck my ICs or if i am totally on the wrong way... :roll:

Normally i worked since years a lot with serial signals with several Adapters - but this time i stand somewhere in the nowhere... :lol:
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

OK, if connecting pins 11 and 12 of the MAX232 together already gives you garbage on your USB->RS232 adapter, then it can't be a baud rate problem or the fact that the PIC is not programmed or something like that (assuming you removed the PIC from the circuit when you did the test).

The only problem causes left I can think of are:
  • Broken MAX232. Unlikely, because you tried different chips.
  • Fault on the circuit board. You would have to measure for broken connections or short circuits.
  • Incorrect connection of the USB->RS232 adapter to the PCB. Note that the connections may be considered unusual. Pin 3 of the header is TX, pin 5 is RX, and pin 9 is GND. If you use a prefabricated DB9 cable that fits onto the header, it will usually have pin 2 for TX, pin 3 for RX (or the other way around), and pin 5 for GND.
Schelte
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

Yes - i removed the PIC during my test with the UT232AG.

I ordered some new MAX232 - this time i get hopefully some originals from MAXIM...if they arrive i will repeat my test and give a feedback in this topic.

But just one question:
Like mentioned above - should it be possible to read out the PIC via a normal USB-TTL-Adapter?
Is there something i have to keep in mind before doing this or can i just connect 5V, GND, TxD and RxD to the PIC on the gateway board (without the UT232/MAX232)?
TxD and RxD i would then connect via the connector Pins 11 and 12 of IC2 (where normally the MAX232 sits)...correct?
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

Yes. If you remove the MAX232 and put 2 jumper wires between pins 11 - 14 and 12 - 13, you can connect a USB-TTL serial adapter to SV1 (the RS232 header). Or you can connect it to pins 11, 12, and 15 of the IC2 socket. Whatever is easiest. Do not connect the 5V.
Schelte
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

hvxl wrote:Do not connect the 5V.
....upps....why? :D
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

...one step ahead...

...i tried the following setup:
otgw board without MAX232 - but with PIC onboard.
Then i connected my USB-TTL (FTDI) adapter like described above...and: nothing.

I used a freshly programmed (and verified) PIC, tried the TxD and RxD Pins vice versa...but i did not get any signal from the PIC.
Between the Pins 5 and 14 i got 5V...is there anything else needed to get a signal from the PIC?

Sorry for my dumb questions...but i didnt really get it in my head... :roll:
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

Punkt wrote:
hvxl wrote:Do not connect the 5V.
....upps....why? :D
The USB device derives its 5V from the PC. The OTGW has its own 5V power supply. These will almost certainly not be exactly the same voltage. Power supplies generally have low impedance, so the power supply with the lower voltage will draw a large current from the other power supply. That's not good for either of the two.
Schelte
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

If you just set up the PIC on a breadboard with a resistor between the reset pin (4) and Vdd (14) and connect the USB TTL serial adapter to it, you should see the PIC reporting "OpenTherm Gateway 5.0" when you reset it. In this case you would connect the adapter's GND (to pin 5), TX (to pin 8), RX (to pin 11), ánd 5V (to pin 14), because the PIC now doesn't have an own power supply. You should also be able to send serial commands to it, like PR=A, and get a response.
Schelte
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

ok - first victory.

If i connect the PIC as you suggested i get connected to it and if i take away 5V (or GND) and reconnect i get the output

Code: Select all

OpenTherm Gateway 5.0
and a few moments later

Code: Select all

Thermostat disconnected
Every second i get

Code: Select all

R00000000
and sometimes in between i get

Code: Select all

Error 03
but i think this is because there is nothing else connected to the PIC.
So i put the PIC back into the board - and: nothing. No output.
I connected the PIC on the board via the TTL-Adapter - not with mains connected.
I think this must work also - because on the breadboard its the same.
The 5V Connector i put on the LED Pin1 which is connected to Pin14 of the PIC.
On Pin14, 4 an 7 i got 5,134V, also i have a connection from Pin8 and Pin11 to my Connectors of the TTL-Adapter - so the PIC normally should work (as i understood).

I did thousands of control measurements - but i didnt find anything what could cause this malfunction...
I even found, that Q4 is one time described as BC548 - and the other time as BC547B...but i think this has nothing to do with my error.

I now running slowly out of ideas why the PIC is not running properly when attached to my board.
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

one last test for this evening/morning:

I measured the voltages on the PIC like described in the troubleshooting section and got the following values (Mains connected, no TTL-Adapter, no MAX232 attached):

IC1:
pin1=1,24V (ok)
pin2=4,6-4,9V (nok - should be 0V)
pin3=5,06V (ok? - should be 4.5V)
pin4=5,06V (ok)
pin8=0,97V (nok - should be 5V)
pin9=5,06V (ok)
pin10=4,5-5,06V (ok? - should be 5V)
pin11=5V (ok)
pin12=5,06 (ok)
pin13=5,06 (ok)
pin17=3,94 (ok? - should be 3.0V)
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

Good. So we now know that both the PIC and the USB adapter are OK.
Punkt wrote:pin8=0,97V (nok - should be 5V)
There's your problem. That is a permanent BREAK condition, which causes the OTGW to reset itself. Now you just need to figure out where that low voltage is coming from.
Schelte
Punkt
Starting Member
Starting Member
Posts: 11
Joined: Fri Feb 05, 2021 4:08 pm

Re: Problem with RS232 Communication on OTGW

Post by Punkt »

So, i now resoldered the IC holder and did further tests.

I attached the PIC to a breadboard an only connected the 5V, GND, TxD and RxD Connectors and attached the Resistor between 4 and 14.
So i could connect to the PIC, get the Version message and every second the message R00000000.

But already in this constellation it didn't create any response if i send PR=A to the PIC - is it possible that this doesn't work because of the R000000 message?

Ok - for further testings i connected every PIC pin from the breadboard to the gateway board and tested every time if i get a connection:
20210207_174014.jpg
20210207_174014.jpg (256.53 KiB) Viewed 3598 times
What i now found out:
1. If i measure the voltage on Pin8 of the PIC i get 5V - ok so far (nevertheless the PIC doesn't react on my PR=A command).
2. the messages with "Error 03" are gone.
but
3. a strange thing happens: if i connect Pin17 from the breadboard to the gateway board i get the message: "Thermostat connected" - and there are no more messages (R00000000) coming in.

I checked every connection if there are bad solderings or no connection or something like this - but: nothing - all seems ok.
I saw that Q4 is in the schematic labeled as BC548A - but in the ordering list there is BC547B - is this a possible error?
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Problem with RS232 Communication on OTGW

Post by hvxl »

No. PR=A should produce a result. It does need to be followed by CR. (CR + LF is also allowed.) It's best to use OTmonitor for testing. I wrote it specifically to eliminate uncertainties like this.

3. is not strange. You didn't power the circuit board, so there is no 24V. This pulls the thermostat line low, which looks to the PIC like a thermostat is connected. When a thermostat is connected, the OTGW stops generating its own Opentherm messages.

The BC548A and BC547B are very similar. The BC547B just has a higher breakdown voltage and a higher hFE. Neither of these properties is very critical. A bad transistor would not affect the serial communication anyway.
Schelte
Post Reply

Return to “Opentherm Gateway Forum”