Strange behaviour of CLING together with termios (RS232-connection)

Hi ROOTers,
I’m trying to connect a HP 33120A wave-generator via RS232 to my computer.
I wrote a very simple c program, which works pretty file (see hp33120.c)

when I’m trying to put the content of the program into a C++ class and provide this to root the rs232-io behaves very strange:
The device has problems to interpret the code, so I put a logic analyser to the TX-line and put the output in the attachement. As you can see I tried to write “SYSTEM:REMOTE\n”. In case of the simple c program it works fine, running over CLING with the test-script it generates strange bit-patterns at the beginning (here are two bit which should not be), because of this everything is shifted and the code cannot be interpreted correctly anymore. I tried to make workarounds with usleeps, but its not working.

Please tell me if you have any hint

Georg



testRS232.C (281 Bytes)
RS232Link.h (1.61 KB)
RS232Link.cpp (3.14 KB)
hp33120a.c (4.58 KB)

Hi,

No idea. Maybe try valgrind? I’d suspect a memory issue.

What happens if you rename your main() into hp33120a and then just run
.x hp33120a.c

  • does that work?

Cheers, Axel.

It seems that the delta in the signals (visual inspection) is also increasing with time (?)

If I were you, I would look at what causes the initial discrepancy and take it from there.

_sk

Hi Axel,

thanks for this hint to run the c-prog in CLANG… yes this works…

I checked some much older projects I worked on before and found another RS232-class. I copied some lines together and it seems to work - sorry the code is ugly, but it works! I didn’t check the receive function so far, seems I implemented some special cases here in order to allow a line-end which is not the message-end.

I do not understand the difference so far… at the moment I am happy its working.

Georg
RS232Link.cpp (4.87 KB)
RS232Link.h (2.12 KB)