Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem w/ NI9871 RS485 module - need to manually assert DTR?

I am having a strange problem with a 9871 RS485 module in a cRIO-9066
chassis (running kernel version 4.1.15-rt17-ni-4.0.0f1 #1 SMP PREEMPT RT).
I want to deal with the ports from a C program running in the
Linux.  I have this working fine, in the two wire auto wiremode to some
devices I've used before under x86 Linux ... except I have two startup
problems:

(a) It works (sort of) after a boot.  If I stop the program (I close the
file descriptors for the ports), when I try to restart it, it hangs at
the open ( "fd = open( "/dev/ttyNIRIOslot8port0", O_RDWR | O_NOCTTY);").
For a while, I was getting around this by restarting the cRIO. More
recently, I've discovered that I can get it to go past the open, by
opening the VISA control panel, choosing the port, and picking the
"Flow Control" tab.  The "flow control" radio buttons show as "None".
The DTR signal is shown as "unasserted".  I change that to "asserted",
and push "Apply Changes".  At this point, it will still be hung at the
open, until I click the "go away" box of the VISA window.  Then the
open proceeds.

 

(b) My first attempt at writing and reading from the port, is
unsuccessful; nothing comes back to the read (I think because the
write is not happening - I think that is what I saw when I looked with
a scope.)  This can be fixed be performing the same procedure as above
(asserting DTR) a second time.  From then on, the program works great.

I have tried doing the asserts of DTR in the program, by using the TIOCMSET
ioctl.  Interestingly, if I do the TIOCMGET right after having dome the
manual DTR assertion, the flags returned do not seem to have changed.

(1) Any ideas of what else to try?

(2) Right now I've only wired to 5 of the 9 pins in the RJ50 connector
(TXD-, RXD-, TXD+, RXD+, and ground).  Does the flow control handshaking
need me to have done anything with the RTS / CTS pairs? (After the open,
I have set -CRTSDTS in the termios, which stty confirms; I have most
everything else turned off in the stty, except for CREAD).

Thanks,
   Andy S.

0 Kudos
Message 1 of 2
(3,200 Views)

Hi,

 

Thank you for posting your issue. Have you thought the posibility of controlling the comunication with the flow control functions!? by includig what you described in (a).

 

Luis G.

0 Kudos
Message 2 of 2
(3,132 Views)